| Line | Branch | Exec | Source |
|---|---|---|---|
| 1 | #include "base/general.h" | ||
| 2 | #include "base/handles.h" | ||
| 3 | #include "base/mapscr.h" | ||
| 4 | #include "base/util.h" | ||
| 5 | #include "base/zdefs.h" | ||
| 6 | #include "zc/maps.h" | ||
| 7 | #include "zc/replay.h" | ||
| 8 | #include "zc/zelda.h" | ||
| 9 | |||
| 10 | #include <optional> | ||
| 11 | #include <cstring> | ||
| 12 | #include <set> | ||
| 13 | #include <stdio.h> | ||
| 14 | |||
| 15 | #include "base/qrs.h" | ||
| 16 | #include "base/dmap.h" | ||
| 17 | #include "zc/hero.h" | ||
| 18 | #include "zc/guys.h" | ||
| 19 | #include "subscr.h" | ||
| 20 | #include "zc/maps.h" | ||
| 21 | #include "zc/replay.h" | ||
| 22 | #include "zc/zc_ffc.h" | ||
| 23 | #include "zc/zc_subscr.h" | ||
| 24 | #include "zc/decorations.h" | ||
| 25 | #include "gamedata.h" | ||
| 26 | #include "hero_tiles.h" | ||
| 27 | #include "zc/title.h" | ||
| 28 | #include "zc/ffscript.h" | ||
| 29 | #include "drawing.h" | ||
| 30 | #include "zc/combos.h" | ||
| 31 | #include "base/zc_math.h" | ||
| 32 | #include "user_object.h" | ||
| 33 | #include "slopes.h" | ||
| 34 | #include "zc/zc_sys.h" | ||
| 35 | #include "zinfo.h" | ||
| 36 | #include "base/misctypes.h" | ||
| 37 | #include "music_playback.h" | ||
| 38 | #include "iter.h" | ||
| 39 | |||
| 40 | extern refInfo playerScriptData; | ||
| 41 | #include "zscriptversion.h" | ||
| 42 | #include "particles.h" | ||
| 43 | #include <fmt/format.h> | ||
| 44 | #include "zc/render.h" | ||
| 45 | #include <array> | ||
| 46 | |||
| 47 | extern refInfo *ri; //= NULL; | ||
| 48 | extern int32_t(*stack)[MAX_STACK_SIZE]; | ||
| 49 | extern portal mirror_portal; | ||
| 50 | using std::set; | ||
| 51 | |||
| 52 | extern int32_t skipcont; | ||
| 53 | |||
| 54 | extern int32_t draw_screen_clip_rect_x1; | ||
| 55 | extern int32_t draw_screen_clip_rect_x2; | ||
| 56 | extern int32_t draw_screen_clip_rect_y1; | ||
| 57 | extern int32_t draw_screen_clip_rect_y2; | ||
| 58 | |||
| 59 | int32_t hero_count = -1; | ||
| 60 | extern int32_t hero_animation_speed; //lower is faster animation | ||
| 61 | static int32_t z3step = 2; | ||
| 62 | 427 | static zfix hero_newstep(1.5); | |
| 63 | 427 | static zfix hero_newstep_diag(1.5); | |
| 64 | bool did_scripta=false; | ||
| 65 | bool did_scriptb=false; | ||
| 66 | bool did_scriptl=false; | ||
| 67 | byte lshift = 0; | ||
| 68 | int32_t dowpn = -1; | ||
| 69 | int32_t directItemA = -1; | ||
| 70 | int32_t directItemB = -1; | ||
| 71 | int32_t directItemX = -1; | ||
| 72 | int32_t directItemY = -1; | ||
| 73 | int32_t directWpn = -1; | ||
| 74 | int32_t whistleitem=-1; | ||
| 75 | extern int32_t script_hero_cset; | ||
| 76 | |||
| 77 | void playLevelMusic(); | ||
| 78 | |||
| 79 | byte lsteps[8] = { 1, 1, 2, 1, 1, 2, 1, 1 }; | ||
| 80 | |||
| 81 | #define CANFORCEFACEUP (get_qr(qr_SIDEVIEWLADDER_FACEUP)!=0 && dir!=up && (action==walking || action==none)) | ||
| 82 | #define NO_GRIDLOCK (get_qr(qr_DISABLE_4WAY_GRIDLOCK)||get_qr(qr_NEW_HERO_MOVEMENT2)) | ||
| 83 | #define FIXED_Z3_ANIMATION ((zinit.heroAnimationStyle==las_zelda3||zinit.heroAnimationStyle==las_zelda3slow)&&!get_qr(qr_BROKEN_Z3_ANIMATION)) | ||
| 84 | |||
| 85 | 76049582 | zfix HeroClass::get_standing_z_state() const | |
| 86 | { | ||
| 87 |
2/2✓ Branch 0 taken 70022 times.
✓ Branch 1 taken 75979560 times.
|
76049582 | if (standing_on_z < 0) // diving under stuff |
| 88 | 70022 | return standing_on_z; | |
| 89 | 75979560 | zfix ret = standing_on_z + z + fakez; | |
| 90 |
1/2✓ Branch 0 taken 75979560 times.
✗ Branch 1 not taken.
|
75979560 | if (ret < 0) // overflow? |
| 91 | ✗ | return STANDING_Z_MAX; | |
| 92 | 75979560 | return ret; | |
| 93 | 76049582 | } | |
| 94 | |||
| 95 | 66 | bool item_error() | |
| 96 | { | ||
| 97 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 58 times.
|
66 | if(QMisc.miscsfx[sfxERROR]) |
| 98 | 8 | sfx(QMisc.miscsfx[sfxERROR]); | |
| 99 | 66 | return false; | |
| 100 | } | ||
| 101 | 5769043 | static inline bool on_sideview_slope(int32_t x, int32_t y, int32_t oldx, int32_t oldy) | |
| 102 | { | ||
| 103 |
2/2✓ Branch 0 taken 811 times.
✓ Branch 1 taken 5768232 times.
|
5769043 | if(check_new_slope(x, y+0.0001_zf, 16, 16, oldx, oldy, false, true) < 0) return true; |
| 104 | 5768232 | return false; | |
| 105 | 5769043 | } | |
| 106 | |||
| 107 | 12884088 | static inline bool platform_fallthrough(bool doslopecheck = true) | |
| 108 | { | ||
| 109 |
2/2✓ Branch 0 taken 10960587 times.
✓ Branch 1 taken 1923501 times.
|
12884088 | if (!getInput(btnDown, INPUT_HERO_ACTION | (get_qr(qr_SIDEVIEW_FALLTHROUGH_USES_DRUNK) ? INPUT_DRUNK : 0))) |
| 110 | 10960587 | return false; | |
| 111 | |||
| 112 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1923501 times.
|
1923501 | if (get_qr(qr_DOWN_FALL_THROUGH_SIDEVIEW_PLATFORMS)) |
| 113 | ✗ | return true; | |
| 114 | |||
| 115 |
3/4✓ Branch 0 taken 33989 times.
✓ Branch 1 taken 1889512 times.
✓ Branch 2 taken 33989 times.
✗ Branch 3 not taken.
|
1923501 | if (Hero.jumping < 0 && get_qr(qr_DOWNJUMP_FALL_THROUGH_SIDEVIEW_PLATFORMS)) |
| 116 | ✗ | return true; | |
| 117 | |||
| 118 |
7/8✓ Branch 0 taken 1923501 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 706 times.
✓ Branch 3 taken 1922795 times.
✓ Branch 4 taken 1922747 times.
✓ Branch 5 taken 48 times.
✓ Branch 6 taken 105 times.
✓ Branch 7 taken 1923396 times.
|
3846296 | if (doslopecheck && !on_sideview_slope(Hero.x, Hero.y,Hero.old_x,Hero.old_y) && (on_sideview_slope(Hero.x,Hero.y+1,Hero.old_x,Hero.old_y) || on_sideview_slope(Hero.x, Hero.y + 2, Hero.old_x, Hero.old_y))) |
| 119 | 105 | return true; | |
| 120 | |||
| 121 | 1923396 | return false; | |
| 122 | 12884088 | } | |
| 123 | |||
| 124 | 5497 | static inline bool on_sideview_solid(zfix x, zfix y, bool ignoreFallthrough = false, int32_t slopesmisc = 0) | |
| 125 | { | ||
| 126 |
3/4✓ Branch 0 taken 5497 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4451 times.
✓ Branch 3 taken 1046 times.
|
5497 | if(slopesmisc != 1 && check_slope(x, y + 0.0001_zf, 16, 16, (slopesmisc == 3), true) < 0) return true; |
| 127 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4451 times.
|
4451 | if(slopesmisc == 2) return false; |
| 128 |
4/4✓ Branch 0 taken 3579 times.
✓ Branch 1 taken 872 times.
✓ Branch 2 taken 10 times.
✓ Branch 3 taken 3569 times.
|
4451 | if (_walkflag(x+4,y+16,1) || _walkflag(x+12,y+16,1)) return true; |
| 129 | 3569 | mapscr* s = get_scr_for_world_xy(x, y); | |
| 130 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 3569 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
3569 | if (y>=world_h-16 && cur_screen>=0x70 && !(s->flags2&wfDOWN)) return true; |
| 131 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 3569 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
3569 | if (platform_fallthrough() && !ignoreFallthrough) return false; |
| 132 |
2/4✓ Branch 0 taken 3569 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3569 times.
✗ Branch 3 not taken.
|
3569 | if(slopesmisc != 1 && check_slope(x, y + 0.0001_zf, 16, 16, false, true) < 0) return true; |
| 133 |
6/6✓ Branch 0 taken 3265 times.
✓ Branch 1 taken 304 times.
✓ Branch 2 taken 61 times.
✓ Branch 3 taken 243 times.
✓ Branch 4 taken 61 times.
✓ Branch 5 taken 3508 times.
|
3873 | if (y.getInt() % 16 ==0 && (checkSVLadderPlatform(x+4,y+16) || checkSVLadderPlatform(x+12,y+16))) |
| 134 | 61 | return true; | |
| 135 | 3508 | return false; | |
| 136 | 5497 | } | |
| 137 | |||
| 138 | 17222430 | static inline bool on_sideview_solid_oldpos(sprite* obj, bool ignoreFallthrough = false, int32_t slopesmisc = 0, zfix xofs = 0, zfix yofs = 0) | |
| 139 | { | ||
| 140 | 17222430 | zfix rx = obj->x+obj->hxofs+obj->sxofs+xofs, ry = obj->y+obj->hyofs+obj->syofs+yofs, | |
| 141 | 17222430 | rw = obj->hit_width+obj->sxsz_ofs, rh = obj->hit_height+obj->sysz_ofs, | |
| 142 | 17222430 | orx = obj->old_x+obj->hxofs+obj->sxofs, ory = obj->old_y+obj->hyofs+obj->syofs, | |
| 143 | 17222430 | x = obj->x+xofs, y = obj->y+yofs; | |
| 144 |
4/4✓ Branch 0 taken 2065998 times.
✓ Branch 1 taken 15156432 times.
✓ Branch 2 taken 2052634 times.
✓ Branch 3 taken 13364 times.
|
17222430 | if(slopesmisc != 1 && check_new_slope(rx, ry+0.0001_zf, rw, rh, orx, ory, (slopesmisc == 3), true, obj->slopeid) < 0) |
| 145 | 13364 | return true; | |
| 146 |
2/2✓ Branch 0 taken 158055 times.
✓ Branch 1 taken 17051011 times.
|
17209066 | if(slopesmisc == 2) |
| 147 | 158055 | return false; | |
| 148 |
4/4✓ Branch 0 taken 13223296 times.
✓ Branch 1 taken 3827715 times.
✓ Branch 2 taken 341833 times.
✓ Branch 3 taken 12881463 times.
|
17051011 | if (_walkflag(x+4,y+16,1) || _walkflag(x+12,y+16,1)) |
| 149 | 4169548 | return true; | |
| 150 |
6/6✓ Branch 0 taken 104491 times.
✓ Branch 1 taken 12776972 times.
✓ Branch 2 taken 6233 times.
✓ Branch 3 taken 98258 times.
✓ Branch 4 taken 5289 times.
✓ Branch 5 taken 944 times.
|
12881463 | if (y>=world_h-16 && cur_screen>=0x70 && !(hero_scr->flags2&wfDOWN)) |
| 151 | 944 | return true; | |
| 152 |
3/4✓ Branch 0 taken 105 times.
✓ Branch 1 taken 12880414 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 105 times.
|
12880519 | if (platform_fallthrough() && !ignoreFallthrough) return false; |
| 153 |
3/4✓ Branch 0 taken 878415 times.
✓ Branch 1 taken 12001999 times.
✓ Branch 2 taken 878415 times.
✗ Branch 3 not taken.
|
12880414 | if (slopesmisc != 1 && check_new_slope(rx, ry+0.0001_zf, rw, rh, orx, ory, false, true, obj->slopeid) < 0) |
| 154 | ✗ | return true; | |
| 155 |
6/6✓ Branch 0 taken 9711840 times.
✓ Branch 1 taken 3168574 times.
✓ Branch 2 taken 886 times.
✓ Branch 3 taken 3167688 times.
✓ Branch 4 taken 886 times.
✓ Branch 5 taken 12879528 times.
|
16048988 | if (y.getInt()%16==0 && (checkSVLadderPlatform(x+4,y+16) || checkSVLadderPlatform(x+12,y+16))) |
| 156 | 886 | return true; | |
| 157 | 12879528 | return false; | |
| 158 | 17222430 | } | |
| 159 | |||
| 160 | 349393 | static inline bool no_plat_action() | |
| 161 | { | ||
| 162 |
5/8✓ Branch 0 taken 349393 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 349095 times.
✓ Branch 3 taken 298 times.
✓ Branch 4 taken 349095 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 349095 times.
|
349393 | if(Hero.fallclk || Hero.drownclk || walk_through_walls || Hero.getOnSideviewLadder()) |
| 163 | 298 | return true; | |
| 164 |
2/2✓ Branch 0 taken 441 times.
✓ Branch 1 taken 348654 times.
|
349095 | switch(Hero.action) |
| 165 | { | ||
| 166 | case freeze: case rafting: case inwind: case scrolling: case won: case hopping: | ||
| 167 | case climbcovertop: case climbcoverbottom: case dying: case drowning: | ||
| 168 | case falling: case lavadrowning: case sideswimfreeze: case sidedrowning: | ||
| 169 | 441 | return true; | |
| 170 | } | ||
| 171 | 348654 | return false; | |
| 172 | 349393 | } | |
| 173 | 316516 | bool HeroClass::on_ffc_platform(ffcdata const& ffc, bool old) | |
| 174 | { | ||
| 175 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 316516 times.
|
316516 | if(no_plat_action()) |
| 176 | ✗ | return false; | |
| 177 |
2/2✓ Branch 0 taken 276696 times.
✓ Branch 1 taken 39820 times.
|
316516 | if(!get_qr(qr_MULTI_PLATFORM_FFC)) |
| 178 | { | ||
| 179 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 39820 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
39820 | if(platform_ffc && &ffc != platform_ffc) |
| 180 | ✗ | return false; | |
| 181 | 39820 | platform_ffc = nullptr; | |
| 182 | 39820 | } | |
| 183 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 316516 times.
|
316516 | if(sideview_mode()) |
| 184 | { | ||
| 185 | ✗ | if((ffc.flags & (ffc_solid|ffc_platform|ffc_changer)) != (ffc_solid|ffc_platform)) | |
| 186 | ✗ | return false; | |
| 187 | ✗ | zfix fx = old ? ffc.old_x : ffc.x, fy = old ? ffc.old_y : ffc.y; | |
| 188 | ✗ | static const zfix tol = 0.5_zf; | |
| 189 | ✗ | if((y+16-fy).getAbs() > tol) | |
| 190 | ✗ | return false; | |
| 191 | ✗ | if(fx > x+12) | |
| 192 | ✗ | return false; | |
| 193 | ✗ | if(fx+ffc.hit_width <= x+4) | |
| 194 | ✗ | return false; | |
| 195 | ✗ | } | |
| 196 | else | ||
| 197 | { | ||
| 198 |
2/2✓ Branch 0 taken 316336 times.
✓ Branch 1 taken 180 times.
|
316516 | if((ffc.flags & (ffc_platform|ffc_changer)) != ffc_platform) |
| 199 | 316336 | return false; | |
| 200 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 180 times.
|
180 | if(z) |
| 201 | ✗ | return false; | |
| 202 | static const int tol = 3; | ||
| 203 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 180 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 180 times.
|
180 | if(!(old |
| 204 | 180 | ? ffc.collide_old(x + 8-tol, y + (bigHitbox ? 8 : 12), tol*2, tol*2) | |
| 205 | ✗ | : ffc.collide(x + 8-tol, y + (bigHitbox ? 8 : 12)-tol, tol*2, tol*2))) | |
| 206 | 180 | return false; | |
| 207 | } | ||
| 208 | ✗ | platform_ffc = &ffc; | |
| 209 | ✗ | return true; | |
| 210 | 316516 | } | |
| 211 | 32877 | bool HeroClass::on_ffc_platform() | |
| 212 | { | ||
| 213 |
2/2✓ Branch 0 taken 739 times.
✓ Branch 1 taken 32138 times.
|
32877 | if(no_plat_action()) |
| 214 | 739 | return false; | |
| 215 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 32138 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
32138 | if(platform_ffc && on_ffc_platform(*platform_ffc,false)) |
| 216 | ✗ | return true; | |
| 217 | 380612 | bool any_on_platform = find_ffc([&](const ffc_handle_t& ffc_handle) { | |
| 218 | 316336 | return on_ffc_platform(*ffc_handle.ffc, false); | |
| 219 | 32138 | }).has_value(); | |
| 220 | 32138 | return any_on_platform; | |
| 221 | 32877 | } | |
| 222 | |||
| 223 | 15352172 | void HeroClass::check_platform_ffc() | |
| 224 | { | ||
| 225 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 15352172 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
15352172 | if(platform_ffc && !on_ffc_platform(*platform_ffc,false)) |
| 226 | { | ||
| 227 | ✗ | clear_platform_ffc(); | |
| 228 | ✗ | on_ffc_platform(); | |
| 229 | ✗ | } | |
| 230 | 15352172 | } | |
| 231 | 39127 | void HeroClass::clear_platform_ffc() | |
| 232 | { | ||
| 233 | 39127 | platform_ffc = nullptr; | |
| 234 | 39127 | } | |
| 235 | |||
| 236 | 2302 | void HeroClass::snap_platform() | |
| 237 | { | ||
| 238 |
2/2✓ Branch 0 taken 1010 times.
✓ Branch 1 taken 1292 times.
|
2302 | if(check_new_slope(x, y+1, 16, 16, old_x, old_y, false, true) < 0) |
| 239 | 1010 | return; | |
| 240 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 1292 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1292 | if (y>=world_h-16 && cur_screen>=0x70 && !(hero_scr->flags2&wfDOWN)) |
| 241 | { | ||
| 242 | ✗ | y = world_h-16; | |
| 243 | ✗ | return; | |
| 244 | } | ||
| 245 |
4/4✓ Branch 0 taken 405 times.
✓ Branch 1 taken 887 times.
✓ Branch 2 taken 20 times.
✓ Branch 3 taken 385 times.
|
1292 | if (!(_walkflag(x+4,y+16,1) || _walkflag(x+12,y+16,1))) |
| 246 | 385 | return; | |
| 247 | 907 | movexy(0,1,false,true,false,false); | |
| 248 | 2302 | } | |
| 249 | |||
| 250 | 42715676 | bool usingActiveShield(int32_t itmid) | |
| 251 | { | ||
| 252 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 42715676 times.
|
42715676 | if(Hero.shieldjinxclk) return false; |
| 253 |
2/2✓ Branch 0 taken 36854190 times.
✓ Branch 1 taken 5861486 times.
|
42715676 | switch(Hero.action) //filter allowed actions |
| 254 | { | ||
| 255 | case none: case walking: case rafting: | ||
| 256 | case gothit: case swimhit: | ||
| 257 | 36854190 | break; | |
| 258 | 5861486 | default: return false; | |
| 259 | } | ||
| 260 |
4/4✓ Branch 0 taken 12334 times.
✓ Branch 1 taken 36841856 times.
✓ Branch 2 taken 4320 times.
✓ Branch 3 taken 8014 times.
|
36854190 | if(Hero.lift_wpn && (Hero.liftflags&LIFTFL_DIS_SHIELD)) return false; |
| 261 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 36846176 times.
|
36846176 | if(itmid < 0) |
| 262 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 36846176 times.
|
36846176 | itmid = (Hero.active_shield_id < 0 |
| 263 | 36846176 | ? current_item_id(itype_shield,true,true) : Hero.active_shield_id); | |
| 264 |
2/2✓ Branch 0 taken 32482761 times.
✓ Branch 1 taken 4363415 times.
|
36846176 | if(itmid < 0) return false; |
| 265 |
2/4✓ Branch 0 taken 32482761 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 32482761 times.
✗ Branch 3 not taken.
|
32482761 | if (Hero.active_shield_id != itmid && Hero.on_cooldown(itmid)) return false; |
| 266 | 32482761 | auto const& itm = itemsbuf[itmid]; | |
| 267 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32482761 times.
|
32482761 | if(item_disabled(itmid)) return false; |
| 268 |
1/2✓ Branch 0 taken 32482761 times.
✗ Branch 1 not taken.
|
32482761 | if(!checkitem_jinx(itmid)) return false; |
| 269 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32482761 times.
|
32482761 | if(!(itm.flags & item_flag9)) return false; |
| 270 | ✗ | if(!isItmPressed(itmid)) | |
| 271 | { | ||
| 272 | ✗ | byte intbtn = byte(itm.misc5&0xFF); | |
| 273 | ✗ | if(!itm.misc5 || !getIntBtnInput(intbtn, INPUT_DRUNK | INPUT_PEEK)) | |
| 274 | ✗ | return false; | |
| 275 | ✗ | } | |
| 276 | ✗ | return (checkbunny(itmid) && checkmagiccost(itmid)); | |
| 277 | 42715676 | } | |
| 278 | 4654239 | int32_t getCurrentShield(bool requireActive) | |
| 279 | { | ||
| 280 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4654239 times.
|
4654239 | if(Hero.shieldjinxclk) return -1; |
| 281 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 4654239 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
4654239 | if(Hero.active_shield_id > -1 && usingActiveShield(Hero.active_shield_id)) |
| 282 | ✗ | return Hero.active_shield_id; | |
| 283 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4654239 times.
|
4654239 | if(!requireActive) return current_item_id(itype_shield,false,true); |
| 284 | ✗ | return -1; | |
| 285 | 4654239 | } | |
| 286 | 964186 | int32_t getCurrentActiveShield() | |
| 287 | { | ||
| 288 | 964186 | int32_t id = Hero.active_shield_id; | |
| 289 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 964186 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
964186 | if(id > -1 && usingActiveShield(id)) |
| 290 | ✗ | return id; | |
| 291 | 964186 | return -1; | |
| 292 | 964186 | } | |
| 293 | 14835456 | int32_t refreshActiveShield() | |
| 294 | { | ||
| 295 | 14835456 | int32_t id = -1; | |
| 296 |
2/2✓ Branch 0 taken 14531818 times.
✓ Branch 1 taken 303638 times.
|
14835456 | if (getInput(btnB, INPUT_DRUNK | INPUT_HERO_ACTION)) |
| 297 | { | ||
| 298 |
2/2✓ Branch 0 taken 301728 times.
✓ Branch 1 taken 1910 times.
|
303638 | itemdata const& dat = itemsbuf[NEG_OR_MASK(Bwpn, 0xFFF)]; |
| 299 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 303638 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
303638 | if (dat.type == itype_shield && (dat.flags & item_flag9)) |
| 300 | { | ||
| 301 | ✗ | id = NEG_OR_MASK(Bwpn, 0xFFF); | |
| 302 | ✗ | } | |
| 303 | 303638 | } | |
| 304 |
3/4✓ Branch 0 taken 14835456 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 13545873 times.
✓ Branch 3 taken 1289583 times.
|
14835456 | if (id < 0 && getInput(btnA, INPUT_DRUNK | INPUT_HERO_ACTION)) |
| 305 | { | ||
| 306 |
2/2✓ Branch 0 taken 1147972 times.
✓ Branch 1 taken 141611 times.
|
1289583 | itemdata const& dat = itemsbuf[NEG_OR_MASK(Awpn, 0xFFF)]; |
| 307 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1289583 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1289583 | if (dat.type == itype_shield && (dat.flags & item_flag9)) |
| 308 | { | ||
| 309 | ✗ | id = NEG_OR_MASK(Awpn, 0xFFF); | |
| 310 | ✗ | } | |
| 311 | 1289583 | } | |
| 312 |
3/4✓ Branch 0 taken 14835456 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 14822849 times.
✓ Branch 3 taken 12607 times.
|
14835456 | if (id < 0 && getInput(btnEx1, INPUT_DRUNK | INPUT_HERO_ACTION)) |
| 313 | { | ||
| 314 |
2/2✓ Branch 0 taken 2047 times.
✓ Branch 1 taken 10560 times.
|
12607 | itemdata const& dat = itemsbuf[NEG_OR_MASK(Xwpn, 0xFFF)]; |
| 315 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 12607 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
12607 | if (dat.type == itype_shield && (dat.flags & item_flag9)) |
| 316 | { | ||
| 317 | ✗ | id = NEG_OR_MASK(Xwpn, 0xFFF); | |
| 318 | ✗ | } | |
| 319 | 12607 | } | |
| 320 |
3/4✓ Branch 0 taken 14835456 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 14832737 times.
✓ Branch 3 taken 2719 times.
|
14835456 | if (id < 0 && getInput(btnEx2, INPUT_DRUNK | INPUT_HERO_ACTION)) |
| 321 | { | ||
| 322 |
2/2✓ Branch 0 taken 2483 times.
✓ Branch 1 taken 236 times.
|
2719 | itemdata const& dat = itemsbuf[NEG_OR_MASK(Ywpn, 0xFFF)]; |
| 323 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 2719 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
2719 | if (dat.type == itype_shield && (dat.flags & item_flag9)) |
| 324 | { | ||
| 325 | ✗ | id = NEG_OR_MASK(Ywpn, 0xFFF); | |
| 326 | ✗ | } | |
| 327 | 2719 | } | |
| 328 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14835456 times.
|
14835456 | if (id < 0) |
| 329 | { | ||
| 330 | 14835456 | auto shield_id = current_item_id(itype_shield, false, true); | |
| 331 | 14835456 | itemdata const& dat = itemsbuf[shield_id]; | |
| 332 |
3/4✓ Branch 0 taken 13170856 times.
✓ Branch 1 taken 1664600 times.
✓ Branch 2 taken 13170856 times.
✗ Branch 3 not taken.
|
14835456 | if (dat.type == itype_shield && (dat.flags & item_flag9)) |
| 333 | { | ||
| 334 | ✗ | byte intbtn = byte(dat.misc5 & 0xFF); | |
| 335 | ✗ | if (getIntBtnInput(intbtn, INPUT_DRUNK | INPUT_PEEK)) | |
| 336 | ✗ | id = shield_id; | |
| 337 | ✗ | } | |
| 338 | 14835456 | } | |
| 339 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14835456 times.
|
14835456 | if(!usingActiveShield(id)) |
| 340 | 14835456 | return -1; | |
| 341 | ✗ | return id; | |
| 342 | 14835456 | } | |
| 343 | static bool is_immobile() | ||
| 344 | { | ||
| 345 | if(!get_qr(qr_NEW_HERO_MOVEMENT)) | ||
| 346 | return false; | ||
| 347 | zfix rate(Hero.steprate); | ||
| 348 | int32_t shieldid = getCurrentActiveShield(); | ||
| 349 | if(shieldid > -1) | ||
| 350 | { | ||
| 351 | itemdata const& shield = itemsbuf[shieldid]; | ||
| 352 | if(shield.flags & item_flag10) //Change Speed flag | ||
| 353 | { | ||
| 354 | zfix perc = shield.misc7; | ||
| 355 | perc /= 100; | ||
| 356 | if(perc < 0) | ||
| 357 | perc = (perc*-1)+1; | ||
| 358 | rate = (rate * perc) + shield.misc8; | ||
| 359 | } | ||
| 360 | } | ||
| 361 | return rate != 0; | ||
| 362 | } | ||
| 363 | |||
| 364 | 29873956 | bool nomove_action(int action) | |
| 365 | { | ||
| 366 |
2/2✓ Branch 0 taken 28620088 times.
✓ Branch 1 taken 1253868 times.
|
29873956 | switch(action) |
| 367 | { | ||
| 368 | case gothit: | ||
| 369 | case drowning: | ||
| 370 | case lavadrowning: | ||
| 371 | case sidedrowning: | ||
| 372 | case falling: | ||
| 373 | case freeze: | ||
| 374 | case sideswimfreeze: | ||
| 375 | case scrolling: | ||
| 376 | case casting: | ||
| 377 | case sideswimcasting: | ||
| 378 | case landhold1: | ||
| 379 | case landhold2: | ||
| 380 | case waterhold1: | ||
| 381 | case waterhold2: | ||
| 382 | case sidewaterhold1: | ||
| 383 | case sidewaterhold2: | ||
| 384 | case hopping: | ||
| 385 | case inwind: | ||
| 386 | 1253868 | return true; | |
| 387 | } | ||
| 388 | 28620088 | return false; | |
| 389 | 29873956 | } | |
| 390 | |||
| 391 | 15232373 | bool HeroClass::isStanding(bool forJump) | |
| 392 | { | ||
| 393 |
3/4✓ Branch 0 taken 15199173 times.
✓ Branch 1 taken 33200 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 15199173 times.
|
15232373 | if(z || fakez) return false; |
| 394 |
4/4✓ Branch 0 taken 332206 times.
✓ Branch 1 taken 14866967 times.
✓ Branch 2 taken 4782 times.
✓ Branch 3 taken 161022 times.
|
15364977 | if(isSideViewHero() && !on_sideview_solid_oldpos(this) |
| 395 |
4/6✓ Branch 0 taken 165804 times.
✓ Branch 1 taken 166402 times.
✓ Branch 2 taken 165804 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 165804 times.
✗ Branch 5 not taken.
|
332206 | && !ladderx && !laddery && !getOnSideviewLadder()) |
| 396 | 161022 | return false; | |
| 397 |
2/2✓ Branch 0 taken 36 times.
✓ Branch 1 taken 15038115 times.
|
15038151 | if(hoverclk) return false; |
| 398 |
2/2✓ Branch 0 taken 624339 times.
✓ Branch 1 taken 14413776 times.
|
15038115 | if(nomove_action(action)) return false; |
| 399 | 14413776 | int32_t val = check_pitslide(); | |
| 400 |
2/2✓ Branch 0 taken 51 times.
✓ Branch 1 taken 14413725 times.
|
14413776 | if(val == -2) return false; |
| 401 |
2/2✓ Branch 0 taken 347 times.
✓ Branch 1 taken 14413378 times.
|
14413725 | if(val == -1) return true; |
| 402 | 347 | return forJump; | |
| 403 | 15232373 | } | |
| 404 | 1410136 | bool HeroClass::isLifting() | |
| 405 | { | ||
| 406 |
2/2✓ Branch 0 taken 11209 times.
✓ Branch 1 taken 1398927 times.
|
1410136 | if(lift_wpn) return true; |
| 407 | 1398927 | return false; | |
| 408 | 1410136 | } | |
| 409 | 62 | void HeroClass::set_liftflags(int liftid) | |
| 410 | { | ||
| 411 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 62 times.
|
62 | if(unsigned(liftid) >= MAXITEMS) |
| 412 | ✗ | return; | |
| 413 | 62 | itemdata const& itm = itemsbuf[liftid]; | |
| 414 |
1/2✓ Branch 0 taken 62 times.
✗ Branch 1 not taken.
|
62 | SETFLAG(liftflags, LIFTFL_DIS_SWIMMING, !(itm.flags & item_flag2)); |
| 415 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 39 times.
|
62 | SETFLAG(liftflags, LIFTFL_DIS_SHIELD, itm.flags & item_flag3); |
| 416 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 39 times.
|
62 | SETFLAG(liftflags, LIFTFL_DIS_ITEMS, itm.flags & item_flag4); |
| 417 |
1/2✓ Branch 0 taken 62 times.
✗ Branch 1 not taken.
|
62 | SETFLAG(liftflags, LIFTFL_DROP_ON_HIT, itm.flags & item_flag5); |
| 418 | 62 | } | |
| 419 | |||
| 420 | 45374754 | int32_t get_grav_boots_id() | |
| 421 | { | ||
| 422 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 45374754 times.
|
45374754 | if (Hero.last_grav_boots_id > -1) |
| 423 | ✗ | return Hero.last_grav_boots_id;; | |
| 424 | int32_t grav_id; | ||
| 425 |
2/2✓ Branch 0 taken 44363070 times.
✓ Branch 1 taken 1011684 times.
|
45374754 | if (Hero.sideview_mode()) |
| 426 | { | ||
| 427 |
2/2✓ Branch 0 taken 965736 times.
✓ Branch 1 taken 45948 times.
|
1011684 | if (getInput(btnDown, INPUT_DRUNK | INPUT_HERO_ACTION)) |
| 428 | { | ||
| 429 |
1/2✓ Branch 0 taken 45948 times.
✗ Branch 1 not taken.
|
45948 | if ((grav_id = current_item_id(itype_gravity_down_boots, true)) >= 0) |
| 430 | ✗ | if (checkmagiccost(grav_id) && checkbunny(grav_id)) | |
| 431 | ✗ | return (Hero.last_grav_boots_id = grav_id); | |
| 432 | 45948 | } | |
| 433 |
2/2✓ Branch 0 taken 925064 times.
✓ Branch 1 taken 86620 times.
|
1011684 | if (getInput(btnUp, INPUT_DRUNK | INPUT_HERO_ACTION)) |
| 434 | { | ||
| 435 |
1/2✓ Branch 0 taken 86620 times.
✗ Branch 1 not taken.
|
86620 | if ((grav_id = current_item_id(itype_gravity_up_boots, true)) >= 0) |
| 436 | ✗ | if (checkmagiccost(grav_id) && checkbunny(grav_id)) | |
| 437 | ✗ | return (Hero.last_grav_boots_id = grav_id); | |
| 438 | 86620 | } | |
| 439 | 1011684 | } | |
| 440 |
1/2✓ Branch 0 taken 45374754 times.
✗ Branch 1 not taken.
|
45374754 | if ((grav_id = current_item_id(itype_gravity_boots, true)) >= 0) |
| 441 | ✗ | if (checkmagiccost(grav_id) && checkbunny(grav_id)) | |
| 442 | ✗ | if (!(itemsbuf[grav_id].flags & item_flag1) || Hero.sideview_mode()) // sideview-only boots only work in sideview | |
| 443 | ✗ | return (Hero.last_grav_boots_id = grav_id); | |
| 444 | 45374754 | return -1; | |
| 445 | 45374754 | } | |
| 446 | 30531932 | zfix HeroClass::get_gravity(bool skip_custom) const | |
| 447 | { | ||
| 448 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 30531932 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
30531932 | if (custom_gravity && !skip_custom) |
| 449 | ✗ | return custom_gravity; | |
| 450 |
2/2✓ Branch 0 taken 30519580 times.
✓ Branch 1 taken 12352 times.
|
30531932 | if (last_rocs_id != -1) |
| 451 | { | ||
| 452 | 12352 | itemdata const& itm = itemsbuf[last_rocs_id]; | |
| 453 |
1/2✓ Branch 0 taken 12352 times.
✗ Branch 1 not taken.
|
12352 | if (itm.flags & item_flag2) |
| 454 | { | ||
| 455 | ✗ | if ((!(itm.flags & item_flag3) || fall < 0) && | |
| 456 | ✗ | (!(itm.flags & item_flag4) || fall > 0)) | |
| 457 | ✗ | return zslongToFix(itm.misc3 * 100); | |
| 458 | ✗ | } | |
| 459 | 12352 | } | |
| 460 | 30531932 | int32_t grav_id = get_grav_boots_id(); | |
| 461 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 30531932 times.
|
30531932 | if (grav_id > -1) |
| 462 | ✗ | return zslongToFix(itemsbuf[grav_id].misc1); | |
| 463 | 30531932 | return sprite::get_gravity(skip_custom); | |
| 464 | 30531932 | } | |
| 465 | 14842822 | zfix HeroClass::get_terminalv(bool skip_custom) const | |
| 466 | { | ||
| 467 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 14842822 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
14842822 | if (custom_terminal_v && !skip_custom) |
| 468 | ✗ | return custom_terminal_v; | |
| 469 |
2/2✓ Branch 0 taken 14835715 times.
✓ Branch 1 taken 7107 times.
|
14842822 | if (last_rocs_id != -1) |
| 470 | { | ||
| 471 | 7107 | itemdata const& itm = itemsbuf[last_rocs_id]; | |
| 472 |
1/2✓ Branch 0 taken 7107 times.
✗ Branch 1 not taken.
|
7107 | if (itm.flags & item_flag5) |
| 473 | ✗ | return zslongToFix(itm.misc4 * 100); | |
| 474 | 7107 | } | |
| 475 | 14842822 | int32_t grav_id = get_grav_boots_id(); | |
| 476 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14842822 times.
|
14842822 | if (grav_id >= 0) |
| 477 | ✗ | return zslongToFix(itemsbuf[grav_id].misc2); | |
| 478 | 14842822 | return sprite::get_terminalv(skip_custom); | |
| 479 | 14842822 | } | |
| 480 | |||
| 481 | 14837102 | void HeroClass::update_current_screen() | |
| 482 | { | ||
| 483 | 14837102 | int cx = x + 8, cy = y + 8; | |
| 484 |
2/2✓ Branch 0 taken 46999 times.
✓ Branch 1 taken 14790103 times.
|
14837102 | if (replay_version_check(0, 43)) // hero_screen previously used top-left, not center |
| 485 | { | ||
| 486 | 14790103 | cx = x; | |
| 487 | 14790103 | cy = y; | |
| 488 | 14790103 | } | |
| 489 | |||
| 490 | 14837102 | int scr_x = vbound(cx, 0, world_w - 1) / 256; | |
| 491 | 14837102 | int scr_y = vbound(cy, 0, world_h - 1) / 176; | |
| 492 | 14837102 | int new_screen = cur_screen + scr_x + scr_y * 16; | |
| 493 |
2/2✓ Branch 0 taken 14829340 times.
✓ Branch 1 taken 7762 times.
|
14837102 | if (maze_state.active == 1) |
| 494 | 7762 | new_screen = maze_state.scr->screen; | |
| 495 |
7/12✓ Branch 0 taken 216 times.
✓ Branch 1 taken 14836886 times.
✓ Branch 2 taken 216 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 216 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 216 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 216 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 216 times.
|
14837102 | if (current_screen != new_screen && scr_x >= 0 && scr_y >= 0 && scr_x < 16 && scr_y < 8 && is_in_current_region(new_screen)) |
| 496 | { | ||
| 497 | 216 | region_scr_dx = scr_x; | |
| 498 | 216 | region_scr_dy = scr_y; | |
| 499 | 216 | current_screen = new_screen; | |
| 500 | 216 | prev_hero_scr = hero_scr; | |
| 501 | 216 | hero_scr = get_scr(current_screen); | |
| 502 | 216 | screen_spawned = current_screen; | |
| 503 | 216 | playLevelMusic(); | |
| 504 | 216 | } | |
| 505 |
2/2✓ Branch 0 taken 14316971 times.
✓ Branch 1 taken 520131 times.
|
14837102 | if (game->get_regionmapping() == REGION_MAPPING_PHYSICAL) |
| 506 | 520131 | mark_visited(new_screen); // Mark each screen the hero steps foot in as visited | |
| 507 | 14837102 | } | |
| 508 | |||
| 509 | 581839 | void HeroClass::set_respawn_point(bool setwarp) | |
| 510 | { | ||
| 511 | 581839 | zfix oldx = x, oldy = y; | |
| 512 |
2/2✓ Branch 0 taken 44950 times.
✓ Branch 1 taken 536889 times.
|
581839 | if (replay_version_check(17)) |
| 513 | { | ||
| 514 | 536889 | x = vbound(x,0,world_w-16); | |
| 515 | 536889 | y = vbound(y,0,world_h-16); | |
| 516 | 536889 | } | |
| 517 | |||
| 518 |
2/2✓ Branch 0 taken 563474 times.
✓ Branch 1 taken 18365 times.
|
581839 | if(setwarp) |
| 519 | { | ||
| 520 | 18365 | warpx = x; | |
| 521 | 18365 | warpy = y; | |
| 522 | 18365 | raftwarpx = x; | |
| 523 | 18365 | raftwarpy = y; | |
| 524 | 18365 | } | |
| 525 | 581839 | do | |
| 526 | { | ||
| 527 |
2/2✓ Branch 0 taken 46126 times.
✓ Branch 1 taken 535713 times.
|
581839 | if(!get_qr(qr_OLD_RESPAWN_POINTS)) |
| 528 | { | ||
| 529 |
2/2✓ Branch 0 taken 119 times.
✓ Branch 1 taken 535594 times.
|
535713 | if(cur_screen >= 0x80) break; |
| 530 | 535594 | bool is_safe = true; | |
| 531 |
2/2✓ Branch 0 taken 465232 times.
✓ Branch 1 taken 70362 times.
|
535594 | switch(action) |
| 532 | { | ||
| 533 | case none: case walking: | ||
| 534 | 465232 | break; | |
| 535 | default: | ||
| 536 | 70362 | is_safe = false; | |
| 537 | 70362 | } | |
| 538 |
2/2✓ Branch 0 taken 465232 times.
✓ Branch 1 taken 70362 times.
|
535594 | if(!is_safe) break; //unsafe action |
| 539 |
5/6✓ Branch 0 taken 461243 times.
✓ Branch 1 taken 3989 times.
✓ Branch 2 taken 461243 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 19 times.
✓ Branch 5 taken 461224 times.
|
465232 | if(z > 0 || fakez > 0 || hoverclk) break; //in air |
| 540 |
4/4✓ Branch 0 taken 5497 times.
✓ Branch 1 taken 455727 times.
✓ Branch 2 taken 1989 times.
✓ Branch 3 taken 3508 times.
|
461224 | if(sideview_mode() && !on_sideview_solid(x,y,true)) break; //in air sideview |
| 541 |
2/2✓ Branch 0 taken 140 times.
✓ Branch 1 taken 457576 times.
|
457716 | if(check_pitslide(true) != -1) break; //On a pit |
| 542 |
2/2✓ Branch 0 taken 11 times.
✓ Branch 1 taken 457565 times.
|
457576 | if (ladderx+laddery) break; //on the ladder |
| 543 |
2/2✓ Branch 0 taken 249 times.
✓ Branch 1 taken 457316 times.
|
457565 | if (onWater(false)) break; |
| 544 | |||
| 545 | 2286580 | rpos_t rposes[] = { | |
| 546 | 457316 | COMBOPOS_REGION_B(x,y+(bigHitbox?0:8)), | |
| 547 | 457316 | COMBOPOS_REGION_B(x,y+15), | |
| 548 | 457316 | COMBOPOS_REGION_B(x+15,y+(bigHitbox?0:8)), | |
| 549 | 457316 | COMBOPOS_REGION_B(x+15,y+15) | |
| 550 | }; | ||
| 551 |
2/2✓ Branch 0 taken 415046 times.
✓ Branch 1 taken 1711329 times.
|
2126375 | for(auto rpos : rposes) |
| 552 | { | ||
| 553 |
2/2✓ Branch 0 taken 1711265 times.
✓ Branch 1 taken 64 times.
|
1711329 | if (rpos == rpos_t::None) |
| 554 | 64 | continue; | |
| 555 | |||
| 556 |
2/2✓ Branch 0 taken 1668995 times.
✓ Branch 1 taken 42270 times.
|
1711265 | if(HASFLAG_ANY(mfUNSAFEGROUND, rpos)) //"Unsafe Ground" flag touching the player |
| 557 | { | ||
| 558 | 42270 | is_safe = false; | |
| 559 | 42270 | break; | |
| 560 | } | ||
| 561 | } | ||
| 562 |
2/2✓ Branch 0 taken 415046 times.
✓ Branch 1 taken 42270 times.
|
457316 | if(!is_safe) break; |
| 563 | 415046 | } | |
| 564 | 461172 | respawn_x = x; | |
| 565 | 461172 | respawn_y = y; | |
| 566 | 461172 | respawn_scr = cur_screen; | |
| 567 | 461172 | respawn_dmap = cur_dmap; | |
| 568 | 461172 | } | |
| 569 | while(false); //run once, but 'break' works | ||
| 570 | |||
| 571 | 581839 | x = oldx; | |
| 572 | 581839 | y = oldy; | |
| 573 | 581839 | } | |
| 574 | |||
| 575 | 800142 | void HeroClass::clear_ice() | |
| 576 | { | ||
| 577 | 800142 | ice_vx = ice_vy = 0; | |
| 578 | 800142 | ice_entry_count = ice_entry_mcount = 0; | |
| 579 | 800142 | ice_combo = 0; | |
| 580 | 800142 | sliding = 0; | |
| 581 | 800142 | } | |
| 582 | 5 | void HeroClass::force_ice_velocity(optional<zfix> vx, optional<zfix> vy) | |
| 583 | { | ||
| 584 | 5 | auto ic = ice_combo; | |
| 585 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
|
5 | if(script_ice_combo) |
| 586 | { | ||
| 587 |
2/4✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5 times.
|
5 | if((unsigned(script_ice_combo) < MAXCOMBOS) && check_icy(combobuf[script_ice_combo], ICY_PLAYER)) |
| 588 | 5 | ic = script_ice_combo; | |
| 589 | ✗ | else ic = 0; | |
| 590 | 5 | } | |
| 591 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if(!ic) return; |
| 592 | |||
| 593 | 5 | auto const& icecmb = combobuf[ic]; | |
| 594 |
3/6✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5 times.
✗ Branch 5 not taken.
|
5 | if(script_ice_combo && ic && !sliding) |
| 595 | { | ||
| 596 | //Special case to prevent the forced vx/vy from being overwritten | ||
| 597 | 5 | sliding = 1; | |
| 598 | 5 | ice_vx = ice_vy = 0; | |
| 599 | 5 | ice_entry_count = ice_entry_mcount = icecmb.attribytes[1]; | |
| 600 | 5 | } | |
| 601 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | zfix cap = zslongToFix(zc_max(1,abs(icecmb.attributes[2]))); |
| 602 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
|
5 | if(vx) ice_vx = vbound(*vx, -cap, cap); |
| 603 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
|
5 | if(vy) ice_vy = vbound(*vy, -cap, cap); |
| 604 | 5 | } | |
| 605 | 181 | void HeroClass::go_respawn_point() | |
| 606 | { | ||
| 607 | 181 | x = respawn_x; | |
| 608 | 181 | y = respawn_y; | |
| 609 | 181 | clear_ice(); | |
| 610 | 181 | handle_portal_prox(&mirror_portal); | |
| 611 |
1/2✓ Branch 0 taken 181 times.
✗ Branch 1 not taken.
|
181 | portals.forEach([&](sprite& p) |
| 612 | { | ||
| 613 | ✗ | handle_portal_prox((portal*)&p); | |
| 614 | ✗ | return false; | |
| 615 | }); | ||
| 616 | 181 | warpx=x; | |
| 617 | 181 | warpy=y; | |
| 618 | 181 | raftwarpx = x; | |
| 619 | 181 | raftwarpy = y; | |
| 620 | 181 | trySideviewLadder(); //Cling to ladder automatically | |
| 621 | |||
| 622 |
2/2✓ Branch 0 taken 75 times.
✓ Branch 1 taken 106 times.
|
181 | if(get_qr(qr_OLD_RESPAWN_POINTS)) |
| 623 | 106 | return; //No cross-screen return | |
| 624 | |||
| 625 |
2/4✓ Branch 0 taken 75 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 75 times.
|
75 | if(cur_dmap != respawn_dmap || cur_screen != respawn_scr) |
| 626 | { | ||
| 627 | ✗ | FFCore.warp_player(wtIWARP, respawn_dmap, respawn_scr-DMaps[cur_dmap].xoff, | |
| 628 | -1, -1, 0, 0, warpFlagNOSTEPFORWARD, -1); | ||
| 629 | ✗ | } | |
| 630 | 181 | } | |
| 631 | |||
| 632 | 35447 | void HeroClass::trySideviewLadder() | |
| 633 | { | ||
| 634 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 35447 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
35447 | if(canSideviewLadder() && !on_sideview_solid_oldpos(this)) |
| 635 | ✗ | setOnSideviewLadder(true); | |
| 636 | 35447 | } | |
| 637 | |||
| 638 | 54289002 | bool HeroClass::can_pitfall(bool ignore_hover) | |
| 639 | { | ||
| 640 | 54289002 | return !( | |
| 641 | 54289002 | isSideViewGravity() | |
| 642 |
2/2✓ Branch 0 taken 53533639 times.
✓ Branch 1 taken 755363 times.
|
54289002 | || action==rafting |
| 643 |
7/8✓ Branch 0 taken 53305864 times.
✓ Branch 1 taken 227775 times.
✓ Branch 2 taken 53266933 times.
✓ Branch 3 taken 38931 times.
✓ Branch 4 taken 53266933 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 53265771 times.
✓ Branch 7 taken 1162 times.
|
53533639 | || z>0 || fakez>0 || fall<0 || fakefall<0 |
| 644 |
3/4✓ Branch 0 taken 53265771 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 53 times.
✓ Branch 3 taken 53265718 times.
|
53265771 | || (hoverclk && !ignore_hover) |
| 645 |
6/6✓ Branch 0 taken 53240455 times.
✓ Branch 1 taken 25316 times.
✓ Branch 2 taken 53237797 times.
✓ Branch 3 taken 2658 times.
✓ Branch 4 taken 53220196 times.
✓ Branch 5 taken 17601 times.
|
53265771 | || inlikelike || inwallm || pull_hero || walk_through_walls |
| 646 |
6/6✓ Branch 0 taken 53147208 times.
✓ Branch 1 taken 72988 times.
✓ Branch 2 taken 52611776 times.
✓ Branch 3 taken 535432 times.
✓ Branch 4 taken 52611552 times.
✓ Branch 5 taken 224 times.
|
53220196 | || (ladderx||laddery) || getOnSideviewLadder() |
| 647 |
3/4✓ Branch 0 taken 52611552 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 52603606 times.
✓ Branch 3 taken 7946 times.
|
52611552 | || drownclk || !(moveflags & move_can_pitfall) |
| 648 |
2/2✓ Branch 0 taken 52603043 times.
✓ Branch 1 taken 563 times.
|
52603606 | || platform_ffc); |
| 649 | } | ||
| 650 | |||
| 651 | 8760371 | int32_t HeroClass::DrunkClock() | |
| 652 | { | ||
| 653 | 8760371 | return drunkclk; | |
| 654 | } | ||
| 655 | 1 | void HeroClass::setDrunkClock(int32_t newdrunkclk) | |
| 656 | { | ||
| 657 | 1 | drunkclk=newdrunkclk; | |
| 658 | 1 | } | |
| 659 | |||
| 660 | 440896 | int32_t HeroClass::StunClock() | |
| 661 | { | ||
| 662 | 440896 | return lstunclock; | |
| 663 | } | ||
| 664 | 563 | void HeroClass::setStunClock(int32_t v) | |
| 665 | { | ||
| 666 | 563 | lstunclock=v; | |
| 667 | 563 | } | |
| 668 | |||
| 669 | 3357552440 | int32_t HeroClass::BunnyClock() | |
| 670 | { | ||
| 671 | 3357552440 | return lbunnyclock; | |
| 672 | } | ||
| 673 | ✗ | void HeroClass::setBunnyClock(int32_t v) | |
| 674 | { | ||
| 675 | ✗ | lbunnyclock=v; | |
| 676 | ✗ | } | |
| 677 | |||
| 678 |
15/30✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 427 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 427 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 427 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 427 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 427 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 427 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 427 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 427 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 427 times.
✗ Branch 19 not taken.
✓ Branch 20 taken 427 times.
✗ Branch 21 not taken.
✓ Branch 22 taken 427 times.
✗ Branch 23 not taken.
✓ Branch 24 taken 427 times.
✗ Branch 25 not taken.
✓ Branch 26 taken 427 times.
✗ Branch 27 not taken.
✓ Branch 28 taken 427 times.
✗ Branch 29 not taken.
|
854 | HeroClass::HeroClass() : sprite() |
| 679 | 427 | { | |
| 680 | 427 | lift_wpn = nullptr; | |
| 681 | 427 | uid = 1; // hardcoded hero uid | |
| 682 |
1/2✓ Branch 0 taken 427 times.
✗ Branch 1 not taken.
|
427 | init(); |
| 683 | ✗ | } | |
| 684 | |||
| 685 | //2.6 | ||
| 686 | |||
| 687 | //Stop the subscreen from falling. -Z | ||
| 688 | |||
| 689 | 1438 | bool HeroClass::stopSubscreenFalling(){ | |
| 690 | 1438 | return preventsubscreenfalling; | |
| 691 | } | ||
| 692 | |||
| 693 | ✗ | void HeroClass::stopSubscreenFalling(bool v){ | |
| 694 | ✗ | preventsubscreenfalling = v; | |
| 695 | ✗ | } | |
| 696 | |||
| 697 | 14837094 | void HeroClass::ClearhitHeroUIDs() | |
| 698 | { //Why the flidd doesn't this work?! Clearing this to 0 in a way that doesn't demolish script access is impossible. -Z | ||
| 699 | //All I want, is to clear it at the end of a frame, or at the start of a frame, so that if it changes to non-0 | ||
| 700 | //that a script can read it before Waitdraw(). --I want it to go stale at the end of a frame. | ||
| 701 | //I suppose I will need to do this inside the script engine, and not the game_loop() ? -Z | ||
| 702 | //THis started out as a simple clear to 0 of lastHitBy[n], but that did not work: | ||
| 703 | //I added the second element to this, so that I could store the frame on which the hit is recorded, and | ||
| 704 | //clear it on the next frame, but that had the SAME outcome. | ||
| 705 | //Where and how can I clear a value at the end of every frame, so that: | ||
| 706 | // 1. If set by internal mecanics, it has its value that you can read by script, before waitdraw--this part works at present. | ||
| 707 | // 2. FFCs can read it before Waitframe. --same. | ||
| 708 | // 3. After Waitframe(), it is wiped by the ZC Engine to 0. --I cannot get this to happen without breaking 1 and 2. | ||
| 709 |
2/2✓ Branch 0 taken 252230598 times.
✓ Branch 1 taken 14837094 times.
|
267067692 | for ( int32_t q = 0; q < NUM_HIT_TYPES_USED; q++ ) |
| 710 | { | ||
| 711 | /* | ||
| 712 | if ( lastHitBy[q][1] == (frame-1) ) //Verify if this is needed at all now. | ||
| 713 | { | ||
| 714 | //Z_scripterrlog("frame is: %d\n", frame); | ||
| 715 | //Z_scripterrlog("Player->HitBy frame is: %d\n", lastHitBy[q][1]); | ||
| 716 | lastHitBy[q][0] = 0; | ||
| 717 | } | ||
| 718 | */ | ||
| 719 | 252230598 | lastHitBy[q][0] = 0; | |
| 720 | 252230598 | } | |
| 721 | 14837094 | } | |
| 722 | |||
| 723 | 79996 | void HeroClass::sethitHeroUID(int32_t type, int32_t screen) | |
| 724 | { | ||
| 725 | 79996 | lastHitBy[type][0] = screen; | |
| 726 | 79996 | } | |
| 727 | |||
| 728 | 4463 | int32_t HeroClass::gethitHeroUID(int32_t type) | |
| 729 | { | ||
| 730 | 4463 | return lastHitBy[type][0]; | |
| 731 | } | ||
| 732 | |||
| 733 | ✗ | void HeroClass::set_defence(int32_t type, int32_t v) | |
| 734 | { | ||
| 735 | ✗ | defence[type] = v; | |
| 736 | ✗ | } | |
| 737 | |||
| 738 | ✗ | int32_t HeroClass::get_defence(int32_t type) | |
| 739 | { | ||
| 740 | ✗ | return defence[type]; | |
| 741 | } | ||
| 742 | |||
| 743 | |||
| 744 | //Set Hero;s hurt sfx | ||
| 745 | 878585 | void HeroClass::setHurtSFX(int32_t sfx) | |
| 746 | { | ||
| 747 | 878585 | QMisc.miscsfx[sfxHURTPLAYER] = sfx; | |
| 748 | 878585 | } | |
| 749 | 16104 | int32_t HeroClass::getHurtSFX() | |
| 750 | { | ||
| 751 | 16104 | return QMisc.miscsfx[sfxHURTPLAYER]; | |
| 752 | } | ||
| 753 | |||
| 754 | ✗ | bool HeroClass::getDiagMove() | |
| 755 | { | ||
| 756 | ✗ | return diagonalMovement; | |
| 757 | } | ||
| 758 | 1149 | void HeroClass::setDiagMove(bool newdiag) | |
| 759 | { | ||
| 760 | 1149 | diagonalMovement=newdiag; | |
| 761 | 1149 | } | |
| 762 | 271788 | bool HeroClass::getBigHitbox() | |
| 763 | { | ||
| 764 | 271788 | return bigHitbox; | |
| 765 | } | ||
| 766 | 2746 | void HeroClass::setBigHitbox(bool newbigHitbox) | |
| 767 | { | ||
| 768 | 2746 | bigHitbox=newbigHitbox; | |
| 769 | 2746 | syofs = bigHitbox?0:8; | |
| 770 | 2746 | sysz_ofs = bigHitbox?0:-8; | |
| 771 | 2746 | } | |
| 772 | 13100 | int32_t HeroClass::getStepRate() | |
| 773 | { | ||
| 774 | 13100 | return steprate; | |
| 775 | } | ||
| 776 | 952 | void HeroClass::setStepRate(int32_t newrate) | |
| 777 | { | ||
| 778 | 952 | steprate = newrate; | |
| 779 | 952 | } | |
| 780 | ✗ | int32_t HeroClass::getSwimUpRate() | |
| 781 | { | ||
| 782 | ✗ | return game->get_sideswim_up(); | |
| 783 | } | ||
| 784 | ✗ | void HeroClass::setSwimUpRate(int32_t newrate) | |
| 785 | { | ||
| 786 | ✗ | game->set_sideswim_up(newrate); | |
| 787 | ✗ | } | |
| 788 | ✗ | int32_t HeroClass::getSwimSideRate() | |
| 789 | { | ||
| 790 | ✗ | return game->get_sideswim_side(); | |
| 791 | } | ||
| 792 | ✗ | void HeroClass::setSwimSideRate(int32_t newrate) | |
| 793 | { | ||
| 794 | ✗ | game->set_sideswim_side(newrate); | |
| 795 | ✗ | } | |
| 796 | ✗ | int32_t HeroClass::getSwimDownRate() | |
| 797 | { | ||
| 798 | ✗ | return game->get_sideswim_down(); | |
| 799 | } | ||
| 800 | ✗ | void HeroClass::setSwimDownRate(int32_t newrate) | |
| 801 | { | ||
| 802 | ✗ | game->set_sideswim_down(newrate); | |
| 803 | ✗ | } | |
| 804 | |||
| 805 | |||
| 806 | 10946815 | void HeroClass::herostep() | |
| 807 | { | ||
| 808 |
2/2✓ Branch 0 taken 10276394 times.
✓ Branch 1 taken 670421 times.
|
10946815 | lstep = lstep<((zinit.heroAnimationStyle==las_bszelda)?27:11) ? lstep+1 : 0; |
| 809 | //need to run all global/hero/dmap scripts here? | ||
| 810 | 10946815 | } | |
| 811 | |||
| 812 | 142451 | bool is_moving() | |
| 813 | { | ||
| 814 |
6/6✓ Branch 0 taken 110147 times.
✓ Branch 1 taken 32304 times.
✓ Branch 2 taken 82023 times.
✓ Branch 3 taken 28124 times.
✓ Branch 4 taken 32573 times.
✓ Branch 5 taken 49450 times.
|
142451 | return getInput(btnUp, INPUT_DRUNK | INPUT_HERO_ACTION) || getInput(btnDown, INPUT_DRUNK | INPUT_HERO_ACTION) || getInput(btnLeft, INPUT_DRUNK | INPUT_HERO_ACTION) || getInput(btnRight, INPUT_DRUNK | INPUT_HERO_ACTION); |
| 815 | } | ||
| 816 | |||
| 817 | // called by ALLOFF() | ||
| 818 | 38158 | void HeroClass::resetflags(bool all) | |
| 819 | { | ||
| 820 | 38158 | refilling=REFILL_NONE; | |
| 821 | 38158 | inwallm=false; | |
| 822 | 38158 | inlikelike=blowcnt=whirlwind=specialcave=hclk=fairyclk=refill_why=didstuff=0; | |
| 823 | 38158 | usecounts.clear(); | |
| 824 | 38158 | item_cooldown.fill(0); | |
| 825 | |||
| 826 |
4/4✓ Branch 0 taken 38073 times.
✓ Branch 1 taken 85 times.
✓ Branch 2 taken 435 times.
✓ Branch 3 taken 37638 times.
|
38158 | if(swordclk>0 || all) |
| 827 | { | ||
| 828 | 520 | swordclk=0; | |
| 829 | 520 | verifyAWpn(); | |
| 830 | 520 | } | |
| 831 |
4/4✓ Branch 0 taken 38136 times.
✓ Branch 1 taken 22 times.
✓ Branch 2 taken 435 times.
✓ Branch 3 taken 37701 times.
|
38158 | if(itemclk>0 || all) |
| 832 | 457 | itemclk=0; | |
| 833 |
3/4✓ Branch 0 taken 38158 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 435 times.
✓ Branch 3 taken 37723 times.
|
38158 | if(shieldjinxclk>0 || all) |
| 834 | 435 | shieldjinxclk=0; | |
| 835 | |||
| 836 |
2/2✓ Branch 0 taken 37723 times.
✓ Branch 1 taken 435 times.
|
38158 | if(all) |
| 837 | { | ||
| 838 | 435 | DivineProtectionShieldClk=0; | |
| 839 | |||
| 840 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 435 times.
|
435 | if(div_prot_item != -1) |
| 841 | { | ||
| 842 | ✗ | stop_sfx(itemsbuf[div_prot_item].usesound); | |
| 843 | ✗ | stop_sfx(itemsbuf[div_prot_item].usesound+1); | |
| 844 | ✗ | } | |
| 845 | |||
| 846 | 435 | div_prot_item = -1; | |
| 847 | 435 | hoverclk=jumping=0; | |
| 848 | 435 | hoverflags = 0; | |
| 849 | 435 | } | |
| 850 | 38158 | damageovertimeclk = 0; | |
| 851 | 38158 | newconveyorclk = 0; | |
| 852 | 38158 | switchhookclk = switchhookstyle = switchhookarg = switchhookmaxtime = 0; | |
| 853 |
2/2✓ Branch 0 taken 38158 times.
✓ Branch 1 taken 267106 times.
|
305264 | for(auto q = 0; q < 7; ++q) |
| 854 | 267106 | hooked_undercombos[q] = -1; | |
| 855 | 38158 | hopclk=0; | |
| 856 | 38158 | hopdir=-1; | |
| 857 | 38158 | attackclk=0; | |
| 858 | 38158 | stomping=false; | |
| 859 | 38158 | reset_swordcharge(); | |
| 860 | 38158 | drownclk=drownCombo=0; | |
| 861 | 38158 | set_dive(0); | |
| 862 | 38158 | action=none; FFCore.setHeroAction(none); | |
| 863 | 38158 | conveyor_flags=0; | |
| 864 | 38158 | magiccastclk=0; | |
| 865 | 38158 | magicitem=-1; | |
| 866 | 38158 | } | |
| 867 | |||
| 868 | //Can use this for Hero->Stun. -Z | ||
| 869 | 14708 | void HeroClass::Freeze() | |
| 870 | { | ||
| 871 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14708 times.
|
14708 | if (action != inwind) |
| 872 | { | ||
| 873 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14708 times.
|
14708 | if (IsSideSwim()) {action=sideswimfreeze; FFCore.setHeroAction(sideswimfreeze);} |
| 874 | 14708 | else {action=freeze; FFCore.setHeroAction(freeze);} | |
| 875 | // also cancel Hero's attack | ||
| 876 | 14708 | attackclk = 0; | |
| 877 | 14708 | } | |
| 878 | 14708 | } | |
| 879 | 4067 | void HeroClass::unfreeze() | |
| 880 | { | ||
| 881 |
4/4✓ Branch 0 taken 1295 times.
✓ Branch 1 taken 2772 times.
✓ Branch 2 taken 1294 times.
✓ Branch 3 taken 1 times.
|
4067 | if(action==freeze && fairyclk<1) { action=none; FFCore.setHeroAction(none); } |
| 882 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 4067 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
4067 | if(action==sideswimfreeze && fairyclk<1) { action=sideswimming; FFCore.setHeroAction(sideswimming); } |
| 883 | 4067 | } | |
| 884 | |||
| 885 | 219 | void HeroClass::Drown(int32_t state) | |
| 886 | { | ||
| 887 | // Hero should never drown if the ladder is out | ||
| 888 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 219 times.
|
219 | if(ladderx+laddery) |
| 889 | ✗ | return; | |
| 890 | |||
| 891 | 219 | drop_liftwpn(); | |
| 892 |
2/2✓ Branch 0 taken 211 times.
✓ Branch 1 taken 8 times.
|
219 | switch(state) |
| 893 | { | ||
| 894 | case 1: | ||
| 895 | 8 | action=lavadrowning; FFCore.setHeroAction(lavadrowning); | |
| 896 | 8 | attackclk=0; | |
| 897 | 8 | attack=wNone; | |
| 898 | 8 | attackid=-1; | |
| 899 | 8 | reset_swordcharge(); | |
| 900 | 8 | drownclk=64; | |
| 901 | 8 | z=fakez=fall=fakefall=0; | |
| 902 | 8 | break; | |
| 903 | |||
| 904 | |||
| 905 | default: | ||
| 906 | { | ||
| 907 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 211 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
211 | if (isSideViewHero() && get_qr(qr_SIDESWIM)){action=sidedrowning; FFCore.setHeroAction(sidedrowning);} |
| 908 | 211 | else {action=drowning; FFCore.setHeroAction(drowning);} | |
| 909 | 211 | attackclk=0; | |
| 910 | 211 | attack=wNone; | |
| 911 | 211 | attackid=-1; | |
| 912 | 211 | reset_swordcharge(); | |
| 913 | 211 | drownclk=64; | |
| 914 | 211 | z=fakez=fall=fakefall=0; | |
| 915 | 211 | break; | |
| 916 | } | ||
| 917 | } | ||
| 918 | |||
| 919 | 219 | } | |
| 920 | |||
| 921 | 2686 | void HeroClass::finishedmsg() | |
| 922 | { | ||
| 923 | //these are to cancel out any keys that Hero may | ||
| 924 | //be pressing so he doesn't attack at the end of | ||
| 925 | //a message if he was scrolling through it quickly. | ||
| 926 | 2686 | getInput(btnA, INPUT_PRESS | INPUT_HERO_ACTION); | |
| 927 | 2686 | getInput(btnB, INPUT_PRESS | INPUT_HERO_ACTION); | |
| 928 | 2686 | unfreeze(); | |
| 929 | |||
| 930 |
3/4✓ Branch 0 taken 2535 times.
✓ Branch 1 taken 151 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2500 times.
|
5186 | if(action == landhold1 || |
| 931 |
2/2✓ Branch 0 taken 2502 times.
✓ Branch 1 taken 33 times.
|
2535 | action == landhold2 || |
| 932 |
2/2✓ Branch 0 taken 2501 times.
✓ Branch 1 taken 1 times.
|
2502 | action == waterhold1 || |
| 933 |
2/2✓ Branch 0 taken 2500 times.
✓ Branch 1 taken 1 times.
|
2501 | action == waterhold2 || |
| 934 |
1/2✓ Branch 0 taken 2500 times.
✗ Branch 1 not taken.
|
2500 | action == sidewaterhold1 || |
| 935 | 2500 | action == sidewaterhold2) | |
| 936 | { | ||
| 937 | 186 | holdclk = 1; | |
| 938 | 186 | } | |
| 939 | 2686 | } | |
| 940 | 82 | void HeroClass::setEaten(int32_t i) | |
| 941 | { | ||
| 942 | 82 | inlikelike=i; | |
| 943 | 82 | } | |
| 944 | 74 | int32_t HeroClass::getEaten() | |
| 945 | { | ||
| 946 | 74 | return inlikelike; | |
| 947 | } | ||
| 948 | 52170828 | zfix HeroClass::getX() | |
| 949 | { | ||
| 950 | 52170828 | return x; | |
| 951 | } | ||
| 952 | 53358456 | zfix HeroClass::getY() | |
| 953 | { | ||
| 954 | 53358456 | return y; | |
| 955 | } | ||
| 956 | 93425391 | zfix HeroClass::getZ() | |
| 957 | { | ||
| 958 | 93425391 | return z; | |
| 959 | } | ||
| 960 | 57328878 | zfix HeroClass::getFakeZ() | |
| 961 | { | ||
| 962 | 57328878 | return fakez; | |
| 963 | } | ||
| 964 | ✗ | zfix HeroClass::getFall() | |
| 965 | { | ||
| 966 | ✗ | return fall; | |
| 967 | } | ||
| 968 | 737898 | zfix HeroClass::getJump() | |
| 969 | { | ||
| 970 | 737898 | return fall / -100; | |
| 971 | } | ||
| 972 | ✗ | zfix HeroClass::getFakeFall() | |
| 973 | { | ||
| 974 | ✗ | return fakefall; | |
| 975 | } | ||
| 976 | ✗ | zfix HeroClass::getFakeJump() | |
| 977 | { | ||
| 978 | ✗ | return fakefall / -100; | |
| 979 | } | ||
| 980 | ✗ | zfix HeroClass::getXOfs() | |
| 981 | { | ||
| 982 | ✗ | return xofs; | |
| 983 | } | ||
| 984 | 1344 | zfix HeroClass::getYOfs() | |
| 985 | { | ||
| 986 | 1344 | return yofs; | |
| 987 | } | ||
| 988 | ✗ | void HeroClass::setXOfs(int32_t newxofs) | |
| 989 | { | ||
| 990 | ✗ | xofs=newxofs; | |
| 991 | ✗ | } | |
| 992 | ✗ | void HeroClass::setYOfs(int32_t newyofs) | |
| 993 | { | ||
| 994 | ✗ | yofs=newyofs; | |
| 995 | ✗ | } | |
| 996 | ✗ | int32_t HeroClass::getHXOfs() | |
| 997 | { | ||
| 998 | ✗ | return hxofs; | |
| 999 | } | ||
| 1000 | ✗ | int32_t HeroClass::getHYOfs() | |
| 1001 | { | ||
| 1002 | ✗ | return hyofs; | |
| 1003 | } | ||
| 1004 | ✗ | int32_t HeroClass::getHXSz() | |
| 1005 | { | ||
| 1006 | ✗ | return hit_width; | |
| 1007 | } | ||
| 1008 | ✗ | int32_t HeroClass::getHYSz() | |
| 1009 | { | ||
| 1010 | ✗ | return hit_height; | |
| 1011 | } | ||
| 1012 | 88384 | zfix HeroClass::getClimbCoverX() | |
| 1013 | { | ||
| 1014 | 88384 | return climb_cover_x; | |
| 1015 | } | ||
| 1016 | 88384 | zfix HeroClass::getClimbCoverY() | |
| 1017 | { | ||
| 1018 | 88384 | return climb_cover_y; | |
| 1019 | } | ||
| 1020 | ✗ | int32_t HeroClass::getLadderX() | |
| 1021 | { | ||
| 1022 | ✗ | return ladderx; | |
| 1023 | } | ||
| 1024 | ✗ | int32_t HeroClass::getLadderY() | |
| 1025 | { | ||
| 1026 | ✗ | return laddery; | |
| 1027 | } | ||
| 1028 | |||
| 1029 | 463289 | void HeroClass::setX(int32_t new_x) | |
| 1030 | { | ||
| 1031 | 463289 | zfix dx=new_x-x; | |
| 1032 | 463289 | justmoved = 2; | |
| 1033 |
2/2✓ Branch 0 taken 463268 times.
✓ Branch 1 taken 21 times.
|
463289 | if(Lwpns.idFirst(wHookshot)>-1) |
| 1034 | { | ||
| 1035 | 21 | Lwpns.spr(Lwpns.idFirst(wHookshot))->x+=dx; | |
| 1036 | 21 | hs_startx+=(int32_t)dx; | |
| 1037 | 21 | } | |
| 1038 | |||
| 1039 |
2/2✓ Branch 0 taken 463268 times.
✓ Branch 1 taken 21 times.
|
463289 | if(Lwpns.idFirst(wHSHandle)>-1) |
| 1040 | { | ||
| 1041 | 21 | Lwpns.spr(Lwpns.idFirst(wHSHandle))->x+=dx; | |
| 1042 | 21 | } | |
| 1043 | |||
| 1044 |
2/2✓ Branch 0 taken 463280 times.
✓ Branch 1 taken 9 times.
|
463289 | if(chainlinks.Count()>0) |
| 1045 | { | ||
| 1046 |
2/2✓ Branch 0 taken 19 times.
✓ Branch 1 taken 9 times.
|
28 | for(int32_t j=0; j<chainlinks.Count(); j++) |
| 1047 | { | ||
| 1048 | 19 | chainlinks.spr(j)->x+=dx; | |
| 1049 | 19 | } | |
| 1050 | 9 | } | |
| 1051 | |||
| 1052 | 463289 | x=new_x; | |
| 1053 | |||
| 1054 | // A kludge | ||
| 1055 |
4/4✓ Branch 0 taken 3710 times.
✓ Branch 1 taken 459579 times.
✓ Branch 2 taken 2385 times.
✓ Branch 3 taken 1325 times.
|
463289 | if(!diagonalMovement && dir<=down) |
| 1056 | 1325 | is_on_conveyor = -1; | |
| 1057 | 463289 | } | |
| 1058 | |||
| 1059 | 483610 | void HeroClass::setY(int32_t new_y) | |
| 1060 | { | ||
| 1061 | 483610 | zfix dy=new_y-y; | |
| 1062 | 483610 | justmoved = 2; | |
| 1063 |
2/2✓ Branch 0 taken 483601 times.
✓ Branch 1 taken 9 times.
|
483610 | if(Lwpns.idFirst(wHookshot)>-1) |
| 1064 | { | ||
| 1065 | 9 | Lwpns.spr(Lwpns.idFirst(wHookshot))->y+=dy; | |
| 1066 | 9 | hs_starty+=(int32_t)dy; | |
| 1067 | 9 | } | |
| 1068 | |||
| 1069 |
2/2✓ Branch 0 taken 483601 times.
✓ Branch 1 taken 9 times.
|
483610 | if(Lwpns.idFirst(wHSHandle)>-1) |
| 1070 | { | ||
| 1071 | 9 | Lwpns.spr(Lwpns.idFirst(wHSHandle))->y+=dy; | |
| 1072 | 9 | } | |
| 1073 | |||
| 1074 |
1/2✓ Branch 0 taken 483610 times.
✗ Branch 1 not taken.
|
483610 | if(chainlinks.Count()>0) |
| 1075 | { | ||
| 1076 | ✗ | for(int32_t j=0; j<chainlinks.Count(); j++) | |
| 1077 | { | ||
| 1078 | ✗ | chainlinks.spr(j)->y+=dy; | |
| 1079 | ✗ | } | |
| 1080 | ✗ | } | |
| 1081 | |||
| 1082 | 483610 | y=new_y; | |
| 1083 | |||
| 1084 | // A kludge | ||
| 1085 |
4/4✓ Branch 0 taken 3710 times.
✓ Branch 1 taken 479900 times.
✓ Branch 2 taken 1325 times.
✓ Branch 3 taken 2385 times.
|
483610 | if(!diagonalMovement && dir>=left) |
| 1086 | 2385 | is_on_conveyor = -1; | |
| 1087 | 483610 | } | |
| 1088 | |||
| 1089 | 4 | void HeroClass::setZ(int32_t new_z) | |
| 1090 | { | ||
| 1091 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | if(isSideViewHero()) |
| 1092 | ✗ | return; | |
| 1093 | |||
| 1094 |
2/4✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
|
4 | if(z==0 && new_z > 0) |
| 1095 | { | ||
| 1096 |
1/4✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
4 | switch(action) |
| 1097 | { | ||
| 1098 | case swimming: | ||
| 1099 | { | ||
| 1100 | ✗ | set_dive(0); | |
| 1101 | ✗ | action=walking; FFCore.setHeroAction(walking); | |
| 1102 | ✗ | break; | |
| 1103 | } | ||
| 1104 | |||
| 1105 | case waterhold1: | ||
| 1106 | { | ||
| 1107 | ✗ | action=landhold1; FFCore.setHeroAction(landhold1); | |
| 1108 | ✗ | break; | |
| 1109 | } | ||
| 1110 | |||
| 1111 | case waterhold2: | ||
| 1112 | { | ||
| 1113 | ✗ | action=landhold2; FFCore.setHeroAction(landhold2); | |
| 1114 | ✗ | break; | |
| 1115 | } | ||
| 1116 | |||
| 1117 | default: | ||
| 1118 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | if(charging) //!DIMITODO: Let Hero jump while charging sword |
| 1119 | { | ||
| 1120 | ✗ | reset_swordcharge(); | |
| 1121 | ✗ | attackclk=0; | |
| 1122 | ✗ | } | |
| 1123 | |||
| 1124 | 4 | break; | |
| 1125 | } | ||
| 1126 | 4 | } | |
| 1127 | |||
| 1128 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | z=(new_z>0 ? new_z : 0); |
| 1129 | 4 | } | |
| 1130 | |||
| 1131 | ✗ | void HeroClass::setFakeZ(int32_t new_z) | |
| 1132 | { | ||
| 1133 | ✗ | if(isSideViewHero()) | |
| 1134 | ✗ | return; | |
| 1135 | |||
| 1136 | ✗ | if(fakez==0 && new_z > 0) | |
| 1137 | { | ||
| 1138 | ✗ | switch(action) | |
| 1139 | { | ||
| 1140 | case swimming: | ||
| 1141 | { | ||
| 1142 | ✗ | set_dive(0); | |
| 1143 | ✗ | action=walking; FFCore.setHeroAction(walking); | |
| 1144 | ✗ | break; | |
| 1145 | } | ||
| 1146 | |||
| 1147 | case waterhold1: | ||
| 1148 | { | ||
| 1149 | ✗ | action=landhold1; FFCore.setHeroAction(landhold1); | |
| 1150 | ✗ | break; | |
| 1151 | } | ||
| 1152 | |||
| 1153 | case waterhold2: | ||
| 1154 | { | ||
| 1155 | ✗ | action=landhold2; FFCore.setHeroAction(landhold2); | |
| 1156 | ✗ | break; | |
| 1157 | } | ||
| 1158 | |||
| 1159 | default: | ||
| 1160 | ✗ | if(charging) //!DIMITODO: Let Hero jump while charging sword | |
| 1161 | { | ||
| 1162 | ✗ | reset_swordcharge(); | |
| 1163 | ✗ | attackclk=0; | |
| 1164 | ✗ | } | |
| 1165 | |||
| 1166 | ✗ | break; | |
| 1167 | } | ||
| 1168 | ✗ | } | |
| 1169 | |||
| 1170 | ✗ | fakez=(new_z>0 ? new_z : 0); | |
| 1171 | ✗ | } | |
| 1172 | |||
| 1173 | 31127 | void HeroClass::setXfix(zfix new_x) | |
| 1174 | { | ||
| 1175 | //Z_scripterrlog("setxdbl: %f\n",new_x); | ||
| 1176 | 31127 | zfix dx=new_x-x; | |
| 1177 | 31127 | justmoved = 2; | |
| 1178 |
2/2✓ Branch 0 taken 31117 times.
✓ Branch 1 taken 10 times.
|
31127 | if(Lwpns.idFirst(wHookshot)>-1) |
| 1179 | { | ||
| 1180 | 10 | Lwpns.spr(Lwpns.idFirst(wHookshot))->x+=dx; | |
| 1181 | 10 | hs_startx+=(int32_t)dx; | |
| 1182 | 10 | } | |
| 1183 | |||
| 1184 |
2/2✓ Branch 0 taken 31117 times.
✓ Branch 1 taken 10 times.
|
31127 | if(Lwpns.idFirst(wHSHandle)>-1) |
| 1185 | { | ||
| 1186 | 10 | Lwpns.spr(Lwpns.idFirst(wHSHandle))->x+=dx; | |
| 1187 | 10 | } | |
| 1188 | |||
| 1189 |
2/2✓ Branch 0 taken 31120 times.
✓ Branch 1 taken 7 times.
|
31127 | if(chainlinks.Count()>0) |
| 1190 | { | ||
| 1191 |
2/2✓ Branch 0 taken 15 times.
✓ Branch 1 taken 7 times.
|
22 | for(int32_t j=0; j<chainlinks.Count(); j++) |
| 1192 | { | ||
| 1193 | 15 | chainlinks.spr(j)->x+=dx; | |
| 1194 | 15 | } | |
| 1195 | 7 | } | |
| 1196 | |||
| 1197 | 31127 | x=new_x; | |
| 1198 | |||
| 1199 | // A kludge | ||
| 1200 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 31127 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
31127 | if(!diagonalMovement && dir<=down) |
| 1201 | ✗ | is_on_conveyor = -1; | |
| 1202 | 31127 | } | |
| 1203 | |||
| 1204 | 35404 | void HeroClass::setYfix(zfix new_y) | |
| 1205 | { | ||
| 1206 | 35404 | zfix dy=new_y-y; | |
| 1207 | 35404 | justmoved = 2; | |
| 1208 |
2/2✓ Branch 0 taken 35364 times.
✓ Branch 1 taken 40 times.
|
35404 | if(Lwpns.idFirst(wHookshot)>-1) |
| 1209 | { | ||
| 1210 | 40 | Lwpns.spr(Lwpns.idFirst(wHookshot))->y+=dy; | |
| 1211 | 40 | hs_starty+=(int32_t)dy; | |
| 1212 | 40 | } | |
| 1213 | |||
| 1214 |
2/2✓ Branch 0 taken 35364 times.
✓ Branch 1 taken 40 times.
|
35404 | if(Lwpns.idFirst(wHSHandle)>-1) |
| 1215 | { | ||
| 1216 | 40 | Lwpns.spr(Lwpns.idFirst(wHSHandle))->y+=dy; | |
| 1217 | 40 | } | |
| 1218 | |||
| 1219 |
2/2✓ Branch 0 taken 35370 times.
✓ Branch 1 taken 34 times.
|
35404 | if(chainlinks.Count()>0) |
| 1220 | { | ||
| 1221 |
2/2✓ Branch 0 taken 179 times.
✓ Branch 1 taken 34 times.
|
213 | for(int32_t j=0; j<chainlinks.Count(); j++) |
| 1222 | { | ||
| 1223 | 179 | chainlinks.spr(j)->y+=dy; | |
| 1224 | 179 | } | |
| 1225 | 34 | } | |
| 1226 | |||
| 1227 | 35404 | y=new_y; | |
| 1228 | |||
| 1229 | // A kludge | ||
| 1230 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 35404 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
35404 | if(!diagonalMovement && dir>=left) |
| 1231 | ✗ | is_on_conveyor = -1; | |
| 1232 | 35404 | } | |
| 1233 | |||
| 1234 | 2779 | void HeroClass::setZfix(zfix new_z) | |
| 1235 | { | ||
| 1236 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2779 times.
|
2779 | if(isSideViewHero()) |
| 1237 | ✗ | return; | |
| 1238 | |||
| 1239 |
4/4✓ Branch 0 taken 21 times.
✓ Branch 1 taken 2758 times.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 15 times.
|
2779 | if(z==0 && new_z > 0) |
| 1240 | { | ||
| 1241 |
1/4✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
15 | switch(action) |
| 1242 | { | ||
| 1243 | case swimming: | ||
| 1244 | { | ||
| 1245 | ✗ | set_dive(0); | |
| 1246 | ✗ | action=walking; FFCore.setHeroAction(walking); | |
| 1247 | ✗ | break; | |
| 1248 | } | ||
| 1249 | |||
| 1250 | case waterhold1: | ||
| 1251 | { | ||
| 1252 | ✗ | action=landhold1; FFCore.setHeroAction(landhold1); | |
| 1253 | ✗ | break; | |
| 1254 | } | ||
| 1255 | |||
| 1256 | case waterhold2: | ||
| 1257 | { | ||
| 1258 | ✗ | action=landhold2; FFCore.setHeroAction(landhold2); | |
| 1259 | ✗ | break; | |
| 1260 | } | ||
| 1261 | |||
| 1262 | default: | ||
| 1263 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 15 times.
|
15 | if(charging) //!DIMITODO: Let Hero jump while charging sword |
| 1264 | { | ||
| 1265 | ✗ | reset_swordcharge(); | |
| 1266 | ✗ | attackclk=0; | |
| 1267 | ✗ | } | |
| 1268 | |||
| 1269 | 15 | break; | |
| 1270 | } | ||
| 1271 | 15 | } | |
| 1272 | |||
| 1273 |
2/2✓ Branch 0 taken 2771 times.
✓ Branch 1 taken 8 times.
|
2779 | z=(new_z>0 ? new_z : 0_zf); |
| 1274 | 2779 | } | |
| 1275 | |||
| 1276 | ✗ | void HeroClass::setFakeZfix(zfix new_z) | |
| 1277 | { | ||
| 1278 | ✗ | if(isSideViewHero()) | |
| 1279 | ✗ | return; | |
| 1280 | |||
| 1281 | ✗ | if(fakez==0 && new_z > 0) | |
| 1282 | { | ||
| 1283 | ✗ | switch(action) | |
| 1284 | { | ||
| 1285 | case swimming: | ||
| 1286 | { | ||
| 1287 | ✗ | set_dive(0); | |
| 1288 | ✗ | action=walking; FFCore.setHeroAction(walking); | |
| 1289 | ✗ | break; | |
| 1290 | } | ||
| 1291 | |||
| 1292 | case waterhold1: | ||
| 1293 | { | ||
| 1294 | ✗ | action=landhold1; FFCore.setHeroAction(landhold1); | |
| 1295 | ✗ | break; | |
| 1296 | } | ||
| 1297 | |||
| 1298 | case waterhold2: | ||
| 1299 | { | ||
| 1300 | ✗ | action=landhold2; FFCore.setHeroAction(landhold2); | |
| 1301 | ✗ | break; | |
| 1302 | } | ||
| 1303 | |||
| 1304 | default: | ||
| 1305 | ✗ | if(charging) //!DIMITODO: Let Hero jump while charging sword | |
| 1306 | { | ||
| 1307 | ✗ | reset_swordcharge(); | |
| 1308 | ✗ | attackclk=0; | |
| 1309 | ✗ | } | |
| 1310 | |||
| 1311 | ✗ | break; | |
| 1312 | } | ||
| 1313 | ✗ | } | |
| 1314 | |||
| 1315 | ✗ | fakez=(new_z>0 ? new_z : 0_zf); | |
| 1316 | ✗ | } | |
| 1317 | |||
| 1318 | 77206 | void HeroClass::setFall(zfix new_fall) | |
| 1319 | { | ||
| 1320 | 77206 | fall = new_fall; | |
| 1321 | 77206 | justmoved = 2; | |
| 1322 |
3/4✓ Branch 0 taken 10946 times.
✓ Branch 1 taken 66260 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 66260 times.
|
77206 | if (!jumping && fall || !get_qr(qr_BETTER_PLAYER_JUMP_ANIM)) |
| 1323 | 77206 | jumping = -1; | |
| 1324 | 77206 | } | |
| 1325 | ✗ | void HeroClass::setFakeFall(zfix new_fall) | |
| 1326 | { | ||
| 1327 | ✗ | fakefall = new_fall; | |
| 1328 | ✗ | if (!jumping && fakefall || !get_qr(qr_BETTER_PLAYER_JUMP_ANIM)) | |
| 1329 | ✗ | jumping = -1; | |
| 1330 | ✗ | } | |
| 1331 | 76838 | void HeroClass::setJump(zfix new_jump) | |
| 1332 | { | ||
| 1333 | 76838 | setFall(new_jump*-100); | |
| 1334 | 76838 | } | |
| 1335 | ✗ | void HeroClass::setFakeJump(zfix new_jump) | |
| 1336 | { | ||
| 1337 | ✗ | setFakeFall(new_jump*-100); | |
| 1338 | ✗ | } | |
| 1339 | ✗ | void HeroClass::setClimbCoverX(int32_t new_x) | |
| 1340 | { | ||
| 1341 | ✗ | climb_cover_x=new_x; | |
| 1342 | ✗ | } | |
| 1343 | ✗ | void HeroClass::setClimbCoverY(int32_t new_y) | |
| 1344 | { | ||
| 1345 | ✗ | climb_cover_y=new_y; | |
| 1346 | ✗ | } | |
| 1347 | 157388 | int32_t HeroClass::getLStep() | |
| 1348 | { | ||
| 1349 | 157388 | return lstep; | |
| 1350 | } | ||
| 1351 | 5961 | int32_t HeroClass::getCharging() | |
| 1352 | { | ||
| 1353 | 5961 | return charging; | |
| 1354 | } | ||
| 1355 | 139743 | bool HeroClass::isCharged() | |
| 1356 | { | ||
| 1357 | 139743 | return spins>0; | |
| 1358 | } | ||
| 1359 | 2 | int32_t HeroClass::getAttackClk() | |
| 1360 | { | ||
| 1361 | 2 | return attackclk; | |
| 1362 | } | ||
| 1363 | 2 | void HeroClass::setAttackClk(int32_t new_clk) | |
| 1364 | { | ||
| 1365 | 2 | attackclk=new_clk; | |
| 1366 | 2 | } | |
| 1367 | ✗ | void HeroClass::setCharging(int32_t new_charging) | |
| 1368 | { | ||
| 1369 | ✗ | charging=new_charging; | |
| 1370 | ✗ | } | |
| 1371 | 3143020808 | int32_t HeroClass::getSwordClk() | |
| 1372 | { | ||
| 1373 | 3143020808 | return swordclk; | |
| 1374 | } | ||
| 1375 | 3073113370 | int32_t HeroClass::getItemClk() | |
| 1376 | { | ||
| 1377 | 3073113370 | return itemclk; | |
| 1378 | } | ||
| 1379 | 3088775663 | int32_t HeroClass::getShieldClk() | |
| 1380 | { | ||
| 1381 | 3088775663 | return shieldjinxclk; | |
| 1382 | } | ||
| 1383 | 720 | void HeroClass::setSwordClk(int32_t newclk) | |
| 1384 | { | ||
| 1385 | 720 | swordclk=newclk; | |
| 1386 | 720 | verifyAWpn(); | |
| 1387 | 720 | } | |
| 1388 | 5880 | void HeroClass::setItemClk(int32_t newclk) | |
| 1389 | { | ||
| 1390 | 5880 | itemclk=newclk; | |
| 1391 | 5880 | } | |
| 1392 | 2 | void HeroClass::setShieldClk(int32_t newclk) | |
| 1393 | { | ||
| 1394 | 2 | shieldjinxclk=newclk; | |
| 1395 | 2 | } | |
| 1396 | // TODO remove, no longer needed. | ||
| 1397 | 1432345 | zfix HeroClass::getModifiedX() | |
| 1398 | { | ||
| 1399 | 1432345 | zfix tempx=x; | |
| 1400 | 1432345 | return tempx; | |
| 1401 | } | ||
| 1402 | |||
| 1403 | 1432345 | zfix HeroClass::getModifiedY() | |
| 1404 | { | ||
| 1405 | 1432345 | zfix tempy=y; | |
| 1406 | 1432345 | return tempy; | |
| 1407 | } | ||
| 1408 | |||
| 1409 | 65310 | int32_t HeroClass::getDir() | |
| 1410 | { | ||
| 1411 | 65310 | return dir; | |
| 1412 | } | ||
| 1413 | 95831 | void HeroClass::setDir(int32_t newdir) | |
| 1414 | { | ||
| 1415 | 95831 | dir=newdir; | |
| 1416 | 95831 | reset_hookshot(); | |
| 1417 | 95831 | } | |
| 1418 | 441276 | int32_t HeroClass::getHitDir() | |
| 1419 | { | ||
| 1420 | 441276 | return hitdir; | |
| 1421 | } | ||
| 1422 | 2220 | void HeroClass::setHitDir(int32_t newdir) | |
| 1423 | { | ||
| 1424 | 2220 | hitdir = newdir; | |
| 1425 | 2220 | } | |
| 1426 | ✗ | int32_t HeroClass::getClk() | |
| 1427 | { | ||
| 1428 | ✗ | return clk; | |
| 1429 | } | ||
| 1430 | 180367 | int32_t HeroClass::getPushing() | |
| 1431 | { | ||
| 1432 | 180367 | return pushing; | |
| 1433 | } | ||
| 1434 | 15739 | void HeroClass::Catch() | |
| 1435 | { | ||
| 1436 |
5/6✓ Branch 0 taken 15739 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 12702 times.
✓ Branch 3 taken 3037 times.
✓ Branch 4 taken 6295 times.
✓ Branch 5 taken 6407 times.
|
15739 | if(!inwallm && (action==none || action==walking)) |
| 1437 | { | ||
| 1438 | 9332 | SetAttack(); | |
| 1439 | 9332 | attackclk=0; | |
| 1440 | 9332 | attack=wCatching; | |
| 1441 | 9332 | } | |
| 1442 | 15739 | } | |
| 1443 | |||
| 1444 | 4628217 | bool HeroClass::getClock() | |
| 1445 | { | ||
| 1446 | 4628217 | return superman; | |
| 1447 | } | ||
| 1448 | 958 | void HeroClass::setClock(bool state) | |
| 1449 | { | ||
| 1450 | 958 | superman=state; | |
| 1451 | 958 | } | |
| 1452 | 17390113 | int32_t HeroClass::getFlashingCSet() | |
| 1453 | { | ||
| 1454 | 17390113 | int32_t temp_cs = 6; | |
| 1455 |
2/2✓ Branch 0 taken 17135734 times.
✓ Branch 1 taken 254379 times.
|
17390113 | if (script_hero_cset > -1) temp_cs = script_hero_cset; |
| 1456 |
2/2✓ Branch 0 taken 2344626 times.
✓ Branch 1 taken 15045487 times.
|
17390113 | if (!get_qr(qr_HEROFLICKER)) |
| 1457 | { | ||
| 1458 |
3/4✓ Branch 0 taken 131583 times.
✓ Branch 1 taken 14913904 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 131583 times.
|
15045487 | if (superman && getCanFlicker()) |
| 1459 | { | ||
| 1460 | 131583 | temp_cs += (((~frame) >> 1) & 3); | |
| 1461 | 131583 | } | |
| 1462 |
4/6✓ Branch 0 taken 660968 times.
✓ Branch 1 taken 14252936 times.
✓ Branch 2 taken 660968 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 660968 times.
|
14913904 | else if (hclk && (DivineProtectionShieldClk <= 0) && getCanFlicker()) |
| 1463 | { | ||
| 1464 | 660968 | temp_cs += ((hclk >> 1) & 3); | |
| 1465 | 660968 | } | |
| 1466 | 15045487 | } | |
| 1467 | 17390113 | return temp_cs; | |
| 1468 | } | ||
| 1469 | 18375835 | bool HeroClass::is_hitflickerframe() | |
| 1470 | { | ||
| 1471 |
6/6✓ Branch 0 taken 2496482 times.
✓ Branch 1 taken 15879353 times.
✓ Branch 2 taken 2433681 times.
✓ Branch 3 taken 62801 times.
✓ Branch 4 taken 107429 times.
✓ Branch 5 taken 2326252 times.
|
18375835 | if (!(get_qr(qr_HEROFLICKER) && (superman || hclk))) |
| 1472 | 18205605 | return false; | |
| 1473 | |||
| 1474 | 170230 | int32_t fr = game->get_spriteflickerspeed(); | |
| 1475 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 170230 times.
|
170230 | if (fr == 0) |
| 1476 | ✗ | return true; | |
| 1477 | 170230 | return frame % (fr * 2) >= fr; | |
| 1478 | 18375835 | } | |
| 1479 | 64515974 | int32_t HeroClass::getAction() // Used by ZScript | |
| 1480 | { | ||
| 1481 |
2/2✓ Branch 0 taken 28896 times.
✓ Branch 1 taken 64487078 times.
|
64515974 | if(spins > 0) |
| 1482 | 28896 | return isspinning; | |
| 1483 |
2/2✓ Branch 0 taken 344618 times.
✓ Branch 1 taken 64142460 times.
|
64487078 | else if(charging > 0) |
| 1484 | 344618 | return ischarging; | |
| 1485 |
2/2✓ Branch 0 taken 64075533 times.
✓ Branch 1 taken 66927 times.
|
64142460 | else if(diveclk) |
| 1486 | 66927 | return isdiving; | |
| 1487 | //else if (pushing > 0) return ispushing; //Needs a QR? -Z or make it an instruction as Hero->Pushing? Probably better, as that has a clk?? | ||
| 1488 | |||
| 1489 | 64075533 | return action; | |
| 1490 | 64515974 | } | |
| 1491 | |||
| 1492 | 112790563 | int32_t HeroClass::getAction2() // Used by ZScript new FFCore.actions | |
| 1493 | { | ||
| 1494 |
2/2✓ Branch 0 taken 37543 times.
✓ Branch 1 taken 112753020 times.
|
112790563 | if(spins > 0) |
| 1495 | 37543 | return isspinning; | |
| 1496 |
2/2✓ Branch 0 taken 612651 times.
✓ Branch 1 taken 112140369 times.
|
112753020 | else if(charging > 0) |
| 1497 | 612651 | return ischarging; | |
| 1498 |
2/2✓ Branch 0 taken 111941420 times.
✓ Branch 1 taken 198949 times.
|
112140369 | else if(diveclk) |
| 1499 | 198949 | return isdiving; | |
| 1500 | //else if (pushing > 0) return ispushing; //Needs a QR? -Z or make it an instruction as Hero->Pushing? Probably better, as that has a clk?? | ||
| 1501 | |||
| 1502 | 111941420 | return -1; | |
| 1503 | 112790563 | } | |
| 1504 | |||
| 1505 | 5515 | void HeroClass::setAction(actiontype new_action) // Used by ZScript | |
| 1506 | { | ||
| 1507 |
4/8✓ Branch 0 taken 5515 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5515 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5515 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 5515 times.
|
11030 | if(new_action==dying || new_action==won || new_action==scrolling || |
| 1508 |
3/6✓ Branch 0 taken 5515 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5515 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5515 times.
✗ Branch 5 not taken.
|
5515 | new_action==inwind || new_action==ischarging || new_action==sideswimischarging || |
| 1509 | 5515 | new_action==hopping) //!DIMITODO: allow setting sideswimming stuff | |
| 1510 | ✗ | return; // Can't use these actions. | |
| 1511 | |||
| 1512 |
3/6✓ Branch 0 taken 5259 times.
✓ Branch 1 taken 256 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5259 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
5515 | if (!isSideViewHero() && (new_action>=sideswimming && new_action <= sideswimischarging)) |
| 1513 | ✗ | return; | |
| 1514 | |||
| 1515 |
2/2✓ Branch 0 taken 5280 times.
✓ Branch 1 taken 235 times.
|
5515 | if(new_action==rafting) |
| 1516 | { | ||
| 1517 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 235 times.
|
235 | if(get_qr(qr_DISALLOW_SETTING_RAFTING)) return; |
| 1518 |
4/4✓ Branch 0 taken 224 times.
✓ Branch 1 taken 11 times.
✓ Branch 2 taken 11 times.
✓ Branch 3 taken 224 times.
|
235 | if(!(isRaftFlag(nextflag(x+8,y+8,dir,false))||isRaftFlag(nextflag(x+8,y+8,dir,true)))) |
| 1519 | 11 | return; | |
| 1520 | 224 | } | |
| 1521 | |||
| 1522 | |||
| 1523 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 5504 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
5504 | if(magicitem>-1 && itemsbuf[magicitem].type==itype_divineescape) |
| 1524 | { | ||
| 1525 | // Using Divine Escape | ||
| 1526 | ✗ | if(magiccastclk<96) | |
| 1527 | { | ||
| 1528 | // Not cast yet; cancel it | ||
| 1529 | ✗ | magicitem=-1; | |
| 1530 | ✗ | magiccastclk=0; | |
| 1531 | ✗ | } | |
| 1532 | else | ||
| 1533 | // Already activated; don't do anything | ||
| 1534 | ✗ | return; | |
| 1535 | ✗ | } | |
| 1536 | |||
| 1537 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5504 times.
|
5504 | if(action==inwind) // Remove from whirlwind |
| 1538 | { | ||
| 1539 | ✗ | xofs=0; | |
| 1540 | ✗ | whirlwind=0; | |
| 1541 | ✗ | lstep=0; | |
| 1542 | ✗ | if ( dontdraw < 2 ) { dontdraw=0; } | |
| 1543 | ✗ | } | |
| 1544 |
2/4✓ Branch 0 taken 5504 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5504 times.
|
5504 | else if(action==freeze||action==sideswimfreeze) // Might be in enemy wind |
| 1545 | { | ||
| 1546 | ✗ | sprite* wind=0; | |
| 1547 | ✗ | bool foundWind=false; | |
| 1548 | ✗ | for(int32_t i=0; i<Ewpns.Count(); i++) | |
| 1549 | { | ||
| 1550 | ✗ | wind=Ewpns.spr(i); | |
| 1551 | ✗ | if(wind->id==ewWind && wind->misc==999) | |
| 1552 | { | ||
| 1553 | ✗ | foundWind=true; | |
| 1554 | ✗ | break; | |
| 1555 | } | ||
| 1556 | ✗ | } | |
| 1557 | |||
| 1558 | ✗ | if(foundWind) | |
| 1559 | { | ||
| 1560 | ✗ | xofs=0; | |
| 1561 | ✗ | if ( dontdraw < 2 ) { dontdraw=false; } | |
| 1562 | ✗ | wind->misc=-1; | |
| 1563 | ✗ | x=wind->x; | |
| 1564 | ✗ | y=wind->y; | |
| 1565 | ✗ | } | |
| 1566 | ✗ | } | |
| 1567 | |||
| 1568 | //Unless compat rule is on, reset hopping clocks when writing action! | ||
| 1569 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 5504 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
5504 | if(action == hopping && !get_qr(qr_NO_OVERWRITING_HOPPING)) |
| 1570 | { | ||
| 1571 | ✗ | hopclk = 0; | |
| 1572 | ✗ | hopdir = -1; | |
| 1573 | ✗ | } | |
| 1574 | |||
| 1575 |
3/4✓ Branch 0 taken 3081 times.
✓ Branch 1 taken 2423 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 3081 times.
|
5504 | if(new_action != attacking && new_action != sideswimattacking) |
| 1576 | { | ||
| 1577 | 3081 | attackclk=0; | |
| 1578 | |||
| 1579 |
1/2✓ Branch 0 taken 3081 times.
✗ Branch 1 not taken.
|
3081 | if(attack==wHookshot) |
| 1580 | ✗ | reset_hookshot(); | |
| 1581 | 3081 | } | |
| 1582 |
2/4✓ Branch 0 taken 5504 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5504 times.
|
5504 | if(new_action != isspinning && new_action != sideswimisspinning) |
| 1583 | { | ||
| 1584 | 5504 | charging = 0; | |
| 1585 | 5504 | spins = 0; | |
| 1586 | 5504 | } | |
| 1587 | |||
| 1588 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 5504 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
5504 | if(action == falling && new_action != falling) |
| 1589 | { | ||
| 1590 | ✗ | fallclk = 0; //Stop falling; | |
| 1591 | ✗ | } | |
| 1592 | |||
| 1593 |
3/4✓ Branch 0 taken 224 times.
✓ Branch 1 taken 5280 times.
✓ Branch 2 taken 224 times.
✗ Branch 3 not taken.
|
5504 | if (action == rafting && new_action != rafting) |
| 1594 | { | ||
| 1595 | ✗ | raftwarpx = x;//If you wanted to make Link stop rafting on a dock combo, don't make the dock retrigger the raft. | |
| 1596 | ✗ | raftwarpy = y; | |
| 1597 | ✗ | } | |
| 1598 | |||
| 1599 |
4/9✓ Branch 0 taken 17 times.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 2423 times.
✓ Branch 5 taken 3063 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
5504 | switch(new_action) |
| 1600 | { | ||
| 1601 | case isspinning: | ||
| 1602 | case sideswimisspinning: | ||
| 1603 | ✗ | if(attack==wSword) | |
| 1604 | { | ||
| 1605 | ✗ | attackclk = SWORDCHARGEFRAME+1; | |
| 1606 | ✗ | charging = 0; | |
| 1607 | |||
| 1608 | ✗ | if(spins==0) | |
| 1609 | ✗ | spins = 5; | |
| 1610 | ✗ | } | |
| 1611 | ✗ | return; | |
| 1612 | |||
| 1613 | case isdiving: | ||
| 1614 | ✗ | if(action==swimming && !diveclk) | |
| 1615 | { | ||
| 1616 | ✗ | int32_t flippers_id = current_item_id(itype_flippers); | |
| 1617 | ✗ | set_dive(flippers_id < 0 ? 50 : itemsbuf[flippers_id].misc1); | |
| 1618 | ✗ | } | |
| 1619 | ✗ | return; | |
| 1620 | |||
| 1621 | case drowning: | ||
| 1622 | case sidedrowning: | ||
| 1623 | ✗ | clear_platform_ffc(); | |
| 1624 | ✗ | if(!drownclk) | |
| 1625 | ✗ | Drown(); | |
| 1626 | |||
| 1627 | ✗ | break; | |
| 1628 | |||
| 1629 | case lavadrowning: | ||
| 1630 | //Lavadrowning is just drowning but with a different argument. Simplicity! -Dimi | ||
| 1631 | ✗ | clear_platform_ffc(); | |
| 1632 | ✗ | if(!drownclk) | |
| 1633 | ✗ | Drown(1); | |
| 1634 | |||
| 1635 | ✗ | break; | |
| 1636 | |||
| 1637 | case falling: | ||
| 1638 | ✗ | clear_platform_ffc(); | |
| 1639 | ✗ | if(!fallclk) | |
| 1640 | { | ||
| 1641 | //If there is a pit under Hero, use its combo. | ||
| 1642 | ✗ | if(int32_t c = getpitfall(x+8,y+(bigHitbox?8:12))) fallCombo = c; | |
| 1643 | ✗ | else if(int32_t c = getpitfall(x,y+(bigHitbox?0:8))) fallCombo = c; | |
| 1644 | ✗ | else if(int32_t c = getpitfall(x+15,y+(bigHitbox?0:8))) fallCombo = c; | |
| 1645 | ✗ | else if(int32_t c = getpitfall(x,y+15)) fallCombo = c; | |
| 1646 | ✗ | else if(int32_t c = getpitfall(x+15,y+15)) fallCombo = c; | |
| 1647 | //Else, use a null value; triggers default pit values | ||
| 1648 | ✗ | else fallCombo = 0; | |
| 1649 | ✗ | fallclk = PITFALL_FALL_FRAMES; | |
| 1650 | ✗ | } | |
| 1651 | ✗ | break; | |
| 1652 | |||
| 1653 | case gothit: | ||
| 1654 | case swimhit: | ||
| 1655 | case sideswimhit: | ||
| 1656 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | if(!hclk) |
| 1657 | 1 | hclk=48; | |
| 1658 | 1 | check_on_hit(); | |
| 1659 | 1 | break; | |
| 1660 | |||
| 1661 | case landhold1: | ||
| 1662 | case landhold2: | ||
| 1663 | case waterhold1: | ||
| 1664 | case waterhold2: | ||
| 1665 | case sidewaterhold1: | ||
| 1666 | case sidewaterhold2: | ||
| 1667 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 17 times.
|
17 | if(!holdclk) |
| 1668 | 17 | holdclk=130; | |
| 1669 | |||
| 1670 | 17 | attack=none; | |
| 1671 | 17 | break; | |
| 1672 | |||
| 1673 | case attacking: | ||
| 1674 | case sideswimattacking: | ||
| 1675 | 2423 | attack=none; | |
| 1676 | 2423 | break; | |
| 1677 | |||
| 1678 | default: | ||
| 1679 | 3063 | break; | |
| 1680 | } | ||
| 1681 | |||
| 1682 | 5504 | action=new_action; FFCore.setHeroAction(new_action); | |
| 1683 | 5515 | } | |
| 1684 | |||
| 1685 | 48 | void HeroClass::setHeldItem(int32_t newitem) | |
| 1686 | { | ||
| 1687 | 48 | holditem=newitem; | |
| 1688 | 48 | } | |
| 1689 | 204 | int32_t HeroClass::getHeldItem() | |
| 1690 | { | ||
| 1691 | 204 | return holditem; | |
| 1692 | } | ||
| 1693 | 36451182 | bool HeroClass::isDiving() | |
| 1694 | { | ||
| 1695 | 36451182 | return diveclk > 0; | |
| 1696 | } | ||
| 1697 | 30919765 | bool HeroClass::isSwimming() | |
| 1698 | { | ||
| 1699 | 30919765 | bool include_swimhit = true; | |
| 1700 |
3/4✓ Branch 0 taken 30919765 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6909621 times.
✓ Branch 3 taken 24010144 times.
|
30919765 | if (replay_is_active() && replay_version_check(0, 31)) |
| 1701 | { | ||
| 1702 |
2/4✓ Branch 0 taken 24010144 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 24010144 times.
|
24010144 | std::string qst = replay_get_meta_str("qst"); |
| 1703 | 24010144 | bool disable = false; | |
| 1704 |
1/2✓ Branch 0 taken 24010144 times.
✗ Branch 1 not taken.
|
24010144 | disable |= qst == "demons_inferno.qst"; |
| 1705 |
1/2✓ Branch 0 taken 24010144 times.
✗ Branch 1 not taken.
|
24010144 | disable |= qst == "demosp253.qst"; |
| 1706 |
1/2✓ Branch 0 taken 24010144 times.
✗ Branch 1 not taken.
|
24010144 | disable |= qst == "hell_awaits.qst"; |
| 1707 |
1/2✓ Branch 0 taken 24010144 times.
✗ Branch 1 not taken.
|
24010144 | disable |= qst == "lands_of_serenity.qst"; |
| 1708 |
1/2✓ Branch 0 taken 24010144 times.
✗ Branch 1 not taken.
|
24010144 | disable |= qst == "link_to_the_heavens.qst"; |
| 1709 | // The others are just a gfx change, but this one actual breaks without this compat check. | ||
| 1710 |
1/2✓ Branch 0 taken 24010144 times.
✗ Branch 1 not taken.
|
24010144 | disable |= qst == "link_to_the_zelda.qst"; |
| 1711 | 24010144 | include_swimhit = !disable; | |
| 1712 | 24010144 | } | |
| 1713 |
4/6✓ Branch 0 taken 30607222 times.
✓ Branch 1 taken 312543 times.
✓ Branch 2 taken 30607222 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 30607222 times.
✗ Branch 5 not taken.
|
61526987 | return ((action==swimming)||(action==sideswimming)||IsSideSwim()|| |
| 1714 |
8/8✓ Branch 0 taken 30604564 times.
✓ Branch 1 taken 2658 times.
✓ Branch 2 taken 30602664 times.
✓ Branch 3 taken 1900 times.
✓ Branch 4 taken 19706559 times.
✓ Branch 5 taken 10896105 times.
✓ Branch 6 taken 814 times.
✓ Branch 7 taken 19705745 times.
|
30607222 | (action==waterhold1)||(action==waterhold2)||(include_swimhit && action==swimhit)|| |
| 1715 | 30601850 | (hopclk==0xFF)); | |
| 1716 | ✗ | } | |
| 1717 | |||
| 1718 | 3498 | void HeroClass::setDontDraw(byte new_dontdraw) | |
| 1719 | { | ||
| 1720 | 3498 | dontdraw=new_dontdraw; | |
| 1721 | 3498 | } | |
| 1722 | |||
| 1723 | 2373003 | byte HeroClass::getDontDraw() | |
| 1724 | { | ||
| 1725 | 2373003 | return dontdraw; | |
| 1726 | } | ||
| 1727 | |||
| 1728 | 3 | void HeroClass::setHClk(int32_t newhclk) | |
| 1729 | { | ||
| 1730 | 3 | hclk=newhclk; | |
| 1731 | 3 | } | |
| 1732 | |||
| 1733 | 57322 | int32_t HeroClass::getHClk() | |
| 1734 | { | ||
| 1735 | 57322 | return hclk; | |
| 1736 | } | ||
| 1737 | |||
| 1738 | 11906696 | int32_t HeroClass::getSpecialCave() | |
| 1739 | { | ||
| 1740 | 11906696 | return specialcave; // used only by maps.cpp | |
| 1741 | } | ||
| 1742 | |||
| 1743 | 1597 | void HeroClass::init() | |
| 1744 | { | ||
| 1745 | 1597 | cache_tile_mod_clear(); | |
| 1746 | 1597 | usecounts.clear(); | |
| 1747 | 1597 | item_cooldown.fill(0); | |
| 1748 | 1597 | scale = 0; | |
| 1749 | 1597 | rotation = 0; | |
| 1750 | 1597 | do_animation = true; | |
| 1751 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1597 times.
|
1597 | if(lift_wpn) |
| 1752 | { | ||
| 1753 | ✗ | delete lift_wpn; | |
| 1754 | ✗ | lift_wpn = nullptr; | |
| 1755 | ✗ | } | |
| 1756 | 1597 | clear_platform_ffc(); | |
| 1757 | 1597 | liftclk = 0; | |
| 1758 | 1597 | tliftclk = 0; | |
| 1759 | 1597 | liftheight = 0; | |
| 1760 | 1597 | liftflags = 0; | |
| 1761 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1597 times.
|
1597 | if ( dontdraw != 2 ) { dontdraw = 0; } //scripted dontdraw == 2, normal == 1, draw hero == 0 |
| 1762 | 1597 | hookshot_used=false; | |
| 1763 | 1597 | justmoved = 0; | |
| 1764 | 1597 | hookshot_frozen=false; | |
| 1765 | 1597 | onpassivedmg=false; | |
| 1766 | 1597 | dir = up; | |
| 1767 | 1597 | damageovertimeclk = 0; | |
| 1768 | 1597 | newconveyorclk = 0; | |
| 1769 | 1597 | switchhookclk = switchhookstyle = switchhookarg = switchhookmaxtime = 0; | |
| 1770 |
2/2✓ Branch 0 taken 11179 times.
✓ Branch 1 taken 1597 times.
|
12776 | for(auto q = 0; q < 7; ++q) |
| 1771 | 11179 | hooked_undercombos[q] = -1; | |
| 1772 | 1597 | shiftdir = -1; | |
| 1773 | 1597 | sideswimdir = right; | |
| 1774 | 1597 | holddir = -1; | |
| 1775 | 1597 | landswim = 0; | |
| 1776 | 1597 | sdir = up; | |
| 1777 | 1597 | ilswim=true; | |
| 1778 | 1597 | walkable=false; | |
| 1779 | 1597 | moveflags = move_obeys_grav | move_can_pitfall | move_can_waterdrown; | |
| 1780 | 1597 | warp_sound = 0; | |
| 1781 | 1597 | subscr_speed = zinit.subscrSpeed; | |
| 1782 | 1597 | steprate = zinit.heroStep; | |
| 1783 | 1597 | shove_offset = zinit.shove_offset; | |
| 1784 | 1597 | is_warping = false; | |
| 1785 | 1597 | coyotetime = 0; | |
| 1786 | |||
| 1787 | 1597 | hammer_swim_up_offset = hammeroffsets[0]; | |
| 1788 | 1597 | hammer_swim_down_offset = hammeroffsets[1]; | |
| 1789 | 1597 | hammer_swim_left_offset = hammeroffsets[2]; | |
| 1790 | 1597 | hammer_swim_right_offset = hammeroffsets[3]; | |
| 1791 | |||
| 1792 | 1597 | prompt_combo = prompt_x = prompt_y = prompt_cset = 0; | |
| 1793 | |||
| 1794 |
2/2✓ Branch 0 taken 427 times.
✓ Branch 1 taken 1170 times.
|
1597 | if (hero_scr) |
| 1795 | { | ||
| 1796 |
2/2✓ Branch 0 taken 622 times.
✓ Branch 1 taken 548 times.
|
1170 | if(get_qr(qr_NOARRIVALPOINT)) |
| 1797 | { | ||
| 1798 | 622 | x=hero_scr->warpreturnx[0]; | |
| 1799 | 622 | y=hero_scr->warpreturny[0]; | |
| 1800 | 622 | } | |
| 1801 | else | ||
| 1802 | { | ||
| 1803 | 548 | x=hero_scr->warparrivalx; | |
| 1804 | 548 | y=hero_scr->warparrivaly; | |
| 1805 | } | ||
| 1806 | 1170 | } | |
| 1807 | |||
| 1808 | 1597 | z=fakez=fall=fakefall=0; | |
| 1809 | 1597 | hzsz = 12; // So that flying peahats can still hit him. | |
| 1810 | |||
| 1811 |
2/2✓ Branch 0 taken 578 times.
✓ Branch 1 taken 1019 times.
|
1597 | if(x==0) dir=right; |
| 1812 | |||
| 1813 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 1579 times.
|
1597 | if(x==world_w-16) dir=left; |
| 1814 | |||
| 1815 |
2/2✓ Branch 0 taken 587 times.
✓ Branch 1 taken 1010 times.
|
1597 | if(y==0) dir=down; |
| 1816 | |||
| 1817 |
2/2✓ Branch 0 taken 306 times.
✓ Branch 1 taken 1291 times.
|
1597 | if(y==world_h-16) dir=up; |
| 1818 | |||
| 1819 |
2/2✓ Branch 0 taken 1170 times.
✓ Branch 1 taken 427 times.
|
1597 | if (hero_scr) |
| 1820 | { | ||
| 1821 | 1170 | x += region_scr_dx*256; | |
| 1822 | 1170 | y += region_scr_dy*176; | |
| 1823 | 1170 | update_viewport(); | |
| 1824 | 1170 | } | |
| 1825 | |||
| 1826 | 1597 | lstep=0; | |
| 1827 | 1597 | skipstep=0; | |
| 1828 | 1597 | autostep=false; | |
| 1829 | 1597 | attackclk=holdclk=hoverclk=jumping=raftclk=0; | |
| 1830 | 1597 | attack=wNone; | |
| 1831 | 1597 | attackid=-1; | |
| 1832 | 1597 | action=none; FFCore.setHeroAction(none); tempaction=none; | |
| 1833 | 1597 | xofs=0; | |
| 1834 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1597 times.
|
1597 | yofs=(get_qr(qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset); |
| 1835 | 1597 | cs=6; | |
| 1836 | 1597 | flickercolor=-1; | |
| 1837 | 1597 | flickertransp=-1; | |
| 1838 | 1597 | pushing=fairyclk=0; | |
| 1839 | 1597 | id=0; | |
| 1840 | 1597 | inlikelike=0; | |
| 1841 | 1597 | superman=inwallm=false; | |
| 1842 | 1597 | scriptcoldet=true; | |
| 1843 | 1597 | blowcnt=whirlwind=specialcave=0; | |
| 1844 | 1597 | hopclk=fallclk=0; | |
| 1845 | 1597 | set_dive(0); | |
| 1846 | 1597 | fallCombo = 0; | |
| 1847 | 1597 | pit_pulldir = -1; | |
| 1848 | 1597 | hopdir=-1; | |
| 1849 | 1597 | conveyor_flags=0; | |
| 1850 | 1597 | drunkclk=0; | |
| 1851 | 1597 | lstunclock = 0; | |
| 1852 | 1597 | is_conveyor_stunned=0; | |
| 1853 | 1597 | convey_forcex=convey_forcey=0; | |
| 1854 | 1597 | drawstyle=3; | |
| 1855 | 1597 | ffwarp = false; | |
| 1856 | 1597 | stepoutindex=stepoutwr=stepoutdmap=stepoutscreen=0; | |
| 1857 | 1597 | stepnext=stepsecret=rpos_t::None; | |
| 1858 | 1597 | ffpit = false; | |
| 1859 | 1597 | respawn_x=x; | |
| 1860 | 1597 | respawn_y=y; | |
| 1861 | 1597 | respawn_dmap=cur_dmap; | |
| 1862 | 1597 | respawn_scr=cur_screen; | |
| 1863 | 1597 | falling_oldy = y; | |
| 1864 | 1597 | magiccastclk=0; | |
| 1865 | 1597 | magicitem = div_prot_item = -1; | |
| 1866 | 1597 | last_lens_id = 0; //Should be -1 (-Z) | |
| 1867 | 1597 | last_grav_boots_id = last_rocs_id = current_rocs_jump_id = -1; | |
| 1868 | 1597 | released_jump_button = false; | |
| 1869 | 1597 | last_lift_id.reset(); | |
| 1870 | 1597 | last_savepoint_id = 0; | |
| 1871 | 1597 | misc_internal_hero_flags = 0; | |
| 1872 | 1597 | last_cane_of_byrna_item_id = -1; | |
| 1873 | 1597 | on_sideview_ladder = false; | |
| 1874 | 1597 | standing_on_z = 0; | |
| 1875 | 1597 | standing_z_offset = false; | |
| 1876 | 1597 | extra_jump_count = 0; | |
| 1877 | 1597 | hoverflags = 0; | |
| 1878 | 1597 | lbunnyclock = 0; | |
| 1879 | 1597 | lamp_paid = false; | |
| 1880 | 1597 | autowalk_combo_id = -1; | |
| 1881 | 1597 | autowalk_handle = {}; | |
| 1882 | |||
| 1883 |
2/2✓ Branch 0 taken 51104 times.
✓ Branch 1 taken 1597 times.
|
52701 | for(int32_t i=0; i<32; i++) miscellaneous[i] = 0; |
| 1884 | |||
| 1885 | 1597 | setBigHitbox(get_qr(qr_LTTPCOLLISION)); | |
| 1886 | 1597 | diagonalMovement=(get_qr(qr_LTTPWALK)); | |
| 1887 | |||
| 1888 | 1597 | shield_active = false; | |
| 1889 | 1597 | shield_forcedir = -1; | |
| 1890 | 1597 | active_shield_id = -1; | |
| 1891 | 1597 | conv_forcedir = -1; | |
| 1892 | |||
| 1893 | 1597 | preventsubscreenfalling = false; //-Z | |
| 1894 | 1597 | walkspeed = 0; //not used, yet. -Z | |
| 1895 |
2/2✓ Branch 0 taken 27149 times.
✓ Branch 1 taken 1597 times.
|
28746 | for ( int32_t q = 0; q < NUM_HIT_TYPES_USED; q++ ) lastHitBy[q][0] = 0; |
| 1896 |
2/2✓ Branch 0 taken 27149 times.
✓ Branch 1 taken 1597 times.
|
28746 | for ( int32_t q = 0; q < NUM_HIT_TYPES_USED; q++ ) lastHitBy[q][1] = 0; |
| 1897 |
2/2✓ Branch 0 taken 233162 times.
✓ Branch 1 taken 1597 times.
|
234759 | for ( int32_t q = 0; q < wMax; q++ ) |
| 1898 | { | ||
| 1899 | 233162 | defence[q] = hero_defenses[q]; //we will need to have a Hero section in the quest load/save code! -Z Added 3/26/21 - Jman | |
| 1900 | 233162 | } | |
| 1901 | |||
| 1902 | 1597 | clear_ice(); | |
| 1903 | 1597 | script_ice_combo = 0; | |
| 1904 | //Run script! | ||
| 1905 |
4/4✓ Branch 0 taken 275 times.
✓ Branch 1 taken 1322 times.
✓ Branch 2 taken 117 times.
✓ Branch 3 taken 158 times.
|
1597 | if (( FFCore.getQuestHeaderInfo(vZelda) >= 0x255 ) && (game->get_hasplayed()) ) //if (!hasplayed) runs in game_loop() |
| 1906 | { | ||
| 1907 | 117 | ZScriptVersion::RunScript(ScriptType::Hero, SCRIPT_HERO_INIT); | |
| 1908 | 117 | FFCore.deallocateAllScriptOwned(ScriptType::Hero, SCRIPT_HERO_INIT); | |
| 1909 | 117 | FFCore.initZScriptHeroScripts(); //Clear the stack and the refinfo data to be ready for Hero's active script. | |
| 1910 | 117 | set_respawn_point(); //screen entry at spawn; //This should be after the init script, so that Hero->X and Hero->Y set by the script | |
| 1911 | //are properly set by the engine. | ||
| 1912 | 117 | } | |
| 1913 | 1597 | FFCore.nostepforward = 0; | |
| 1914 | |||
| 1915 |
2/2✓ Branch 0 taken 6388 times.
✓ Branch 1 taken 1597 times.
|
7985 | for (int i = 0; i < 4; i++) |
| 1916 | 6388 | lastdir[i] = 0xFF; | |
| 1917 | |||
| 1918 |
2/2✓ Branch 0 taken 319 times.
✓ Branch 1 taken 1278 times.
|
1597 | if (replay_version_check(12)) |
| 1919 | 1278 | z3step = 2; | |
| 1920 | 1597 | } | |
| 1921 | |||
| 1922 | 17432876 | void HeroClass::draw_under(BITMAP* dest) | |
| 1923 | { | ||
| 1924 | 17432876 | int32_t c_raft=current_item_id(itype_raft); | |
| 1925 | 17432876 | int32_t c_ladder=current_item_id(itype_ladder); | |
| 1926 | |||
| 1927 |
3/4✓ Branch 0 taken 145048 times.
✓ Branch 1 taken 17287828 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 145048 times.
|
17432876 | if(action==rafting && c_raft >-1) |
| 1928 | { | ||
| 1929 |
4/4✓ Branch 0 taken 107236 times.
✓ Branch 1 taken 37812 times.
✓ Branch 2 taken 83165 times.
✓ Branch 3 taken 61883 times.
|
145048 | if(((dir==left) || (dir==right)) && (get_qr(qr_RLFIX))) |
| 1930 | { | ||
| 1931 | 123766 | overtile16(dest, itemsbuf[c_raft].tile, x - viewport.x, y+playing_field_offset+4 - viewport.y, | |
| 1932 | 61883 | itemsbuf[c_raft].csets&15, rotate_value((itemsbuf[c_raft].misc_flags>>2)&3)^3); | |
| 1933 | 61883 | } | |
| 1934 | else | ||
| 1935 | { | ||
| 1936 | 166330 | overtile16(dest, itemsbuf[c_raft].tile, x - viewport.x, y+playing_field_offset+4 - viewport.y, | |
| 1937 | 83165 | itemsbuf[c_raft].csets&15, (itemsbuf[c_raft].misc_flags>>2)&3); | |
| 1938 | } | ||
| 1939 | 145048 | } | |
| 1940 | |||
| 1941 |
3/4✓ Branch 0 taken 152912 times.
✓ Branch 1 taken 17279964 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 152912 times.
|
17432876 | if(ladderx+laddery && c_ladder >-1) |
| 1942 | { | ||
| 1943 |
4/4✓ Branch 0 taken 73694 times.
✓ Branch 1 taken 79218 times.
✓ Branch 2 taken 50344 times.
✓ Branch 3 taken 23350 times.
|
152912 | if((ladderdir>=left) && (get_qr(qr_RLFIX))) |
| 1944 | { | ||
| 1945 | 100688 | overtile16(dest, itemsbuf[c_ladder].tile, ladderx - viewport.x, laddery+playing_field_offset - viewport.y, | |
| 1946 | 50344 | itemsbuf[c_ladder].csets&15, rotate_value((itemsbuf[c_ladder].misc_flags>>2)&3)^3); | |
| 1947 | 50344 | } | |
| 1948 | else | ||
| 1949 | { | ||
| 1950 | 205136 | overtile16(dest, itemsbuf[c_ladder].tile, ladderx - viewport.x, laddery+playing_field_offset - viewport.y, | |
| 1951 | 102568 | itemsbuf[c_ladder].csets&15, (itemsbuf[c_ladder].misc_flags>>2)&3); | |
| 1952 | } | ||
| 1953 | 152912 | } | |
| 1954 | 17432876 | } | |
| 1955 | |||
| 1956 | 19889 | void HeroClass::drawshadow(BITMAP* dest, bool translucent) | |
| 1957 | { | ||
| 1958 | 19889 | int32_t tempy=yofs; | |
| 1959 | 19889 | yofs+=8; | |
| 1960 | 19889 | shadowtile = wpnsbuf[spr_shadow].tile; | |
| 1961 | 19889 | sprite::drawshadow(dest,translucent); | |
| 1962 | 19889 | yofs=tempy; | |
| 1963 | 19889 | } | |
| 1964 | |||
| 1965 | // The Stone of Agony reacts to these flags. | ||
| 1966 | 617536 | bool HeroClass::agonyflag(int32_t flag) | |
| 1967 | { | ||
| 1968 |
1/2✓ Branch 0 taken 617536 times.
✗ Branch 1 not taken.
|
617536 | switch(flag) |
| 1969 | { | ||
| 1970 | case mfWHISTLE: | ||
| 1971 | case mfANYFIRE: | ||
| 1972 | case mfARROW: | ||
| 1973 | case mfBOMB: | ||
| 1974 | case mfSBOMB: | ||
| 1975 | case mfBRANG: | ||
| 1976 | case mfMBRANG: | ||
| 1977 | case mfFBRANG: | ||
| 1978 | case mfSARROW: | ||
| 1979 | case mfGARROW: | ||
| 1980 | case mfSTRONGFIRE: | ||
| 1981 | case mfMAGICFIRE: | ||
| 1982 | case mfDIVINEFIRE: | ||
| 1983 | case mfWANDMAGIC: | ||
| 1984 | case mfREFMAGIC: | ||
| 1985 | case mfREFFIREBALL: | ||
| 1986 | case mfSWORD: | ||
| 1987 | case mfWSWORD: | ||
| 1988 | case mfMSWORD: | ||
| 1989 | case mfXSWORD: | ||
| 1990 | case mfSWORDBEAM: | ||
| 1991 | case mfWSWORDBEAM: | ||
| 1992 | case mfMSWORDBEAM: | ||
| 1993 | case mfXSWORDBEAM: | ||
| 1994 | case mfHOOKSHOT: | ||
| 1995 | case mfWAND: | ||
| 1996 | case mfHAMMER: | ||
| 1997 | case mfSTRIKE: | ||
| 1998 | ✗ | return true; | |
| 1999 | } | ||
| 2000 | |||
| 2001 | 617536 | return false; | |
| 2002 | 617536 | } | |
| 2003 | |||
| 2004 | |||
| 2005 | // Find the attack power of the current melee weapon. | ||
| 2006 | // The Whimsical Ring is applied on a target-by-target basis. | ||
| 2007 | 1167339 | int32_t HeroClass::weaponattackpower(int32_t itid) | |
| 2008 | { | ||
| 2009 |
1/2✓ Branch 0 taken 1167339 times.
✗ Branch 1 not taken.
|
1167339 | if(itid < 0) |
| 2010 | { | ||
| 2011 | ✗ | itid = current_item_id(attack==wCByrna ? itype_cbyrna | |
| 2012 | ✗ | : attack==wWand ? itype_wand | |
| 2013 | ✗ | : attack==wHammer ? itype_hammer | |
| 2014 | : itype_sword); | ||
| 2015 | ✗ | } | |
| 2016 |
2/2✓ Branch 0 taken 20 times.
✓ Branch 1 taken 1167319 times.
|
1167339 | int32_t power = attack==wCByrna ? itemsbuf[itid].misc4 : itemsbuf[itid].power; |
| 2017 | |||
| 2018 | // Multiply it by the power of the spin attack/quake hammer, if applicable. | ||
| 2019 |
2/2✓ Branch 0 taken 2660 times.
✓ Branch 1 taken 1164679 times.
|
1167339 | if(spins > 0) |
| 2020 | { | ||
| 2021 | 2660 | int screen = currentscroll; | |
| 2022 |
1/2✓ Branch 0 taken 2660 times.
✗ Branch 1 not taken.
|
2660 | if(screen < 0) |
| 2023 | { | ||
| 2024 | ✗ | screen = current_item_id(attack==wHammer ? (spins>1?itype_quakescroll2:itype_quakescroll) | |
| 2025 | ✗ | : (spins>5 || current_item_id(itype_spinscroll) < 0) | |
| 2026 | ? itype_spinscroll2 : itype_spinscroll); | ||
| 2027 | ✗ | } | |
| 2028 | 2660 | power *= itemsbuf[screen].power; | |
| 2029 | 2660 | } | |
| 2030 | 1164679 | else currentscroll = -1; | |
| 2031 | 1167339 | return power; | |
| 2032 | } | ||
| 2033 | |||
| 2034 | #define NET_CLK_TOTAL 24 | ||
| 2035 | #define NET_DIR_INC (NET_CLK_TOTAL/3) | ||
| 2036 | // Must only be called once per frame! | ||
| 2037 | 138 | void HeroClass::positionNet(weapon *w, int32_t itemid) | |
| 2038 | { | ||
| 2039 | 138 | itemid = vbound(itemid, 0, MAXITEMS-1); | |
| 2040 | 138 | int32_t t = w->o_tile, | |
| 2041 | 138 | wx = 1, wy = 1; | |
| 2042 | |||
| 2043 | //Invert positioning clock if right-handed animation | ||
| 2044 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 138 times.
|
138 | int32_t clock = (itemsbuf[itemid].flags&item_flag2 ? (NET_CLK_TOTAL-1)-attackclk : attackclk); |
| 2045 |
1/2✓ Branch 0 taken 138 times.
✗ Branch 1 not taken.
|
138 | if(clock >= NET_CLK_TOTAL) |
| 2046 | ✗ | w->dead = 0; | |
| 2047 | 138 | int32_t tiledir = dir; | |
| 2048 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
✓ Branch 2 taken 69 times.
✓ Branch 3 taken 23 times.
✓ Branch 4 taken 38 times.
|
138 | switch(dir) |
| 2049 | { | ||
| 2050 | case up: | ||
| 2051 | { | ||
| 2052 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
|
8 | if(clock < NET_DIR_INC) tiledir = l_up; |
| 2053 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
|
8 | else if(clock >= NET_DIR_INC*2) tiledir = r_up; |
| 2054 | 8 | break; | |
| 2055 | } | ||
| 2056 | case down: | ||
| 2057 | { | ||
| 2058 |
2/2✓ Branch 0 taken 21 times.
✓ Branch 1 taken 48 times.
|
69 | if(clock < NET_DIR_INC) tiledir = r_down; |
| 2059 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 24 times.
|
48 | else if(clock >= NET_DIR_INC*2) tiledir = l_down; |
| 2060 | 69 | break; | |
| 2061 | } | ||
| 2062 | case left: | ||
| 2063 | { | ||
| 2064 |
2/2✓ Branch 0 taken 7 times.
✓ Branch 1 taken 16 times.
|
23 | if(clock < NET_DIR_INC) tiledir = l_down; |
| 2065 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 8 times.
|
16 | else if(clock >= NET_DIR_INC*2) tiledir = l_up; |
| 2066 | 23 | break; | |
| 2067 | } | ||
| 2068 | case right: | ||
| 2069 | { | ||
| 2070 |
2/2✓ Branch 0 taken 14 times.
✓ Branch 1 taken 24 times.
|
38 | if(clock < NET_DIR_INC) tiledir = r_up; |
| 2071 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 8 times.
|
24 | else if(clock >= NET_DIR_INC*2) tiledir = r_down; |
| 2072 | 38 | break; | |
| 2073 | } | ||
| 2074 | } | ||
| 2075 | 138 | int32_t offs = 0; | |
| 2076 |
2/2✓ Branch 0 taken 90 times.
✓ Branch 1 taken 48 times.
|
138 | if(tiledir > right) |
| 2077 | 90 | offs = ((clock%NET_DIR_INC)<NET_DIR_INC/2) ? 1 : 0; | |
| 2078 | 48 | else offs = vbound(((clock%NET_DIR_INC)/(NET_DIR_INC/3))-1,-1,1); | |
| 2079 | //One of 8 positions | ||
| 2080 |
7/9✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 22 times.
✓ Branch 3 taken 16 times.
✓ Branch 4 taken 29 times.
✓ Branch 5 taken 24 times.
✓ Branch 6 taken 31 times.
✓ Branch 7 taken 8 times.
✓ Branch 8 taken 8 times.
|
138 | switch(tiledir) |
| 2081 | { | ||
| 2082 | case up: | ||
| 2083 | { | ||
| 2084 | ✗ | wx = 6*offs; | |
| 2085 | ✗ | wy = -14; | |
| 2086 | ✗ | break; | |
| 2087 | } | ||
| 2088 | case r_up: | ||
| 2089 | { | ||
| 2090 | 22 | wx = (offs ? 10 : 14); | |
| 2091 | 22 | wy = (offs ? -12 : -10); | |
| 2092 | 22 | break; | |
| 2093 | } | ||
| 2094 | case right: | ||
| 2095 | { | ||
| 2096 | 16 | wx = 14; | |
| 2097 | 16 | wy = 6*offs; | |
| 2098 | 16 | break; | |
| 2099 | } | ||
| 2100 | case r_down: | ||
| 2101 | { | ||
| 2102 | 29 | wx = (offs ? 14 : 10); | |
| 2103 | 29 | wy = (offs ? 10 : 12); | |
| 2104 | 29 | break; | |
| 2105 | } | ||
| 2106 | case down: | ||
| 2107 | { | ||
| 2108 | 24 | wx = -6*offs; | |
| 2109 | 24 | wy = 14; | |
| 2110 | 24 | break; | |
| 2111 | } | ||
| 2112 | case l_down: | ||
| 2113 | { | ||
| 2114 | 31 | wx = (offs ? -10 : -14); | |
| 2115 | 31 | wy = (offs ? 12 : 10); | |
| 2116 | 31 | break; | |
| 2117 | } | ||
| 2118 | case left: | ||
| 2119 | { | ||
| 2120 | 8 | wx = -14; | |
| 2121 | 8 | wy = -6*offs; | |
| 2122 | 8 | break; | |
| 2123 | } | ||
| 2124 | case l_up: | ||
| 2125 | { | ||
| 2126 | 8 | wx = (offs ? -14 : -10); | |
| 2127 | 8 | wy = (offs ? -10 : -12); | |
| 2128 | 8 | break; | |
| 2129 | } | ||
| 2130 | } | ||
| 2131 | |||
| 2132 | 138 | w->x = x+wx; | |
| 2133 | 138 | w->y = y+wy-(original_playing_field_offset-2-yofs)-fakez; | |
| 2134 | 138 | w->z = (z+zofs); | |
| 2135 | 138 | w->fakez = fakez; | |
| 2136 | 138 | w->tile = t+tiledir; | |
| 2137 | 138 | w->power = 0; | |
| 2138 | 138 | w->dir = dir; | |
| 2139 | 138 | w->doAutoRotate(true); | |
| 2140 | 138 | } | |
| 2141 | 1019620 | void HeroClass::positionSword(weapon *w, int32_t itemid) | |
| 2142 | { | ||
| 2143 | //if ( w->ScriptGenerated ) return; //t/b/a for script-generated swords. | ||
| 2144 | //if ( itemsbuf[itemid].ScriptGenerated ) return; //t/b/a for script-generated swords. | ||
| 2145 | 1019620 | itemid=vbound(itemid, 0, MAXITEMS-1); | |
| 2146 | // Place a sword weapon at the right spot. | ||
| 2147 | 1019620 | int32_t wy=1; | |
| 2148 | 1019620 | int32_t wx=1; | |
| 2149 | 1019620 | int32_t f=0,t,cs2; | |
| 2150 | |||
| 2151 | 1019620 | t = w->o_tile; | |
| 2152 | 1019620 | cs2 = w->o_cset; | |
| 2153 | 1019620 | slashxofs=0; | |
| 2154 | 1019620 | slashyofs=0; | |
| 2155 | |||
| 2156 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 205950 times.
✓ Branch 2 taken 219594 times.
✓ Branch 3 taken 298369 times.
✓ Branch 4 taken 295707 times.
|
1019620 | switch(dir) |
| 2157 | { | ||
| 2158 | case up: | ||
| 2159 | 205950 | wx=-1; | |
| 2160 | 205950 | wy=-12; | |
| 2161 | |||
| 2162 |
8/8✓ Branch 0 taken 96784 times.
✓ Branch 1 taken 109166 times.
✓ Branch 2 taken 95207 times.
✓ Branch 3 taken 1577 times.
✓ Branch 4 taken 94652 times.
✓ Branch 5 taken 555 times.
✓ Branch 6 taken 8956 times.
✓ Branch 7 taken 85696 times.
|
205950 | if(game->get_canslash() && w->id==wSword && itemsbuf[itemid].flags & item_flag4 && charging==0) |
| 2163 | { | ||
| 2164 |
2/2✓ Branch 0 taken 55586 times.
✓ Branch 1 taken 30110 times.
|
85696 | if(attackclk>10) //extended stab |
| 2165 | { | ||
| 2166 | 30110 | slashyofs-=3; | |
| 2167 | 30110 | wy-=2; | |
| 2168 | 30110 | } | |
| 2169 | |||
| 2170 |
2/2✓ Branch 0 taken 76659 times.
✓ Branch 1 taken 9037 times.
|
85696 | if(attackclk>=14) //retracting stab |
| 2171 | { | ||
| 2172 | 9037 | slashyofs+=3; | |
| 2173 | 9037 | wy+=2; | |
| 2174 | 9037 | } | |
| 2175 | 85696 | } | |
| 2176 | else | ||
| 2177 | { | ||
| 2178 |
2/2✓ Branch 0 taken 7388 times.
✓ Branch 1 taken 112866 times.
|
120254 | if(attackclk==SWORDCHARGEFRAME) |
| 2179 | { | ||
| 2180 | 7388 | wy+=4; | |
| 2181 | 7388 | } | |
| 2182 |
2/2✓ Branch 0 taken 10943 times.
✓ Branch 1 taken 101923 times.
|
112866 | else if(attackclk==13) |
| 2183 | { | ||
| 2184 | 10943 | wy+=4; | |
| 2185 | 10943 | } | |
| 2186 |
2/2✓ Branch 0 taken 91088 times.
✓ Branch 1 taken 10835 times.
|
101923 | else if(attackclk==14) |
| 2187 | { | ||
| 2188 | 10835 | wy+=8; | |
| 2189 | 10835 | } | |
| 2190 | } | ||
| 2191 | |||
| 2192 | 205950 | break; | |
| 2193 | |||
| 2194 | case down: | ||
| 2195 | 219594 | f=get_qr(qr_SWORDWANDFLIPFIX)?3:2; | |
| 2196 | 219594 | wy=11; | |
| 2197 | |||
| 2198 |
8/8✓ Branch 0 taken 122727 times.
✓ Branch 1 taken 96867 times.
✓ Branch 2 taken 121324 times.
✓ Branch 3 taken 1403 times.
✓ Branch 4 taken 120612 times.
✓ Branch 5 taken 712 times.
✓ Branch 6 taken 8077 times.
✓ Branch 7 taken 112535 times.
|
219594 | if(game->get_canslash() && w->id==wSword && itemsbuf[itemid].flags & item_flag4 && charging==0) |
| 2199 | { | ||
| 2200 |
2/2✓ Branch 0 taken 70463 times.
✓ Branch 1 taken 42072 times.
|
112535 | if(attackclk>10) //extended stab |
| 2201 | { | ||
| 2202 | 42072 | slashyofs+=3; | |
| 2203 | 42072 | wy+=2; | |
| 2204 | 42072 | } | |
| 2205 | |||
| 2206 |
2/2✓ Branch 0 taken 99741 times.
✓ Branch 1 taken 12794 times.
|
112535 | if(attackclk>=14) //retracting stab |
| 2207 | { | ||
| 2208 | 12794 | slashyofs-=3; | |
| 2209 | 12794 | wy-=2; | |
| 2210 | 12794 | } | |
| 2211 | 112535 | } | |
| 2212 | else | ||
| 2213 | { | ||
| 2214 |
2/2✓ Branch 0 taken 7439 times.
✓ Branch 1 taken 99620 times.
|
107059 | if(attackclk==SWORDCHARGEFRAME) |
| 2215 | { | ||
| 2216 | 7439 | wy-=2; | |
| 2217 | 7439 | } | |
| 2218 |
2/2✓ Branch 0 taken 9920 times.
✓ Branch 1 taken 89700 times.
|
99620 | else if(attackclk==13) |
| 2219 | { | ||
| 2220 | 9920 | wy-=4; | |
| 2221 | 9920 | } | |
| 2222 |
2/2✓ Branch 0 taken 79815 times.
✓ Branch 1 taken 9885 times.
|
89700 | else if(attackclk==14) |
| 2223 | { | ||
| 2224 | 9885 | wy-=8; | |
| 2225 | 9885 | } | |
| 2226 | } | ||
| 2227 | |||
| 2228 | 219594 | break; | |
| 2229 | |||
| 2230 | case left: | ||
| 2231 | 298369 | f=1; | |
| 2232 | 298369 | wx=-11; | |
| 2233 | 298369 | ++t; | |
| 2234 | |||
| 2235 |
8/8✓ Branch 0 taken 176968 times.
✓ Branch 1 taken 121401 times.
✓ Branch 2 taken 173269 times.
✓ Branch 3 taken 3699 times.
✓ Branch 4 taken 171822 times.
✓ Branch 5 taken 1447 times.
✓ Branch 6 taken 12699 times.
✓ Branch 7 taken 159123 times.
|
298369 | if(game->get_canslash() && w->id==wSword && itemsbuf[itemid].flags & item_flag4 && charging==0) |
| 2236 | { | ||
| 2237 |
2/2✓ Branch 0 taken 98921 times.
✓ Branch 1 taken 60202 times.
|
159123 | if(attackclk>10) //extended stab |
| 2238 | { | ||
| 2239 | 60202 | slashxofs-=4; | |
| 2240 | 60202 | wx-=7; | |
| 2241 | 60202 | } | |
| 2242 | |||
| 2243 |
2/2✓ Branch 0 taken 141337 times.
✓ Branch 1 taken 17786 times.
|
159123 | if(attackclk>=14) //retracting stab |
| 2244 | { | ||
| 2245 | 17786 | slashxofs+=3; | |
| 2246 | 17786 | wx+=7; | |
| 2247 | 17786 | } | |
| 2248 | 159123 | } | |
| 2249 | else | ||
| 2250 | { | ||
| 2251 |
2/2✓ Branch 0 taken 11124 times.
✓ Branch 1 taken 128122 times.
|
139246 | if(attackclk==SWORDCHARGEFRAME) |
| 2252 | { | ||
| 2253 | 11124 | wx+=2; | |
| 2254 | 11124 | } | |
| 2255 |
2/2✓ Branch 0 taken 12763 times.
✓ Branch 1 taken 115359 times.
|
128122 | else if(attackclk==13) |
| 2256 | { | ||
| 2257 | 12763 | wx+=4; | |
| 2258 | 12763 | } | |
| 2259 |
2/2✓ Branch 0 taken 102645 times.
✓ Branch 1 taken 12714 times.
|
115359 | else if(attackclk==14) |
| 2260 | { | ||
| 2261 | 12714 | wx+=8; | |
| 2262 | 12714 | } | |
| 2263 | } | ||
| 2264 | |||
| 2265 | 298369 | break; | |
| 2266 | |||
| 2267 | case right: | ||
| 2268 | 295707 | wx=11; | |
| 2269 | 295707 | ++t; | |
| 2270 | |||
| 2271 |
8/8✓ Branch 0 taken 168034 times.
✓ Branch 1 taken 127673 times.
✓ Branch 2 taken 165232 times.
✓ Branch 3 taken 2802 times.
✓ Branch 4 taken 161936 times.
✓ Branch 5 taken 3296 times.
✓ Branch 6 taken 15884 times.
✓ Branch 7 taken 146052 times.
|
295707 | if(game->get_canslash() && w->id==wSword && itemsbuf[itemid].flags & item_flag4 && charging==0) |
| 2272 | { | ||
| 2273 |
2/2✓ Branch 0 taken 90376 times.
✓ Branch 1 taken 55676 times.
|
146052 | if(attackclk>10) //extended stab |
| 2274 | { | ||
| 2275 | 55676 | slashxofs+=4; | |
| 2276 | 55676 | wx+=7; | |
| 2277 | 55676 | } | |
| 2278 | |||
| 2279 |
2/2✓ Branch 0 taken 128938 times.
✓ Branch 1 taken 17114 times.
|
146052 | if(attackclk>=14) //retracting stab |
| 2280 | { | ||
| 2281 | 17114 | slashxofs-=3; | |
| 2282 | 17114 | wx-=7; | |
| 2283 | 17114 | } | |
| 2284 | 146052 | } | |
| 2285 | else | ||
| 2286 | { | ||
| 2287 |
2/2✓ Branch 0 taken 14319 times.
✓ Branch 1 taken 135336 times.
|
149655 | if(attackclk==SWORDCHARGEFRAME) |
| 2288 | { | ||
| 2289 | 14319 | wx-=2; | |
| 2290 | 14319 | } | |
| 2291 |
2/2✓ Branch 0 taken 13430 times.
✓ Branch 1 taken 121906 times.
|
135336 | else if(attackclk==13) |
| 2292 | { | ||
| 2293 | 13430 | wx-=4; | |
| 2294 | 13430 | } | |
| 2295 |
2/2✓ Branch 0 taken 108515 times.
✓ Branch 1 taken 13391 times.
|
121906 | else if(attackclk==14) |
| 2296 | { | ||
| 2297 | 13391 | wx-=8; | |
| 2298 | 13391 | } | |
| 2299 | } | ||
| 2300 | |||
| 2301 | 295707 | break; | |
| 2302 | } | ||
| 2303 | |||
| 2304 |
6/6✓ Branch 0 taken 564513 times.
✓ Branch 1 taken 455107 times.
✓ Branch 2 taken 551808 times.
✓ Branch 3 taken 12705 times.
✓ Branch 4 taken 234637 times.
✓ Branch 5 taken 317171 times.
|
1019620 | if(game->get_canslash() && itemsbuf[itemid].flags & item_flag4 && attackclk<11) |
| 2305 | { | ||
| 2306 | 317171 | int32_t wpn2=itemsbuf[itemid].wpn2; | |
| 2307 | 317171 | wpn2=vbound(wpn2, 0, MAXWPNS); | |
| 2308 | |||
| 2309 | //slashing tiles | ||
| 2310 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 55871 times.
✓ Branch 2 taken 70857 times.
✓ Branch 3 taken 99575 times.
✓ Branch 4 taken 90868 times.
|
317171 | switch(dir) |
| 2311 | { | ||
| 2312 | case up: | ||
| 2313 | 55871 | wx=15; | |
| 2314 | 55871 | wy=-3; | |
| 2315 | 55871 | ++t; | |
| 2316 | 55871 | f=0; //starts pointing right | |
| 2317 | |||
| 2318 |
2/2✓ Branch 0 taken 25486 times.
✓ Branch 1 taken 30385 times.
|
55871 | if(attackclk>=7) |
| 2319 | { | ||
| 2320 | 30385 | wy-=9; | |
| 2321 | 30385 | wx-=3; | |
| 2322 | 30385 | t = wpnsbuf[wpn2].tile; | |
| 2323 | 30385 | cs2 = wpnsbuf[wpn2].csets&15; | |
| 2324 | 30385 | f=0; | |
| 2325 | 30385 | } | |
| 2326 | |||
| 2327 | 55871 | break; | |
| 2328 | |||
| 2329 | case down: | ||
| 2330 | 70857 | wx=-13; | |
| 2331 | 70857 | wy=-1; | |
| 2332 | 70857 | ++t; | |
| 2333 | 70857 | f=1; //starts pointing left | |
| 2334 | |||
| 2335 |
2/2✓ Branch 0 taken 30648 times.
✓ Branch 1 taken 40209 times.
|
70857 | if(attackclk>=7) |
| 2336 | { | ||
| 2337 | 40209 | wy+=15; | |
| 2338 | 40209 | wx+=2; | |
| 2339 | 40209 | t = wpnsbuf[wpn2].tile; | |
| 2340 | 40209 | cs2 = wpnsbuf[wpn2].csets&15; | |
| 2341 | 40209 | ++t; | |
| 2342 | 40209 | f=0; | |
| 2343 | 40209 | } | |
| 2344 | |||
| 2345 | 70857 | break; | |
| 2346 | |||
| 2347 | case left: | ||
| 2348 | 99575 | wx=3; | |
| 2349 | 99575 | wy=-15; | |
| 2350 | 99575 | --t; | |
| 2351 | 99575 | f=0; //starts pointing up | |
| 2352 | |||
| 2353 |
2/2✓ Branch 0 taken 42111 times.
✓ Branch 1 taken 57464 times.
|
99575 | if(attackclk>=7) |
| 2354 | { | ||
| 2355 | 57464 | wx-=15; | |
| 2356 | 57464 | wy+=3; | |
| 2357 | 57464 | slashxofs-=1; | |
| 2358 | 57464 | t = wpnsbuf[wpn2].tile; | |
| 2359 | 57464 | cs2 = wpnsbuf[wpn2].csets&15; | |
| 2360 | 57464 | t+=2; | |
| 2361 | 57464 | f=0; | |
| 2362 | 57464 | } | |
| 2363 | |||
| 2364 | 99575 | break; | |
| 2365 | |||
| 2366 | case right: | ||
| 2367 | 90868 | --t; | |
| 2368 | |||
| 2369 |
3/4✓ Branch 0 taken 90371 times.
✓ Branch 1 taken 497 times.
✓ Branch 2 taken 90371 times.
✗ Branch 3 not taken.
|
90868 | if(spins>0 || (itemsbuf[itemid].flags & item_flag8)) |
| 2370 | { | ||
| 2371 | 497 | wx=1; | |
| 2372 | 497 | wy=13; | |
| 2373 | 497 | f=2; | |
| 2374 | 497 | } | |
| 2375 | else | ||
| 2376 | { | ||
| 2377 | 90371 | wx=3; | |
| 2378 | 90371 | wy=-15; | |
| 2379 | 90371 | f=0; | |
| 2380 | } | ||
| 2381 | |||
| 2382 |
2/2✓ Branch 0 taken 38748 times.
✓ Branch 1 taken 52120 times.
|
90868 | if(attackclk>=7) |
| 2383 | { | ||
| 2384 | 52120 | wx+=15; | |
| 2385 | 52120 | slashxofs+=1; | |
| 2386 | 52120 | t = wpnsbuf[wpn2].tile; | |
| 2387 | 52120 | cs2 = wpnsbuf[wpn2].csets&15; | |
| 2388 | |||
| 2389 |
3/4✓ Branch 0 taken 51789 times.
✓ Branch 1 taken 331 times.
✓ Branch 2 taken 51789 times.
✗ Branch 3 not taken.
|
52120 | if(spins>0 || (itemsbuf[itemid].flags & item_flag8)) |
| 2390 | { | ||
| 2391 | 331 | wx-=1; | |
| 2392 | 331 | wy-=2; | |
| 2393 | 331 | } | |
| 2394 | else | ||
| 2395 | { | ||
| 2396 | 51789 | t+=3; | |
| 2397 | 51789 | f=0; | |
| 2398 | 51789 | wy+=3; | |
| 2399 | } | ||
| 2400 | 52120 | } | |
| 2401 | |||
| 2402 | 90868 | break; | |
| 2403 | } | ||
| 2404 | 317171 | } | |
| 2405 | |||
| 2406 | 1019620 | int32_t itemid2 = current_item_id(itype_chargering); | |
| 2407 | |||
| 2408 |
4/4✓ Branch 0 taken 28541 times.
✓ Branch 1 taken 991079 times.
✓ Branch 2 taken 1005124 times.
✓ Branch 3 taken 14496 times.
|
1019620 | if(charging>(itemid2>=0 ? itemsbuf[itemid2].misc1 : 64)) |
| 2409 | { | ||
| 2410 |
2/2✓ Branch 0 taken 13964 times.
✓ Branch 1 taken 532 times.
|
14496 | cs2=(BSZ ? (frame&3)+6 : ((frame>>2)&1)+7); |
| 2411 | 14496 | } | |
| 2412 | |||
| 2413 | 1019620 | w->x = x+wx; | |
| 2414 | 1019620 | w->y = y+wy-(original_playing_field_offset-2-(yofs+slashyofs))-fakez; | |
| 2415 | 1019620 | w->z = (z+zofs); | |
| 2416 | 1019620 | w->tile = t; | |
| 2417 | 1019620 | w->flip = f; | |
| 2418 | 1019620 | w->power = weaponattackpower(itemid); | |
| 2419 | 1019620 | w->dir = dir; | |
| 2420 | 1019620 | w->doAutoRotate(true); | |
| 2421 | 1019620 | } | |
| 2422 | |||
| 2423 | 748965 | int HeroClass::getHammerState() const | |
| 2424 | { | ||
| 2425 |
2/2✓ Branch 0 taken 106416 times.
✓ Branch 1 taken 642549 times.
|
748965 | if(attack == wHammer) |
| 2426 | { | ||
| 2427 |
2/2✓ Branch 0 taken 212853 times.
✓ Branch 1 taken 429696 times.
|
642549 | if(attackclk >= 15) |
| 2428 | 212853 | return 3; | |
| 2429 |
2/2✓ Branch 0 taken 14304 times.
✓ Branch 1 taken 415392 times.
|
429696 | if(attackclk >= 13) |
| 2430 | 14304 | return 2; | |
| 2431 | 415392 | return 1; | |
| 2432 | } | ||
| 2433 | 106416 | return 0; | |
| 2434 | 748965 | } | |
| 2435 | 1162680 | weapon* find_first_wtype(int wtype) | |
| 2436 | { | ||
| 2437 |
2/2✓ Branch 0 taken 1379309 times.
✓ Branch 1 taken 92921 times.
|
1472230 | for(int32_t i=0; i<Lwpns.Count(); i++) |
| 2438 | { | ||
| 2439 | 1379309 | weapon* w = (weapon*)Lwpns.spr(i); | |
| 2440 | |||
| 2441 |
2/2✓ Branch 0 taken 1069759 times.
✓ Branch 1 taken 309550 times.
|
1379309 | if(w->id == wtype) |
| 2442 | 1069759 | return w; | |
| 2443 | 309550 | } | |
| 2444 | 92921 | return nullptr; | |
| 2445 | 1162680 | } | |
| 2446 | 17553368 | void HeroClass::draw(BITMAP* dest) | |
| 2447 | { | ||
| 2448 | 17553368 | int32_t oxofs = xofs, oyofs = yofs; | |
| 2449 |
2/2✓ Branch 0 taken 86340 times.
✓ Branch 1 taken 17467028 times.
|
17553368 | bool invisible=(dontdraw>0) || (hero_scr->flags3&fINVISHERO); |
| 2450 | |||
| 2451 | { | ||
| 2452 |
2/2✓ Branch 0 taken 17932 times.
✓ Branch 1 taken 17535436 times.
|
17553368 | if(action==dying) |
| 2453 | { | ||
| 2454 |
2/2✓ Branch 0 taken 13534 times.
✓ Branch 1 taken 4398 times.
|
17932 | if(!invisible) |
| 2455 | { | ||
| 2456 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4398 times.
|
4398 | if ( script_hero_cset > -1 ) cs = script_hero_cset; |
| 2457 | 4398 | sprite::draw(dest); | |
| 2458 | 4398 | } | |
| 2459 | 17932 | goto herodraw_end; | |
| 2460 | } | ||
| 2461 | |||
| 2462 | 17535436 | bool useltm=(get_qr(qr_EXPANDEDLTM) != 0); | |
| 2463 | |||
| 2464 | |||
| 2465 |
2/2✓ Branch 0 taken 281508 times.
✓ Branch 1 taken 17253928 times.
|
17535436 | if(!invisible) |
| 2466 |
6/6✓ Branch 0 taken 7414945 times.
✓ Branch 1 taken 9838983 times.
✓ Branch 2 taken 4809023 times.
✓ Branch 3 taken 2605922 times.
✓ Branch 4 taken 183822 times.
✓ Branch 5 taken 4625201 times.
|
17253928 | yofs = oyofs-((!BSZ && isdungeon() && cur_screen<128 && !get_qr(qr_HERODUNGEONPOSFIX)) ? 2 : 0); |
| 2467 | |||
| 2468 | // Stone of Agony | ||
| 2469 | 17535436 | bool agony=false; | |
| 2470 | 17535436 | int32_t agonyid = current_item_id(itype_agony); | |
| 2471 | |||
| 2472 |
2/2✓ Branch 0 taken 281508 times.
✓ Branch 1 taken 17253928 times.
|
17535436 | if(!invisible) |
| 2473 | { | ||
| 2474 |
2/2✓ Branch 0 taken 308768 times.
✓ Branch 1 taken 16945160 times.
|
17253928 | if(agonyid>-1) |
| 2475 | { | ||
| 2476 | 308768 | int32_t power=itemsbuf[agonyid].power; | |
| 2477 | 308768 | int32_t left=static_cast<int32_t>(x+8-power)&0xF0; // Check top-left pixel of each tile | |
| 2478 | 308768 | int32_t right=(static_cast<int32_t>(x+8+power)&0xF0)+16; | |
| 2479 | 308768 | int32_t top=static_cast<int32_t>(y+(bigHitbox ? 8 : 12)-power)&0xF0; | |
| 2480 | 308768 | int32_t bottom=(static_cast<int32_t>(y+(bigHitbox ? 8 : 12)+power)&0xF0)+16; | |
| 2481 | |||
| 2482 |
2/2✓ Branch 0 taken 308768 times.
✓ Branch 1 taken 308768 times.
|
617536 | for(int32_t x=left; x<right; x+=16) |
| 2483 | { | ||
| 2484 |
2/2✓ Branch 0 taken 308768 times.
✓ Branch 1 taken 308768 times.
|
617536 | for(int32_t y=top; y<bottom; y+=16) |
| 2485 | { | ||
| 2486 |
2/4✓ Branch 0 taken 308768 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 308768 times.
✗ Branch 3 not taken.
|
308768 | if(agonyflag(MAPFLAG(x, y)) || agonyflag(MAPCOMBOFLAG(x, y))) |
| 2487 | { | ||
| 2488 | ✗ | agony=true; | |
| 2489 | ✗ | x=right; // Break out of outer loop | |
| 2490 | ✗ | break; | |
| 2491 | } | ||
| 2492 | 308768 | } | |
| 2493 | 308768 | } | |
| 2494 | 308768 | } | |
| 2495 | |||
| 2496 | 17253928 | cs = getFlashingCSet(); | |
| 2497 | 17253928 | } | |
| 2498 | |||
| 2499 |
5/6✓ Branch 0 taken 15727273 times.
✓ Branch 1 taken 1808163 times.
✓ Branch 2 taken 15713607 times.
✓ Branch 3 taken 13666 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 15713607 times.
|
17535436 | if(attackclk || (action==attacking||action==sideswimattacking)) |
| 2500 | { | ||
| 2501 | /* Spaghetti code constants! | ||
| 2502 | * - Hero.attack contains a weapon type... | ||
| 2503 | * - which must be converted to an itype... | ||
| 2504 | * - which must be converted to an item ID... | ||
| 2505 | * - which is used to acquire a wpn ID! Aack! | ||
| 2506 | */ | ||
| 2507 |
8/8✓ Branch 0 taken 33918 times.
✓ Branch 1 taken 1787911 times.
✓ Branch 2 taken 28 times.
✓ Branch 3 taken 1787883 times.
✓ Branch 4 taken 25729 times.
✓ Branch 5 taken 1762154 times.
✓ Branch 6 taken 70375 times.
✓ Branch 7 taken 1691779 times.
|
1821829 | int32_t itype = (attack==wFire ? itype_candle : attack==wCByrna ? itype_cbyrna : attack==wWand ? itype_wand : attack==wHammer ? itype_hammer : attack==wBugNet ? itype_bugnet : itype_sword); |
| 2508 |
4/4✓ Branch 0 taken 572211 times.
✓ Branch 1 taken 1189412 times.
✓ Branch 2 taken 331228 times.
✓ Branch 3 taken 240983 times.
|
1821829 | int32_t itemid = (directWpn>-1 && itemsbuf[directWpn].type==itype) ? directWpn : current_item_id(itype); |
| 2509 | 1761623 | itemid=vbound(itemid, 0, MAXITEMS-1); | |
| 2510 | // if ( itemsbuf[itemid].ScriptGenerated ) return; //t/b/a for script-generated swords. | ||
| 2511 |
8/8✓ Branch 0 taken 598843 times.
✓ Branch 1 taken 1162780 times.
✓ Branch 2 taken 598819 times.
✓ Branch 3 taken 24 times.
✓ Branch 4 taken 396263 times.
✓ Branch 5 taken 202556 times.
✓ Branch 6 taken 241446 times.
✓ Branch 7 taken 154817 times.
|
1761623 | if(attackclk>4||attack==wBugNet||(attack==wSword&&game->get_canslash())) |
| 2512 | { | ||
| 2513 |
2/2✓ Branch 0 taken 138 times.
✓ Branch 1 taken 1404112 times.
|
1404250 | if(attack == wBugNet) |
| 2514 | { | ||
| 2515 | 138 | weapon *w=NULL; | |
| 2516 | 138 | bool found = false; | |
| 2517 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 132 times.
|
138 | for(int32_t q = 0; q < Lwpns.Count(); ++q) |
| 2518 | { | ||
| 2519 | 132 | w = (weapon*)Lwpns.spr(q); | |
| 2520 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 132 times.
|
132 | if(w->id == wBugNet) |
| 2521 | { | ||
| 2522 | 132 | found = true; | |
| 2523 | 132 | break; | |
| 2524 | } | ||
| 2525 | ✗ | } | |
| 2526 |
2/2✓ Branch 0 taken 132 times.
✓ Branch 1 taken 6 times.
|
138 | if(!found) |
| 2527 | { | ||
| 2528 | // TODO(crash): check that .add succeeds. | ||
| 2529 |
5/10✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 6 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 6 times.
✗ Branch 9 not taken.
|
6 | Lwpns.add(new weapon((zfix)0,(zfix)0,(zfix)0,wBugNet,0,0,dir,itemid,getUID(),false,false,true)); |
| 2530 | |||
| 2531 | 6 | w = (weapon*)Lwpns.spr(Lwpns.Count()-1); | |
| 2532 | 6 | } | |
| 2533 | 138 | positionNet(w, itemid); | |
| 2534 | 138 | } | |
| 2535 |
8/8✓ Branch 0 taken 260320 times.
✓ Branch 1 taken 1143792 times.
✓ Branch 2 taken 241946 times.
✓ Branch 3 taken 18374 times.
✓ Branch 4 taken 223911 times.
✓ Branch 5 taken 18035 times.
✓ Branch 6 taken 241456 times.
✓ Branch 7 taken 1162656 times.
|
1404112 | else if((attack==wSword || attack==wWand || ((attack==wFire || attack==wCByrna) && itemsbuf[itemid].wpn)) && wpnsbuf[itemsbuf[itemid].wpn].tile) |
| 2536 | { | ||
| 2537 | // Create a sword weapon at the right spot. | ||
| 2538 | 1162656 | weapon *w=find_first_wtype(attack==wSword ? wSword : wWand); | |
| 2539 |
2/2✓ Branch 0 taken 1069735 times.
✓ Branch 1 taken 92921 times.
|
1162656 | if(!w) // Create one if sword nonexistant |
| 2540 | { | ||
| 2541 |
5/10✓ Branch 0 taken 92921 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 92921 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 92921 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 92921 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 92921 times.
✗ Branch 9 not taken.
|
92921 | Lwpns.add(new weapon((zfix)0,(zfix)0,(zfix)0,(attack==wSword ? wSword : wWand),0,0,dir,itemid,getUID(),false,false,true)); |
| 2542 | 92921 | w = (weapon*)Lwpns.spr(Lwpns.Count()-1); | |
| 2543 | |||
| 2544 | 92921 | positionSword(w,itemid); | |
| 2545 | |||
| 2546 | // Stone of Agony | ||
| 2547 |
1/2✓ Branch 0 taken 92921 times.
✗ Branch 1 not taken.
|
92921 | if(agony) |
| 2548 | { | ||
| 2549 | ✗ | w->y-=!(frame%zc_max(60-itemsbuf[agonyid].misc1,2))?1:0; | |
| 2550 | ✗ | } | |
| 2551 | 92921 | } | |
| 2552 | |||
| 2553 | // These are set by positionSword(), above or in checkstab() | ||
| 2554 | 1162656 | yofs += slashyofs; | |
| 2555 | 1162656 | xofs += slashxofs; | |
| 2556 | 1162656 | slashyofs = slashxofs = 0; | |
| 2557 | 1162656 | } | |
| 2558 | 1404250 | } | |
| 2559 | |||
| 2560 | 1761725 | if(attackclk<7 | |
| 2561 |
4/4✓ Branch 0 taken 968311 times.
✓ Branch 1 taken 793312 times.
✓ Branch 2 taken 773245 times.
✓ Branch 3 taken 195066 times.
|
1761623 | || (attack==wSword && ((attackclk<(game->get_canslash()?15:13) |
| 2562 |
4/6✓ Branch 0 taken 145259 times.
✓ Branch 1 taken 627986 times.
✓ Branch 2 taken 145259 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 145259 times.
|
773245 | || FIXED_Z3_ANIMATION && attackclk<(game->get_canslash()?16:12)) |
| 2563 |
2/2✓ Branch 0 taken 44402 times.
✓ Branch 1 taken 100857 times.
|
145259 | || (charging>0 && attackclk!=SWORDCHARGEFRAME))) |
| 2564 |
4/4✓ Branch 0 taken 321035 times.
✓ Branch 1 taken 27974 times.
✓ Branch 2 taken 307378 times.
✓ Branch 3 taken 13657 times.
|
340325 | || ((attack==wWand || attack==wFire || attack==wCByrna) && attackclk<13) |
| 2565 |
4/4✓ Branch 0 taken 35078 times.
✓ Branch 1 taken 313931 times.
✓ Branch 2 taken 55717 times.
✓ Branch 3 taken 258214 times.
|
349009 | || (attack==wHammer && attackclk<=30) |
| 2566 |
2/2✓ Branch 0 taken 102 times.
✓ Branch 1 taken 258112 times.
|
313931 | || (attack==wBugNet && attackclk<NET_CLK_TOTAL)) |
| 2567 | { | ||
| 2568 |
2/2✓ Branch 0 taken 354 times.
✓ Branch 1 taken 1556243 times.
|
1556597 | if(!invisible) |
| 2569 | { | ||
| 2570 | 1556243 | herotile(&tile, &flip, &extend, (IsSideSwim())?ls_sideswimstab:ls_stab, dir, zinit.heroAnimationStyle); | |
| 2571 |
2/4✓ Branch 0 taken 1556243 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1556243 times.
✗ Branch 3 not taken.
|
1556243 | if (FIXED_Z3_ANIMATION) |
| 2572 | { | ||
| 2573 | ✗ | if (attackclk >= 2) tile += (extend==2?2:1); | |
| 2574 | ✗ | if (attackclk >= 13) tile += (extend==2?2:1); | |
| 2575 | ✗ | } | |
| 2576 | |||
| 2577 |
14/18✓ Branch 0 taken 818795 times.
✓ Branch 1 taken 737448 times.
✓ Branch 2 taken 172520 times.
✓ Branch 3 taken 646275 times.
✓ Branch 4 taken 161639 times.
✓ Branch 5 taken 10881 times.
✓ Branch 6 taken 152119 times.
✓ Branch 7 taken 9520 times.
✓ Branch 8 taken 641944 times.
✓ Branch 9 taken 176851 times.
✓ Branch 10 taken 363531 times.
✓ Branch 11 taken 278413 times.
✓ Branch 12 taken 363531 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 363531 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
1556243 | if(((game->get_canslash() && (attack==wSword || attack==wWand || attack==wFire || attack==wCByrna)) && itemsbuf[itemid].flags&item_flag4 && (attackclk<7||FIXED_Z3_ANIMATION&&(attackclk < 16)))) |
| 2578 | { | ||
| 2579 | 278413 | herotile(&tile, &flip, &extend, (IsSideSwim())?ls_sideswimslash:ls_slash, dir, zinit.heroAnimationStyle); | |
| 2580 |
2/4✓ Branch 0 taken 278413 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 278413 times.
✗ Branch 3 not taken.
|
278413 | if (FIXED_Z3_ANIMATION) |
| 2581 | { | ||
| 2582 | ✗ | if (attackclk >= 7) tile += (extend==2?2:1); | |
| 2583 | ✗ | if (attackclk >= 11) tile += (extend==2?2:1); | |
| 2584 | ✗ | if (attackclk >= 14) tile += (extend==2?2:1); | |
| 2585 | ✗ | } | |
| 2586 | 278413 | } | |
| 2587 |
3/4✓ Branch 0 taken 138 times.
✓ Branch 1 taken 1556105 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 138 times.
|
1556243 | if (attack==wBugNet && !get_qr(qr_OLD_BUG_NET)) |
| 2588 | { | ||
| 2589 |
6/6✓ Branch 0 taken 38 times.
✓ Branch 1 taken 100 times.
✓ Branch 2 taken 100 times.
✓ Branch 3 taken 76 times.
✓ Branch 4 taken 100 times.
✓ Branch 5 taken 76 times.
|
138 | if ((dir == right && (itemsbuf[itemid].flags&item_flag2)) || (dir != right && !(itemsbuf[itemid].flags&item_flag2))) |
| 2590 | { | ||
| 2591 |
2/2✓ Branch 0 taken 68 times.
✓ Branch 1 taken 32 times.
|
100 | if (attackclk < 9) herotile(&tile, &flip, &extend, ls_revslash, dir, zinit.heroAnimationStyle); |
| 2592 |
2/2✓ Branch 0 taken 60 times.
✓ Branch 1 taken 40 times.
|
100 | if (attackclk > 15) herotile(&tile, &flip, &extend, (IsSideSwim())?ls_sideswimslash:ls_slash, dir, zinit.heroAnimationStyle); |
| 2593 | 100 | } | |
| 2594 | else | ||
| 2595 | { | ||
| 2596 |
2/2✓ Branch 0 taken 22 times.
✓ Branch 1 taken 16 times.
|
176 | if (attackclk < 9) herotile(&tile, &flip, &extend, (IsSideSwim())?ls_sideswimslash:ls_slash, dir, zinit.heroAnimationStyle); |
| 2597 |
2/2✓ Branch 0 taken 30 times.
✓ Branch 1 taken 8 times.
|
38 | if (attackclk > 15) herotile(&tile, &flip, &extend, ls_revslash, dir, zinit.heroAnimationStyle); |
| 2598 | } | ||
| 2599 | 138 | } | |
| 2600 | |||
| 2601 |
4/4✓ Branch 0 taken 70375 times.
✓ Branch 1 taken 1485868 times.
✓ Branch 2 taken 40389 times.
✓ Branch 3 taken 29986 times.
|
1556243 | if((attack==wHammer) && (attackclk<13)) |
| 2602 | { | ||
| 2603 | 29986 | herotile(&tile, &flip, &extend, (IsSideSwim())?ls_sideswimpound:ls_pound, dir, zinit.heroAnimationStyle); | |
| 2604 |
2/4✓ Branch 0 taken 29986 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 29986 times.
✗ Branch 3 not taken.
|
29986 | if (FIXED_Z3_ANIMATION) |
| 2605 | { | ||
| 2606 | ✗ | if (attackclk >= 14) tile += (extend==2?2:1); | |
| 2607 | ✗ | if (attackclk >= 16) tile += (extend==2?2:1); | |
| 2608 | ✗ | } | |
| 2609 | 29986 | } | |
| 2610 | |||
| 2611 |
2/2✓ Branch 0 taken 987175 times.
✓ Branch 1 taken 569068 times.
|
1556243 | if(useltm) |
| 2612 | { | ||
| 2613 |
2/2✓ Branch 0 taken 1885 times.
✓ Branch 1 taken 567183 times.
|
569068 | if ( script_hero_sprite <= 0 ) tile+=getTileModifier(); |
| 2614 | 569068 | } | |
| 2615 | |||
| 2616 | // Stone of Agony | ||
| 2617 |
1/2✓ Branch 0 taken 1556243 times.
✗ Branch 1 not taken.
|
1556243 | if(agony) |
| 2618 | { | ||
| 2619 | ✗ | yofs-=!(frame%zc_max(60-itemsbuf[agonyid].misc1,3))?1:0; | |
| 2620 | ✗ | } | |
| 2621 | |||
| 2622 | //Probably what makes Hero flicker, except for the QR check. What makes him flicker when that rule is off?! -Z | ||
| 2623 | |||
| 2624 | //I'm pretty sure he doesn't flicker when the rule is off. Also, take note of the parenthesis after the ! in this if statement; I was blind and didn't see it, and thought this code did something completely different. -Deedee | ||
| 2625 |
2/2✓ Branch 0 taken 12487 times.
✓ Branch 1 taken 1543756 times.
|
1556243 | if (is_hitflickerframe()) |
| 2626 | { | ||
| 2627 |
4/6✓ Branch 0 taken 2 times.
✓ Branch 1 taken 12485 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 12485 times.
|
12487 | int32_t temp_flicker_color = (game->get_life() > 0 || immortal) ? (flickercolor < 0 ? game->get_spriteflickercolor() : flickercolor) : 0; |
| 2628 |
2/4✓ Branch 0 taken 12487 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 12487 times.
✗ Branch 3 not taken.
|
12487 | if((game->get_spriteflickercolor() || temp_flicker_color) && !superman) |
| 2629 | { | ||
| 2630 | ✗ | sprite_flicker_transp_passes = (flickertransp < 0 ? game->get_spriteflickertransp() : flickertransp); | |
| 2631 | ✗ | sprite_flicker_color = temp_flicker_color; | |
| 2632 | ✗ | masked_draw(dest); | |
| 2633 | ✗ | } | |
| 2634 | 12487 | } | |
| 2635 | else | ||
| 2636 | 1543756 | masked_draw(dest); | |
| 2637 | |||
| 2638 | //Prevent flickering -Z | ||
| 2639 |
1/2✓ Branch 0 taken 1556243 times.
✗ Branch 1 not taken.
|
1556243 | if (!getCanFlicker()) masked_draw(dest); |
| 2640 | 1556243 | } | |
| 2641 | |||
| 2642 |
2/2✓ Branch 0 taken 1486222 times.
✓ Branch 1 taken 70375 times.
|
1556597 | if(attack!=wHammer) |
| 2643 | 1486222 | goto herodraw_end; | |
| 2644 | 70375 | } | |
| 2645 | |||
| 2646 |
2/2✓ Branch 0 taken 70375 times.
✓ Branch 1 taken 258112 times.
|
328487 | if(attack==wHammer) // To do: possibly abstract this out to a positionHammer routine? |
| 2647 | { | ||
| 2648 | 70375 | int32_t wy=1; | |
| 2649 | 70375 | int32_t wx=1; | |
| 2650 | 70375 | int32_t f=0,t,cs2; | |
| 2651 | 70375 | weapon *w=NULL; | |
| 2652 | 70375 | bool found = false; | |
| 2653 | |||
| 2654 |
2/2✓ Branch 0 taken 2417 times.
✓ Branch 1 taken 70138 times.
|
72555 | for(int32_t i=0; i<Lwpns.Count(); i++) |
| 2655 | { | ||
| 2656 | 70138 | w = (weapon*)Lwpns.spr(i); | |
| 2657 | |||
| 2658 |
2/2✓ Branch 0 taken 2180 times.
✓ Branch 1 taken 67958 times.
|
70138 | if(w->id == wHammer) |
| 2659 | { | ||
| 2660 | 67958 | found = true; | |
| 2661 | 67958 | break; | |
| 2662 | } | ||
| 2663 | 2180 | } | |
| 2664 | |||
| 2665 |
2/2✓ Branch 0 taken 67958 times.
✓ Branch 1 taken 2417 times.
|
70375 | if(!found) |
| 2666 | { | ||
| 2667 |
5/10✓ Branch 0 taken 2417 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2417 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2417 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2417 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2417 times.
✗ Branch 9 not taken.
|
2417 | Lwpns.add(new weapon((zfix)0,(zfix)0,(zfix)0,wHammer,0,0,dir,itemid,getUID(),false,false,true)); |
| 2668 | 2417 | w = (weapon*)Lwpns.spr(Lwpns.Count()-1); | |
| 2669 | 2417 | found = true; | |
| 2670 | 2417 | } | |
| 2671 | |||
| 2672 | 70375 | t = w->o_tile; | |
| 2673 | 70375 | cs2 = w->o_cset; | |
| 2674 | |||
| 2675 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 12288 times.
✓ Branch 2 taken 15937 times.
✓ Branch 3 taken 22753 times.
✓ Branch 4 taken 19397 times.
|
70375 | switch(dir) |
| 2676 | { | ||
| 2677 | case up: | ||
| 2678 | 12288 | wx=-1; | |
| 2679 | 12288 | wy=-15; | |
| 2680 |
1/2✓ Branch 0 taken 12288 times.
✗ Branch 1 not taken.
|
12288 | if (IsSideSwim())wy+=hammer_swim_up_offset; |
| 2681 | |||
| 2682 |
2/2✓ Branch 0 taken 5593 times.
✓ Branch 1 taken 6695 times.
|
12288 | if(attackclk>=13) |
| 2683 | { | ||
| 2684 | 6695 | wx-=1; | |
| 2685 | 6695 | wy+=1; | |
| 2686 | 6695 | ++t; | |
| 2687 | 6695 | } | |
| 2688 | |||
| 2689 |
2/2✓ Branch 0 taken 6348 times.
✓ Branch 1 taken 5940 times.
|
12288 | if(attackclk>=15) |
| 2690 | { | ||
| 2691 |
1/2✓ Branch 0 taken 5940 times.
✗ Branch 1 not taken.
|
5940 | if (IsSideSwim())wy-=hammer_swim_up_offset; |
| 2692 | 5940 | ++t; | |
| 2693 | 5940 | } | |
| 2694 | |||
| 2695 | 12288 | break; | |
| 2696 | |||
| 2697 | case down: | ||
| 2698 | 15937 | wx=3; | |
| 2699 | 15937 | wy=-14; | |
| 2700 |
1/2✓ Branch 0 taken 15937 times.
✗ Branch 1 not taken.
|
15937 | if (IsSideSwim())wy+=hammer_swim_down_offset; |
| 2701 | 15937 | t+=3; | |
| 2702 | |||
| 2703 |
2/2✓ Branch 0 taken 6683 times.
✓ Branch 1 taken 9254 times.
|
15937 | if(attackclk>=13) |
| 2704 | { | ||
| 2705 | 9254 | wy+=16; | |
| 2706 | 9254 | ++t; | |
| 2707 | 9254 | } | |
| 2708 | |||
| 2709 |
2/2✓ Branch 0 taken 7750 times.
✓ Branch 1 taken 8187 times.
|
15937 | if(attackclk>=15) |
| 2710 | { | ||
| 2711 | 8187 | wx-=1; | |
| 2712 | 8187 | wy+=12; | |
| 2713 |
1/2✓ Branch 0 taken 8187 times.
✗ Branch 1 not taken.
|
8187 | if (IsSideSwim())wy-=hammer_swim_down_offset; |
| 2714 | 8187 | ++t; | |
| 2715 | 8187 | } | |
| 2716 | |||
| 2717 | 15937 | break; | |
| 2718 | |||
| 2719 | case left: | ||
| 2720 | 22753 | wx=0; | |
| 2721 | 22753 | wy=-14; | |
| 2722 |
1/2✓ Branch 0 taken 22753 times.
✗ Branch 1 not taken.
|
22753 | if (IsSideSwim())wy+=hammer_swim_left_offset; |
| 2723 | 22753 | t+=6; | |
| 2724 | 22753 | f=1; | |
| 2725 | |||
| 2726 |
2/2✓ Branch 0 taken 9653 times.
✓ Branch 1 taken 13100 times.
|
22753 | if(attackclk>=13) |
| 2727 | { | ||
| 2728 | 13100 | wx-=7; | |
| 2729 | 13100 | wy+=8; | |
| 2730 | 13100 | ++t; | |
| 2731 | 13100 | } | |
| 2732 | |||
| 2733 |
2/2✓ Branch 0 taken 11155 times.
✓ Branch 1 taken 11598 times.
|
22753 | if(attackclk>=15) |
| 2734 | { | ||
| 2735 | 11598 | wx-=8; | |
| 2736 | 11598 | wy+=8; | |
| 2737 |
1/2✓ Branch 0 taken 11598 times.
✗ Branch 1 not taken.
|
11598 | if (IsSideSwim())wy-=hammer_swim_left_offset; |
| 2738 | 11598 | ++t; | |
| 2739 | 11598 | } | |
| 2740 | |||
| 2741 | 22753 | break; | |
| 2742 | |||
| 2743 | case right: | ||
| 2744 | 19397 | wx=0; | |
| 2745 | 19397 | wy=-14; | |
| 2746 |
1/2✓ Branch 0 taken 19397 times.
✗ Branch 1 not taken.
|
19397 | if (IsSideSwim())wy+=hammer_swim_right_offset; |
| 2747 | 19397 | t+=6; | |
| 2748 | |||
| 2749 |
2/2✓ Branch 0 taken 8057 times.
✓ Branch 1 taken 11340 times.
|
19397 | if(attackclk>=13) |
| 2750 | { | ||
| 2751 | 11340 | wx+=7; | |
| 2752 | 11340 | wy+=8; | |
| 2753 | 11340 | ++t; | |
| 2754 | 11340 | } | |
| 2755 | |||
| 2756 |
2/2✓ Branch 0 taken 9332 times.
✓ Branch 1 taken 10065 times.
|
19397 | if(attackclk>=15) |
| 2757 | { | ||
| 2758 | 10065 | wx+=8; | |
| 2759 | 10065 | wy+=8; | |
| 2760 |
1/2✓ Branch 0 taken 10065 times.
✗ Branch 1 not taken.
|
10065 | if (IsSideSwim())wy-=hammer_swim_right_offset; |
| 2761 | 10065 | ++t; | |
| 2762 | 10065 | } | |
| 2763 | |||
| 2764 | 19397 | break; | |
| 2765 | } | ||
| 2766 | |||
| 2767 |
7/8✓ Branch 0 taken 28062 times.
✓ Branch 1 taken 42313 times.
✓ Branch 2 taken 20878 times.
✓ Branch 3 taken 7184 times.
✓ Branch 4 taken 20878 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 4720 times.
✓ Branch 7 taken 16158 times.
|
70375 | if(BSZ || ((isdungeon() && cur_screen<128) && !get_qr(qr_HERODUNGEONPOSFIX))) |
| 2768 | { | ||
| 2769 | 58471 | wy+=2; | |
| 2770 | 58471 | } | |
| 2771 | |||
| 2772 | // Stone of Agony | ||
| 2773 |
1/2✓ Branch 0 taken 70375 times.
✗ Branch 1 not taken.
|
70375 | if(agony) |
| 2774 | { | ||
| 2775 | ✗ | wy-=!(frame%zc_max(60-itemsbuf[agonyid].misc1,3))?1:0; | |
| 2776 | ✗ | } | |
| 2777 | |||
| 2778 | 70375 | w->x = x+wx; | |
| 2779 | 70375 | w->y = y+wy-(original_playing_field_offset-2-yofs)-fakez; | |
| 2780 | 70375 | w->z = (z+zofs); | |
| 2781 | 70375 | w->tile = t; | |
| 2782 | 70375 | w->flip = f; | |
| 2783 | 70375 | w->hit_width=20; | |
| 2784 | 70375 | w->hit_height=20; | |
| 2785 | |||
| 2786 |
2/2✓ Branch 0 taken 42150 times.
✓ Branch 1 taken 28225 times.
|
70375 | if(dir>down) |
| 2787 | { | ||
| 2788 | 42150 | w->hit_height-=6; | |
| 2789 | 42150 | } | |
| 2790 | else | ||
| 2791 | { | ||
| 2792 | 28225 | w->hit_width-=6; | |
| 2793 | 28225 | w->hyofs=4; | |
| 2794 | } | ||
| 2795 | |||
| 2796 | 70375 | w->power = weaponattackpower(itemid); | |
| 2797 | |||
| 2798 |
7/10✓ Branch 0 taken 2273 times.
✓ Branch 1 taken 68102 times.
✓ Branch 2 taken 2273 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2273 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 5 times.
✓ Branch 7 taken 2268 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 5 times.
|
70375 | if(attackclk==15 && z==0 && fakez==0 && (sideviewhammerpound() || !isSideViewHero())) |
| 2799 | { | ||
| 2800 |
3/4✓ Branch 0 taken 2261 times.
✓ Branch 1 taken 12 times.
✓ Branch 2 taken 2273 times.
✗ Branch 3 not taken.
|
2273 | sfx(((iswaterex_z3(MAPCOMBO(x+wx+8,y+wy), -1, x+wx+8, y+wy, true) || COMBOTYPE(x+wx+8,y+wy)==cSHALLOWWATER) && get_qr(qr_MORESOUNDS)) ? WAV_ZN1SPLASH : itemsbuf[itemid].usesound,pan(x)); |
| 2801 | 2273 | } | |
| 2802 | |||
| 2803 | 70375 | goto herodraw_end; | |
| 2804 | } | ||
| 2805 | 258112 | } | |
| 2806 |
2/4✓ Branch 0 taken 15713607 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 15713607 times.
|
15713607 | else if(!charging && !spins) // remove the sword |
| 2807 | { | ||
| 2808 |
2/2✓ Branch 0 taken 4214043 times.
✓ Branch 1 taken 15713607 times.
|
19927650 | for(int32_t i=0; i<Lwpns.Count(); i++) |
| 2809 | { | ||
| 2810 | 4214043 | weapon *w = (weapon*)Lwpns.spr(i); | |
| 2811 | |||
| 2812 |
6/6✓ Branch 0 taken 4213146 times.
✓ Branch 1 taken 897 times.
✓ Branch 2 taken 4203697 times.
✓ Branch 3 taken 9449 times.
✓ Branch 4 taken 31846 times.
✓ Branch 5 taken 4171851 times.
|
4214043 | if(w->id == wSword || w->id == wHammer || w->id==wWand) |
| 2813 | 42192 | w->dead=1; | |
| 2814 | 4214043 | } | |
| 2815 | 15713607 | } | |
| 2816 | |||
| 2817 |
2/2✓ Branch 0 taken 274034 times.
✓ Branch 1 taken 15697685 times.
|
15971719 | if(invisible) |
| 2818 | { | ||
| 2819 | 274034 | goto herodraw_end; | |
| 2820 | } | ||
| 2821 | |||
| 2822 |
3/4✓ Branch 0 taken 15694838 times.
✓ Branch 1 taken 2847 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 15694838 times.
|
15697685 | if(action != casting && action != sideswimcasting) |
| 2823 | { | ||
| 2824 | // Keep this consistent with checkspecial2, line 7800-ish... | ||
| 2825 |
6/6✓ Branch 0 taken 304188 times.
✓ Branch 1 taken 15390650 times.
✓ Branch 2 taken 293586 times.
✓ Branch 3 taken 10602 times.
✓ Branch 4 taken 11582 times.
✓ Branch 5 taken 282004 times.
|
15694838 | bool inwater = iswaterex_z3(MAPCOMBO(x+4,y+9), -1, x+4, y+9, true, false) && iswaterex_z3(MAPCOMBO(x+4,y+15), -1, x+4, y+15, true, false) && iswaterex_z3(MAPCOMBO(x+11,y+9), -1, x+11, y+9, true, false) && iswaterex_z3(MAPCOMBO(x+11,y+15), -1, x+11, y+15, true, false); |
| 2826 | |||
| 2827 | 15694838 | optional<uint32_t> jumping_frame; | |
| 2828 | |||
| 2829 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 15694838 times.
|
15694838 | if (get_qr(qr_BETTER_PLAYER_JUMP_ANIM)) |
| 2830 | { | ||
| 2831 | ✗ | if (jumping && fall) | |
| 2832 | ✗ | jumping_frame = (jumping / 6) % 3; | |
| 2833 | ✗ | } | |
| 2834 | else | ||
| 2835 | { | ||
| 2836 | 15694838 | auto val = int32_t(jumping * (get_grav_fall() / 16.0)); | |
| 2837 |
4/4✓ Branch 0 taken 128628 times.
✓ Branch 1 taken 15566210 times.
✓ Branch 2 taken 25684 times.
✓ Branch 3 taken 102944 times.
|
15694838 | if (val > 0 && val < 24) |
| 2838 | 102944 | jumping_frame = val / 8; | |
| 2839 | } | ||
| 2840 | |||
| 2841 | 15694838 | bool noliftspr = get_qr(qr_NO_LIFT_SPRITE); | |
| 2842 | 15694838 | bool advancetile = script_hero_sprite <= 0; | |
| 2843 |
2/4✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 8530311 times.
✓ Branch 3 taken 7164527 times.
|
15694838 | switch(zinit.heroAnimationStyle) |
| 2844 | { | ||
| 2845 | case las_original: //normal | ||
| 2846 |
2/2✓ Branch 0 taken 3168 times.
✓ Branch 1 taken 8527143 times.
|
8530311 | if(action==drowning) |
| 2847 | { | ||
| 2848 |
1/2✓ Branch 0 taken 3168 times.
✗ Branch 1 not taken.
|
3168 | if(inwater) |
| 2849 | { | ||
| 2850 | 3168 | herotile(&tile, &flip, &extend, (drownclk > 60) ? ls_float : ls_drown, dir, zinit.heroAnimationStyle); | |
| 2851 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3168 times.
|
3168 | if(advancetile) tile+=((frame>>3) & 1)*(extend==2?2:1); |
| 2852 | 3168 | } | |
| 2853 | else | ||
| 2854 | { | ||
| 2855 | ✗ | goto herodraw_end; | |
| 2856 | } | ||
| 2857 | 3168 | } | |
| 2858 |
2/2✓ Branch 0 taken 256 times.
✓ Branch 1 taken 8526887 times.
|
8527143 | else if(action==lavadrowning) |
| 2859 | { | ||
| 2860 | 256 | herotile(&tile, &flip, &extend, (drownclk > 60) ? ls_float : ls_lavadrown, dir, zinit.heroAnimationStyle); | |
| 2861 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 256 times.
|
256 | if(advancetile) tile+=((frame>>3) & 1)*(extend==2?2:1); |
| 2862 | 256 | } | |
| 2863 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8526887 times.
|
8526887 | else if(action==sidedrowning) |
| 2864 | { | ||
| 2865 | ✗ | herotile(&tile, &flip, &extend, ls_sidedrown, down, zinit.heroAnimationStyle); | |
| 2866 | ✗ | if(advancetile) tile+=((frame>>3) & 1)*(extend==2?2:1); | |
| 2867 | ✗ | } | |
| 2868 |
2/4✓ Branch 0 taken 8526887 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 8526887 times.
|
8526887 | else if (action == sideswimming || action == sideswimhit) |
| 2869 | { | ||
| 2870 | ✗ | herotile(&tile, &flip, &extend, ls_sideswim, dir, zinit.heroAnimationStyle); | |
| 2871 | |||
| 2872 | ✗ | if(lstep>=6) | |
| 2873 | { | ||
| 2874 | ✗ | if(dir==up) | |
| 2875 | { | ||
| 2876 | ✗ | if(advancetile) ++flip; | |
| 2877 | ✗ | } | |
| 2878 | else | ||
| 2879 | { | ||
| 2880 | ✗ | if(advancetile) extend==2?tile+=2:++tile; | |
| 2881 | } | ||
| 2882 | ✗ | } | |
| 2883 | ✗ | } | |
| 2884 |
5/6✓ Branch 0 taken 8432250 times.
✓ Branch 1 taken 94637 times.
✓ Branch 2 taken 8431429 times.
✓ Branch 3 taken 821 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 8431429 times.
|
8526887 | else if(action==swimming || action==swimhit || hopclk==0xFF) |
| 2885 | { | ||
| 2886 | 95458 | herotile(&tile, &flip, &extend, is_moving()?ls_swim:ls_float, dir, zinit.heroAnimationStyle); | |
| 2887 | |||
| 2888 |
2/2✓ Branch 0 taken 47669 times.
✓ Branch 1 taken 47789 times.
|
95458 | if(lstep>=6) |
| 2889 | { | ||
| 2890 |
2/2✓ Branch 0 taken 38014 times.
✓ Branch 1 taken 9775 times.
|
47789 | if(dir==up) |
| 2891 | { | ||
| 2892 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9775 times.
|
9775 | if(advancetile) ++flip; |
| 2893 | 9775 | } | |
| 2894 | else | ||
| 2895 | { | ||
| 2896 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 38014 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 38014 times.
|
38014 | if(advancetile) extend==2?tile+=2:++tile; |
| 2897 | } | ||
| 2898 | 47789 | } | |
| 2899 | |||
| 2900 |
2/2✓ Branch 0 taken 90255 times.
✓ Branch 1 taken 5203 times.
|
95458 | if(isDiving()) |
| 2901 | { | ||
| 2902 | 5203 | herotile(&tile, &flip, &extend, ls_dive, dir, zinit.heroAnimationStyle); | |
| 2903 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5203 times.
|
5203 | if(advancetile) tile+=((frame>>3) & 1)*(extend==2?2:1); |
| 2904 | 5203 | } | |
| 2905 | 95458 | } | |
| 2906 |
3/4✓ Branch 0 taken 1618 times.
✓ Branch 1 taken 8429811 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1618 times.
|
8431429 | else if(charging > 0 && attack != wHammer) |
| 2907 | { | ||
| 2908 | 1618 | herotile(&tile, &flip, &extend, (IsSideSwim())?ls_sideswimcharge:ls_charge, dir, zinit.heroAnimationStyle); | |
| 2909 | |||
| 2910 |
2/2✓ Branch 0 taken 943 times.
✓ Branch 1 taken 675 times.
|
1618 | if(lstep>=6) |
| 2911 | { | ||
| 2912 |
2/2✓ Branch 0 taken 531 times.
✓ Branch 1 taken 144 times.
|
675 | if(dir==up) |
| 2913 | { | ||
| 2914 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 144 times.
|
144 | if(advancetile) ++flip; |
| 2915 | 144 | } | |
| 2916 | else | ||
| 2917 | { | ||
| 2918 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 531 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 531 times.
|
531 | if(advancetile) extend==2?tile+=2:++tile; |
| 2919 | } | ||
| 2920 | 675 | } | |
| 2921 | 1618 | } | |
| 2922 |
7/10✓ Branch 0 taken 8429569 times.
✓ Branch 1 taken 242 times.
✓ Branch 2 taken 8429569 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 90047 times.
✓ Branch 5 taken 8339764 times.
✓ Branch 6 taken 90047 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 90047 times.
|
8429811 | else if ((z > 0 || fakez > 0 || isSideViewHero()) && jumping_frame && game->get_life() > 0 && action != rafting) |
| 2923 | { | ||
| 2924 | 90047 | herotile(&tile, &flip, &extend, ls_jump, dir, zinit.heroAnimationStyle); | |
| 2925 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 90047 times.
|
90047 | if (advancetile) tile += (*jumping_frame) * (extend == 2 ? 2 : 1); |
| 2926 | 90047 | } | |
| 2927 |
2/2✓ Branch 0 taken 1890 times.
✓ Branch 1 taken 8337874 times.
|
8339764 | else if(fallclk>0) |
| 2928 | { | ||
| 2929 | 1890 | herotile(&tile, &flip, &extend, ls_falling, dir, zinit.heroAnimationStyle); | |
| 2930 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1890 times.
|
1890 | if(advancetile) tile+=((PITFALL_FALL_FRAMES-fallclk)/10)*(extend==2?2:1); |
| 2931 | 1890 | } | |
| 2932 |
5/6✓ Branch 0 taken 419450 times.
✓ Branch 1 taken 7918424 times.
✓ Branch 2 taken 585 times.
✓ Branch 3 taken 418865 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 585 times.
|
8337874 | else if(!noliftspr&&action==lifting&&isLifting()) |
| 2933 | { | ||
| 2934 | 585 | herotile(&tile, &flip, &extend, ls_lifting, dir, zinit.heroAnimationStyle); | |
| 2935 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 585 times.
|
585 | if(script_hero_sprite <= 0) |
| 2936 | { | ||
| 2937 | 585 | auto frames = vbound(liftingspr[dir][spr_frames],1,255); | |
| 2938 | 585 | auto speed = tliftclk/frames; | |
| 2939 |
1/2✓ Branch 0 taken 585 times.
✗ Branch 1 not taken.
|
585 | if (speed < 1) speed = 1; |
| 2940 | 585 | auto curframe = (tliftclk - liftclk) / speed; | |
| 2941 |
1/2✓ Branch 0 taken 585 times.
✗ Branch 1 not taken.
|
585 | if (!tliftclk) curframe = frames - 1; |
| 2942 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 585 times.
|
585 | if(unsigned(curframe) < frames) |
| 2943 | 585 | tile += curframe * (extend == 2 ? 2 : 1); | |
| 2944 | 585 | } | |
| 2945 | 585 | } | |
| 2946 | else | ||
| 2947 | { | ||
| 2948 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8337289 times.
|
8337289 | if(IsSideSwim()) |
| 2949 | ✗ | herotile(&tile, &flip, &extend, ls_sideswim, dir, zinit.heroAnimationStyle); | |
| 2950 | else | ||
| 2951 | { | ||
| 2952 |
4/4✓ Branch 0 taken 418865 times.
✓ Branch 1 taken 7918424 times.
✓ Branch 2 taken 410269 times.
✓ Branch 3 taken 8596 times.
|
8337289 | if(!noliftspr&&isLifting()) |
| 2953 | 8596 | herotile(&tile, &flip, &extend, ls_liftwalk, dir, zinit.heroAnimationStyle); | |
| 2954 | 8328693 | else herotile(&tile, &flip, &extend, ls_walk, dir, zinit.heroAnimationStyle); | |
| 2955 | } | ||
| 2956 | |||
| 2957 |
2/2✓ Branch 0 taken 2146869 times.
✓ Branch 1 taken 6190420 times.
|
8337289 | if(dir>up) |
| 2958 | { | ||
| 2959 | 6190420 | useltm=true; | |
| 2960 | 6190420 | } | |
| 2961 | |||
| 2962 |
3/4✓ Branch 0 taken 8337289 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4060413 times.
✓ Branch 3 taken 4276876 times.
|
8337289 | if(advancetile && lstep>=6) |
| 2963 | { | ||
| 2964 |
2/2✓ Branch 0 taken 3184241 times.
✓ Branch 1 taken 1092635 times.
|
4276876 | if(dir==up) |
| 2965 | { | ||
| 2966 | 1092635 | ++flip; | |
| 2967 | 1092635 | } | |
| 2968 | else | ||
| 2969 | { | ||
| 2970 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3184241 times.
|
3184241 | extend==2?tile+=2:++tile; |
| 2971 | } | ||
| 2972 | 4276876 | } | |
| 2973 | } | ||
| 2974 | |||
| 2975 | 8530311 | break; | |
| 2976 | |||
| 2977 | case las_bszelda: //BS | ||
| 2978 |
2/2✓ Branch 0 taken 4288 times.
✓ Branch 1 taken 7160239 times.
|
7164527 | if(action==drowning) |
| 2979 | { | ||
| 2980 |
1/2✓ Branch 0 taken 4288 times.
✗ Branch 1 not taken.
|
4288 | if(inwater) |
| 2981 | { | ||
| 2982 | 4288 | herotile(&tile, &flip, &extend, (drownclk > 60) ? ls_float : ls_drown, dir, zinit.heroAnimationStyle); | |
| 2983 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4288 times.
|
4288 | if(advancetile) tile += anim_3_4(lstep,7)*(extend==2?2:1); |
| 2984 | 4288 | } | |
| 2985 | else | ||
| 2986 | { | ||
| 2987 | ✗ | goto herodraw_end; | |
| 2988 | } | ||
| 2989 | 4288 | } | |
| 2990 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7160239 times.
|
7160239 | else if (action == sidedrowning) |
| 2991 | { | ||
| 2992 | ✗ | herotile(&tile, &flip, &extend, ls_sidedrown, down, zinit.heroAnimationStyle); | |
| 2993 | ✗ | if(advancetile) tile += anim_3_4(lstep,7)*(extend==2?2:1); | |
| 2994 | ✗ | } | |
| 2995 |
2/2✓ Branch 0 taken 256 times.
✓ Branch 1 taken 7159983 times.
|
7160239 | else if(action==lavadrowning) |
| 2996 | { | ||
| 2997 | 256 | herotile(&tile, &flip, &extend, (drownclk > 60) ? ls_float : ls_lavadrown, dir, zinit.heroAnimationStyle); | |
| 2998 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 256 times.
|
256 | if(advancetile) tile += anim_3_4(lstep,7)*(extend==2?2:1); |
| 2999 | 256 | } | |
| 3000 |
2/4✓ Branch 0 taken 7159983 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 7159983 times.
|
7159983 | else if (action == sideswimming || action == sideswimhit) |
| 3001 | { | ||
| 3002 | ✗ | herotile(&tile, &flip, &extend, ls_sideswim, dir, zinit.heroAnimationStyle); | |
| 3003 | |||
| 3004 | ✗ | if(advancetile) tile += anim_3_4(lstep,7)*(extend==2?2:1); | |
| 3005 | ✗ | } | |
| 3006 |
6/6✓ Branch 0 taken 7098339 times.
✓ Branch 1 taken 61644 times.
✓ Branch 2 taken 7097908 times.
✓ Branch 3 taken 431 times.
✓ Branch 4 taken 157 times.
✓ Branch 5 taken 7097751 times.
|
7159983 | else if(action==swimming || action==swimhit || hopclk==0xFF) |
| 3007 | { | ||
| 3008 |
2/2✓ Branch 0 taken 15239 times.
✓ Branch 1 taken 46993 times.
|
62232 | if (get_qr(qr_COPIED_SWIM_SPRITES)) |
| 3009 | { | ||
| 3010 | 15239 | herotile(&tile, &flip, &extend, ls_walk, dir, zinit.heroAnimationStyle); | |
| 3011 | 15239 | } | |
| 3012 | else | ||
| 3013 | { | ||
| 3014 | 46993 | herotile(&tile, &flip, &extend, is_moving()?ls_swim:ls_float, dir, zinit.heroAnimationStyle); | |
| 3015 | } | ||
| 3016 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 62232 times.
|
62232 | if(advancetile) tile += anim_3_4(lstep,7)*(extend==2?2:1); |
| 3017 | |||
| 3018 |
2/2✓ Branch 0 taken 56358 times.
✓ Branch 1 taken 5874 times.
|
62232 | if(isDiving()) |
| 3019 | { | ||
| 3020 |
2/2✓ Branch 0 taken 840 times.
✓ Branch 1 taken 5034 times.
|
5874 | if (get_qr(qr_COPIED_SWIM_SPRITES)) |
| 3021 | { | ||
| 3022 | 840 | herotile(&tile, &flip, &extend, ls_walk, dir, zinit.heroAnimationStyle); | |
| 3023 | 840 | } | |
| 3024 | else | ||
| 3025 | { | ||
| 3026 | 5034 | herotile(&tile, &flip, &extend, ls_dive, dir, zinit.heroAnimationStyle); | |
| 3027 | } | ||
| 3028 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5874 times.
|
5874 | if(advancetile) tile += anim_3_4(lstep,7)*(extend==2?2:1); |
| 3029 | 5874 | } | |
| 3030 | 62232 | } | |
| 3031 |
3/4✓ Branch 0 taken 38192 times.
✓ Branch 1 taken 7059559 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 38192 times.
|
7097751 | else if(charging > 0 && attack != wHammer) |
| 3032 | { | ||
| 3033 | 38192 | herotile(&tile, &flip, &extend, (IsSideSwim())?ls_sideswimcharge:ls_charge, dir, zinit.heroAnimationStyle); | |
| 3034 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 38192 times.
|
38192 | if(advancetile) tile += anim_3_4(lstep,7)*(extend==2?2:1); |
| 3035 | 38192 | } | |
| 3036 |
6/8✓ Branch 0 taken 7039408 times.
✓ Branch 1 taken 20151 times.
✓ Branch 2 taken 7039408 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 12489 times.
✓ Branch 5 taken 7047070 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 12489 times.
|
7059559 | else if ((z > 0 || fakez > 0 || isSideViewHero()) && jumping_frame && game->get_life() > 0) |
| 3037 | { | ||
| 3038 | 12489 | herotile(&tile, &flip, &extend, ls_jump, dir, zinit.heroAnimationStyle); | |
| 3039 |
2/2✓ Branch 0 taken 69 times.
✓ Branch 1 taken 12420 times.
|
12489 | if (advancetile) tile += (*jumping_frame) * (extend == 2 ? 2 : 1); |
| 3040 | 12489 | } | |
| 3041 |
2/2✓ Branch 0 taken 3990 times.
✓ Branch 1 taken 7043080 times.
|
7047070 | else if(fallclk>0) |
| 3042 | { | ||
| 3043 | 3990 | herotile(&tile, &flip, &extend, ls_falling, dir, zinit.heroAnimationStyle); | |
| 3044 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3990 times.
|
3990 | if(advancetile) tile += ((PITFALL_FALL_FRAMES-fallclk)/10)*(extend==2?2:1); |
| 3045 | 3990 | } | |
| 3046 |
5/6✓ Branch 0 taken 990686 times.
✓ Branch 1 taken 6052394 times.
✓ Branch 2 taken 289 times.
✓ Branch 3 taken 990397 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 289 times.
|
7043080 | else if(!noliftspr&&action==lifting&&isLifting()) |
| 3047 | { | ||
| 3048 | 289 | herotile(&tile, &flip, &extend, ls_lifting, dir, zinit.heroAnimationStyle); | |
| 3049 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 289 times.
|
289 | if(script_hero_sprite <= 0) |
| 3050 | { | ||
| 3051 | 289 | auto frames = vbound(liftingspr[dir][spr_frames],1,255); | |
| 3052 | 289 | auto speed = tliftclk/frames; | |
| 3053 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 289 times.
|
289 | if (speed < 1) speed = 1; |
| 3054 | 289 | auto curframe = (tliftclk - liftclk) / speed; | |
| 3055 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 289 times.
|
289 | if (!tliftclk) curframe = frames - 1; |
| 3056 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 289 times.
|
289 | if(unsigned(curframe) < frames) |
| 3057 | 289 | tile += curframe * (extend == 2 ? 2 : 1); | |
| 3058 | 289 | } | |
| 3059 | 289 | } | |
| 3060 | else | ||
| 3061 | { | ||
| 3062 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7042791 times.
|
7042791 | if(IsSideSwim()) |
| 3063 | ✗ | herotile(&tile, &flip, &extend, ls_sideswim, dir, zinit.heroAnimationStyle); | |
| 3064 | else | ||
| 3065 | { | ||
| 3066 |
4/4✓ Branch 0 taken 990397 times.
✓ Branch 1 taken 6052394 times.
✓ Branch 2 taken 988658 times.
✓ Branch 3 taken 1739 times.
|
7042791 | if(!noliftspr&&isLifting()) |
| 3067 | 1739 | herotile(&tile, &flip, &extend, ls_liftwalk, dir, zinit.heroAnimationStyle); | |
| 3068 | 7041052 | else herotile(&tile, &flip, &extend, ls_walk, dir, zinit.heroAnimationStyle); | |
| 3069 | } | ||
| 3070 | |||
| 3071 |
2/2✓ Branch 0 taken 1991276 times.
✓ Branch 1 taken 5051515 times.
|
7042791 | if(dir > up) |
| 3072 | { | ||
| 3073 | 5051515 | useltm=true; | |
| 3074 | 5051515 | } | |
| 3075 |
2/2✓ Branch 0 taken 7693 times.
✓ Branch 1 taken 7035098 times.
|
7042791 | if(advancetile) tile += anim_3_4(lstep,7)*(extend==2?2:1); |
| 3076 | } | ||
| 3077 | |||
| 3078 | 7164527 | break; | |
| 3079 | |||
| 3080 | case las_zelda3slow: //8-frame Zelda 3 (slow) | ||
| 3081 | case las_zelda3: //8-frame Zelda 3 | ||
| 3082 | ✗ | if(action == drowning) | |
| 3083 | { | ||
| 3084 | ✗ | if(inwater) | |
| 3085 | { | ||
| 3086 | ✗ | herotile(&tile, &flip, &extend, (drownclk > 60) ? ls_float : ls_drown, dir, zinit.heroAnimationStyle); | |
| 3087 | ✗ | if (script_hero_sprite <= 0 ) tile += anim_3_4(lstep,7)*(extend==2?2:1); | |
| 3088 | ✗ | } | |
| 3089 | else | ||
| 3090 | { | ||
| 3091 | ✗ | goto herodraw_end; | |
| 3092 | } | ||
| 3093 | ✗ | } | |
| 3094 | ✗ | else if(action == lavadrowning) | |
| 3095 | { | ||
| 3096 | ✗ | herotile(&tile, &flip, &extend, (drownclk > 60) ? ls_float : ls_lavadrown, dir, zinit.heroAnimationStyle); | |
| 3097 | ✗ | if (script_hero_sprite <= 0 ) tile += anim_3_4(lstep,7)*(extend==2?2:1); | |
| 3098 | |||
| 3099 | ✗ | } | |
| 3100 | ✗ | else if(action == sidedrowning) | |
| 3101 | { | ||
| 3102 | ✗ | herotile(&tile, &flip, &extend, ls_sidedrown, down, zinit.heroAnimationStyle); | |
| 3103 | ✗ | if (script_hero_sprite <= 0 ) tile += anim_3_4(lstep,7)*(extend==2?2:1); | |
| 3104 | ✗ | } | |
| 3105 | ✗ | else if (action == sideswimming || action == sideswimhit) | |
| 3106 | { | ||
| 3107 | ✗ | herotile(&tile, &flip, &extend, ls_sideswim, dir, zinit.heroAnimationStyle); | |
| 3108 | |||
| 3109 | ✗ | if (script_hero_sprite <= 0 ) tile += anim_3_4(lstep,7)*(extend==2?2:1); | |
| 3110 | ✗ | } | |
| 3111 | ✗ | else if(action == swimming || action==swimhit || hopclk==0xFF) | |
| 3112 | { | ||
| 3113 | ✗ | herotile(&tile, &flip, &extend, is_moving()?ls_swim:ls_float, dir, zinit.heroAnimationStyle); | |
| 3114 | ✗ | if (script_hero_sprite <= 0 ) tile += anim_3_4(lstep,7)*(extend==2?2:1); | |
| 3115 | |||
| 3116 | ✗ | if(isDiving()) | |
| 3117 | { | ||
| 3118 | ✗ | herotile(&tile, &flip, &extend, ls_dive, dir, zinit.heroAnimationStyle); | |
| 3119 | ✗ | if (script_hero_sprite <= 0 ) tile += anim_3_4(lstep,7)*(extend==2?2:1); | |
| 3120 | ✗ | } | |
| 3121 | ✗ | } | |
| 3122 | ✗ | else if(charging > 0 && attack != wHammer) | |
| 3123 | { | ||
| 3124 | ✗ | herotile(&tile, &flip, &extend, (IsSideSwim())?ls_sideswimcharge:ls_charge, dir, zinit.heroAnimationStyle); | |
| 3125 | ✗ | if (script_hero_sprite <= 0 ) tile+=(extend==2?2:1); | |
| 3126 | //int32_t l=hero_count/hero_animation_speed; | ||
| 3127 | ✗ | int32_t l=(hero_count/hero_animation_speed)&15; | |
| 3128 | //int32_t l=((p[lt_clock]/hero_animation_speed)&15); | ||
| 3129 | ✗ | l-=((l>3)?1:0)+((l>12)?1:0); | |
| 3130 | ✗ | if (script_hero_sprite <= 0 ) tile+=(l/2)*(extend==2?2:1); | |
| 3131 | ✗ | } | |
| 3132 | ✗ | else if ((z > 0 || fakez > 0 || isSideViewHero()) && jumping_frame && game->get_life() > 0) | |
| 3133 | { | ||
| 3134 | ✗ | herotile(&tile, &flip, &extend, ls_jump, dir, zinit.heroAnimationStyle); | |
| 3135 | ✗ | if (script_hero_sprite <= 0) tile += (*jumping_frame) * (extend == 2 ? 2 : 1); | |
| 3136 | ✗ | } | |
| 3137 | ✗ | else if(fallclk>0) | |
| 3138 | { | ||
| 3139 | ✗ | herotile(&tile, &flip, &extend, ls_falling, dir, zinit.heroAnimationStyle); | |
| 3140 | ✗ | if (script_hero_sprite <= 0 ) tile += ((PITFALL_FALL_FRAMES-fallclk)/10)*(extend==2?2:1); | |
| 3141 | ✗ | } | |
| 3142 | ✗ | else if(!noliftspr&&action==lifting&&isLifting()) | |
| 3143 | { | ||
| 3144 | ✗ | herotile(&tile, &flip, &extend, ls_lifting, dir, zinit.heroAnimationStyle); | |
| 3145 | ✗ | if(script_hero_sprite <= 0) | |
| 3146 | { | ||
| 3147 | ✗ | auto frames = vbound(liftingspr[dir][spr_frames],1,255); | |
| 3148 | ✗ | auto speed = tliftclk/frames; | |
| 3149 | ✗ | if (speed < 1) speed = 1; | |
| 3150 | ✗ | auto curframe = (tliftclk-liftclk)/speed; | |
| 3151 | ✗ | if (!tliftclk) curframe = frames - 1; | |
| 3152 | ✗ | if(unsigned(curframe) < frames) | |
| 3153 | ✗ | tile += curframe * (extend == 2 ? 2 : 1); | |
| 3154 | ✗ | } | |
| 3155 | ✗ | } | |
| 3156 | else | ||
| 3157 | { | ||
| 3158 | ✗ | if(IsSideSwim()) | |
| 3159 | ✗ | herotile(&tile, &flip, &extend, ls_sideswim, dir, zinit.heroAnimationStyle); | |
| 3160 | else | ||
| 3161 | { | ||
| 3162 | ✗ | if(!noliftspr&&isLifting()) | |
| 3163 | ✗ | herotile(&tile, &flip, &extend, ls_liftwalk, dir, zinit.heroAnimationStyle); | |
| 3164 | ✗ | else herotile(&tile, &flip, &extend, ls_walk, dir, zinit.heroAnimationStyle); | |
| 3165 | } | ||
| 3166 | |||
| 3167 | ✗ | if(advancetile && (action == walking || action == climbcoverbottom || action == climbcovertop)) | |
| 3168 | { | ||
| 3169 | ✗ | tile += (extend == 2 ? 2 : 1); | |
| 3170 | ✗ | } | |
| 3171 | |||
| 3172 | ✗ | if(dir>up) | |
| 3173 | { | ||
| 3174 | ✗ | useltm=true; | |
| 3175 | ✗ | } | |
| 3176 | |||
| 3177 | ✗ | if(advancetile && (action == walking || action == hopping || action == climbcoverbottom || action == climbcovertop)) | |
| 3178 | { | ||
| 3179 | //tile+=(extend==2?2:1); | ||
| 3180 | //tile+=(((active_count>>2)%8)*(extend==2?2:1)); | ||
| 3181 | ✗ | int32_t l = hero_count / hero_animation_speed; | |
| 3182 | ✗ | l -= ((l > 3) ? 1 : 0) + ((l > 12) ? 1 : 0); | |
| 3183 | ✗ | tile += (l / 2) * (extend == 2 ? 2 : 1); | |
| 3184 | ✗ | } | |
| 3185 | } | ||
| 3186 | |||
| 3187 | ✗ | break; | |
| 3188 | |||
| 3189 | default: | ||
| 3190 | ✗ | break; | |
| 3191 | } | ||
| 3192 | 15694838 | } | |
| 3193 | |||
| 3194 |
6/6✓ Branch 0 taken 6694723 times.
✓ Branch 1 taken 9002962 times.
✓ Branch 2 taken 4246862 times.
✓ Branch 3 taken 2447861 times.
✓ Branch 4 taken 170841 times.
✓ Branch 5 taken 4076021 times.
|
15697685 | yofs = oyofs-((!BSZ && isdungeon() && cur_screen<128 && !get_qr(qr_HERODUNGEONPOSFIX)) ? 2 : 0); |
| 3195 | |||
| 3196 |
2/2✓ Branch 0 taken 15694381 times.
✓ Branch 1 taken 3304 times.
|
15697685 | if(action==won) |
| 3197 | { | ||
| 3198 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3304 times.
|
3304 | yofs=(get_qr(qr_OLD_DRAWOFFSET)?playing_field_offset:original_playing_field_offset) - 2; |
| 3199 | 3304 | } | |
| 3200 | |||
| 3201 |
4/4✓ Branch 0 taken 15524783 times.
✓ Branch 1 taken 172902 times.
✓ Branch 2 taken 94208 times.
✓ Branch 3 taken 15430575 times.
|
15697685 | if(action==landhold1 || action==landhold2) |
| 3202 | { | ||
| 3203 | 267110 | useltm=(get_qr(qr_EXPANDEDLTM) != 0); | |
| 3204 |
6/6✓ Branch 0 taken 106891 times.
✓ Branch 1 taken 160219 times.
✓ Branch 2 taken 80905 times.
✓ Branch 3 taken 25986 times.
✓ Branch 4 taken 14607 times.
✓ Branch 5 taken 66298 times.
|
267110 | yofs = oyofs-((!BSZ && isdungeon() && cur_screen<128 && !get_qr(qr_HERODUNGEONPOSFIX)) ? 2 : 0); |
| 3205 | 267110 | herotile(&tile, &flip, &extend, (action==landhold1)?ls_landhold1:ls_landhold2, dir, zinit.heroAnimationStyle); | |
| 3206 | 267110 | } | |
| 3207 |
4/4✓ Branch 0 taken 15429220 times.
✓ Branch 1 taken 1355 times.
✓ Branch 2 taken 859 times.
✓ Branch 3 taken 15428361 times.
|
15430575 | else if(action==waterhold1 || action==waterhold2) |
| 3208 | { | ||
| 3209 | 2214 | useltm=(get_qr(qr_EXPANDEDLTM) != 0); | |
| 3210 | 2214 | herotile(&tile, &flip, &extend, (action==waterhold1)?ls_waterhold1:ls_waterhold2, dir, zinit.heroAnimationStyle); | |
| 3211 | 2214 | } | |
| 3212 |
2/4✓ Branch 0 taken 15428361 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 15428361 times.
|
15428361 | else if(action==sidewaterhold1 || action==sidewaterhold2) |
| 3213 | { | ||
| 3214 | ✗ | useltm=(get_qr(qr_EXPANDEDLTM) != 0); | |
| 3215 | ✗ | herotile(&tile, &flip, &extend, (action==sidewaterhold1)?ls_sidewaterhold1:ls_sidewaterhold2, dir, zinit.heroAnimationStyle); | |
| 3216 | ✗ | } | |
| 3217 | |||
| 3218 |
3/4✓ Branch 0 taken 15694838 times.
✓ Branch 1 taken 2847 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 15694838 times.
|
15697685 | if(action!=casting && action!=sideswimcasting) |
| 3219 | { | ||
| 3220 |
2/2✓ Branch 0 taken 2634525 times.
✓ Branch 1 taken 13060313 times.
|
15694838 | if(useltm) |
| 3221 | { | ||
| 3222 |
2/2✓ Branch 0 taken 7762 times.
✓ Branch 1 taken 13052551 times.
|
13060313 | if (script_hero_sprite <= 0 ) tile+=getTileModifier(); |
| 3223 | 13060313 | } | |
| 3224 | 15694838 | } | |
| 3225 | |||
| 3226 | // Stone of Agony | ||
| 3227 |
1/2✓ Branch 0 taken 15697685 times.
✗ Branch 1 not taken.
|
15697685 | if(agony) |
| 3228 | { | ||
| 3229 | ✗ | yofs-=!(frame%zc_max(60-itemsbuf[agonyid].misc1,3))?1:0; | |
| 3230 | ✗ | } | |
| 3231 | |||
| 3232 |
2/2✓ Branch 0 taken 63595 times.
✓ Branch 1 taken 15634090 times.
|
15697685 | if(is_hitflickerframe()) |
| 3233 | { | ||
| 3234 |
4/6✓ Branch 0 taken 181 times.
✓ Branch 1 taken 63414 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 181 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 63414 times.
|
63595 | int32_t temp_flicker_color = (game->get_life() > 0 || immortal) ? (flickercolor < 0 ? game->get_spriteflickercolor() : flickercolor) : 0; |
| 3235 |
2/4✓ Branch 0 taken 63595 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 63595 times.
✗ Branch 3 not taken.
|
63595 | if((game->get_spriteflickercolor() || temp_flicker_color) && !superman) |
| 3236 | { | ||
| 3237 | ✗ | sprite_flicker_transp_passes = (flickertransp < 0 ? game->get_spriteflickertransp() : flickertransp); | |
| 3238 | ✗ | sprite_flicker_color = temp_flicker_color; | |
| 3239 | ✗ | masked_draw(dest); | |
| 3240 | ✗ | } | |
| 3241 | 63595 | } | |
| 3242 | else | ||
| 3243 | 15634090 | masked_draw(dest); | |
| 3244 | |||
| 3245 | //draw held items after Hero so they don't go behind his head | ||
| 3246 |
4/4✓ Branch 0 taken 15524783 times.
✓ Branch 1 taken 172902 times.
✓ Branch 2 taken 94208 times.
✓ Branch 3 taken 15430575 times.
|
15697685 | if(action==landhold1 || action==landhold2) |
| 3247 | { | ||
| 3248 |
2/2✓ Branch 0 taken 22 times.
✓ Branch 1 taken 267088 times.
|
267110 | if(holditem > -1) |
| 3249 | { | ||
| 3250 | 267088 | int hx = x - ((action==landhold1)?4:0); | |
| 3251 | 267088 | int hy = y+yofs-16-(get_qr(qr_NOITEMOFFSET))-fakez-z; | |
| 3252 |
2/2✓ Branch 0 taken 155469 times.
✓ Branch 1 taken 111619 times.
|
267088 | if(get_qr(qr_HOLDITEMANIMATION)) |
| 3253 | { | ||
| 3254 | 155469 | putitem2(dest,hx,hy,holditem,lens_hint_item[holditem][0], lens_hint_item[holditem][1], 0); | |
| 3255 | 155469 | } | |
| 3256 | else | ||
| 3257 | { | ||
| 3258 | 111619 | putitem(dest,hx,hy,holditem); | |
| 3259 | } | ||
| 3260 | 267088 | } | |
| 3261 | 267110 | } | |
| 3262 |
4/4✓ Branch 0 taken 15429220 times.
✓ Branch 1 taken 1355 times.
✓ Branch 2 taken 859 times.
✓ Branch 3 taken 15428361 times.
|
15430575 | else if(action==waterhold1 || action==waterhold2) |
| 3263 | { | ||
| 3264 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2214 times.
|
2214 | if(holditem > -1) |
| 3265 | { | ||
| 3266 | 2214 | int hx = x - ((action==waterhold1)?4:0); | |
| 3267 | 2214 | int hy = y+yofs-12-(get_qr(qr_NOITEMOFFSET))-fakez-z; | |
| 3268 |
2/2✓ Branch 0 taken 1562 times.
✓ Branch 1 taken 652 times.
|
2214 | if(get_qr(qr_HOLDITEMANIMATION)) |
| 3269 | { | ||
| 3270 | 1562 | putitem2(dest,hx,hy,holditem,lens_hint_item[holditem][0], lens_hint_item[holditem][1], 0); | |
| 3271 | 1562 | } | |
| 3272 | else | ||
| 3273 | { | ||
| 3274 | 652 | putitem(dest,hx,hy,holditem); | |
| 3275 | } | ||
| 3276 | 2214 | } | |
| 3277 | 2214 | } | |
| 3278 |
2/4✓ Branch 0 taken 15428361 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 15428361 times.
|
15428361 | else if(action==sidewaterhold1 || action==sidewaterhold2) //!DIMITODO: Check to see if this looks right or if it needs waterhold's offset. |
| 3279 | { | ||
| 3280 | ✗ | if(holditem > -1) | |
| 3281 | { | ||
| 3282 | ✗ | int hx = x - ((action==sidewaterhold1)?4:0); | |
| 3283 | ✗ | int hy = y+yofs-16-(get_qr(qr_NOITEMOFFSET))-fakez-z; | |
| 3284 | ✗ | if(get_qr(qr_HOLDITEMANIMATION)) | |
| 3285 | { | ||
| 3286 | ✗ | putitem2(dest,hx,hy,holditem,lens_hint_item[holditem][0], lens_hint_item[holditem][1], 0); | |
| 3287 | ✗ | } | |
| 3288 | else | ||
| 3289 | { | ||
| 3290 | ✗ | putitem(dest,hx,hy,holditem); | |
| 3291 | } | ||
| 3292 | ✗ | } | |
| 3293 | ✗ | } | |
| 3294 |
4/4✓ Branch 0 taken 25128 times.
✓ Branch 1 taken 15672557 times.
✓ Branch 2 taken 6999 times.
✓ Branch 3 taken 18129 times.
|
15697685 | if(fairyclk==0||(get_qr(qr_NOHEARTRING))) |
| 3295 | { | ||
| 3296 | 15679556 | goto herodraw_end; | |
| 3297 | } | ||
| 3298 | |||
| 3299 | 18129 | double a2 = fairyclk*4.5 + 90; | |
| 3300 | 18129 | int32_t hearts=0; | |
| 3301 | 18129 | int32_t htile = 2; | |
| 3302 | |||
| 3303 | 18129 | do | |
| 3304 | { | ||
| 3305 | 110312 | int32_t nx=125; | |
| 3306 | |||
| 3307 |
2/2✓ Branch 0 taken 64232 times.
✓ Branch 1 taken 46080 times.
|
110312 | if(get_qr(qr_HEARTRINGFIX)) |
| 3308 | { | ||
| 3309 | 46080 | nx=x; | |
| 3310 | 46080 | } | |
| 3311 | |||
| 3312 | 110312 | int32_t ny=88; | |
| 3313 | |||
| 3314 |
2/2✓ Branch 0 taken 64232 times.
✓ Branch 1 taken 46080 times.
|
110312 | if(get_qr(qr_HEARTRINGFIX)) |
| 3315 | { | ||
| 3316 | 46080 | ny=y; | |
| 3317 | 46080 | } | |
| 3318 | |||
| 3319 | 110312 | int32_t tx = zc::math::CosD(a2)*53 +nx; | |
| 3320 | 110312 | int32_t ty = -zc::math::SinD(a2)*53 +ny+playing_field_offset; | |
| 3321 | 110312 | overtile8(dest,htile,tx,ty,1,0); | |
| 3322 | 110312 | a2-=45; | |
| 3323 | 110312 | ++hearts; | |
| 3324 |
2/2✓ Branch 0 taken 92183 times.
✓ Branch 1 taken 18129 times.
|
220624 | } |
| 3325 |
2/2✓ Branch 0 taken 9920 times.
✓ Branch 1 taken 100392 times.
|
110312 | while(a2>90 && hearts<8); |
| 3326 | 18129 | } | |
| 3327 | herodraw_end: | ||
| 3328 | 17546248 | xofs=oxofs; | |
| 3329 | 17546248 | yofs=oyofs; | |
| 3330 | 17546248 | do_primitives(dest, SPLAYER_PLAYER_DRAW); | |
| 3331 | 17546248 | } | |
| 3332 | |||
| 3333 | 17177846 | void HeroClass::masked_draw(BITMAP* dest) | |
| 3334 | { | ||
| 3335 | // The first sprite::draw in this function uses sprite_flicker_color | ||
| 3336 | // This is intended to be the player, handle this if this changes. -Moosh | ||
| 3337 | 17177846 | zfix lz, lfz; | |
| 3338 |
2/2✓ Branch 0 taken 17166637 times.
✓ Branch 1 taken 11209 times.
|
17177846 | if(lift_wpn) |
| 3339 | { | ||
| 3340 | 11209 | lz = lift_wpn->z; | |
| 3341 | 11209 | lfz = lift_wpn->fakez; | |
| 3342 | 11209 | } | |
| 3343 | |||
| 3344 |
12/12✓ Branch 0 taken 6913027 times.
✓ Branch 1 taken 10264819 times.
✓ Branch 2 taken 6666809 times.
✓ Branch 3 taken 246218 times.
✓ Branch 4 taken 6515961 times.
✓ Branch 5 taken 150848 times.
✓ Branch 6 taken 6354501 times.
✓ Branch 7 taken 161460 times.
✓ Branch 8 taken 6161041 times.
✓ Branch 9 taken 193460 times.
✓ Branch 10 taken 6464852 times.
✓ Branch 11 taken 201957 times.
|
17177846 | if(isdungeon() && cur_screen<128 && (x<16 || x>(world_w-32) || y<18 || y>(world_h-30)) && !get_qr(qr_FREEFORM)) |
| 3345 | { | ||
| 3346 | // clip under doorways | ||
| 3347 | 201957 | BITMAP *sub=create_sub_bitmap(dest,16,playing_field_offset+16,224,144); | |
| 3348 | |||
| 3349 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 201957 times.
|
201957 | if(sub!=NULL) |
| 3350 | { | ||
| 3351 | 201957 | yofs -= (playing_field_offset+16); | |
| 3352 | 201957 | xofs -= 16; | |
| 3353 | 201957 | sprite::draw(sub); | |
| 3354 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 201957 times.
|
201957 | if(lift_wpn) |
| 3355 | { | ||
| 3356 | ✗ | handle_lift(false); | |
| 3357 | ✗ | bool shad = lift_wpn->has_shadow; | |
| 3358 | ✗ | lift_wpn->has_shadow = false; | |
| 3359 | ✗ | lift_wpn->z += z; | |
| 3360 | ✗ | lift_wpn->fakez += fakez; | |
| 3361 | ✗ | lift_wpn->draw(sub); | |
| 3362 | ✗ | lift_wpn->has_shadow = shad; | |
| 3363 | ✗ | } | |
| 3364 | 201957 | prompt_draw(sub); | |
| 3365 | 201957 | xofs+=16; | |
| 3366 | 201957 | yofs += (playing_field_offset+16); | |
| 3367 | 201957 | destroy_bitmap(sub); | |
| 3368 | 201957 | } | |
| 3369 | 201957 | } | |
| 3370 | else | ||
| 3371 | { | ||
| 3372 | 16975889 | sprite::draw(dest); | |
| 3373 |
2/2✓ Branch 0 taken 16964680 times.
✓ Branch 1 taken 11209 times.
|
16975889 | if(lift_wpn) |
| 3374 | { | ||
| 3375 | 11209 | handle_lift(false); | |
| 3376 | 11209 | bool shad = lift_wpn->has_shadow; | |
| 3377 | 11209 | lift_wpn->has_shadow = false; | |
| 3378 | 11209 | lift_wpn->z += z; | |
| 3379 | 11209 | lift_wpn->fakez += fakez; | |
| 3380 | 11209 | lift_wpn->draw(dest); | |
| 3381 | 11209 | lift_wpn->has_shadow = shad; | |
| 3382 | 11209 | } | |
| 3383 | 16975889 | prompt_draw(dest); | |
| 3384 | } | ||
| 3385 | |||
| 3386 |
2/2✓ Branch 0 taken 17166637 times.
✓ Branch 1 taken 11209 times.
|
17177846 | if(lift_wpn) |
| 3387 | { | ||
| 3388 | 11209 | lift_wpn->z = lz; | |
| 3389 | 11209 | lift_wpn->fakez = lfz; | |
| 3390 | 11209 | } | |
| 3391 | 17177846 | return; | |
| 3392 | } | ||
| 3393 | 17177846 | void HeroClass::prompt_draw(BITMAP* dest) | |
| 3394 | { | ||
| 3395 |
2/2✓ Branch 0 taken 9969 times.
✓ Branch 1 taken 17167877 times.
|
17177846 | if(!prompt_combo) return; |
| 3396 | 9969 | int32_t sx = real_x(x+xofs+prompt_x); | |
| 3397 | 9969 | int32_t sy = real_y(y + yofs + prompt_y) - real_z(z + zofs); | |
| 3398 | 9969 | sy -= fake_z(fakez); | |
| 3399 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9969 times.
|
9969 | if(combobuf[prompt_combo].animflags & AF_EDITOR_ONLY) return; |
| 3400 | 9969 | overcombo(dest, sx - viewport.x, sy - viewport.y, prompt_combo, prompt_cset); | |
| 3401 | 9969 | return; | |
| 3402 | 17177846 | } | |
| 3403 | |||
| 3404 | 22930 | void collectitem_script(int32_t id) | |
| 3405 | { | ||
| 3406 |
2/2✓ Branch 0 taken 22593 times.
✓ Branch 1 taken 337 times.
|
22930 | if(itemsbuf[id].collect_script) |
| 3407 | { | ||
| 3408 | //clear item script stack. | ||
| 3409 | 337 | FFCore.clear_ref(ScriptType::Item, -id); | |
| 3410 | |||
| 3411 |
2/6✓ Branch 0 taken 337 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 337 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
337 | if ( id > 0 && !(FFCore.doscript(ScriptType::Item, -id) && get_qr(qr_ITEMSCRIPTSKEEPRUNNING)) ) //No collect script on item 0. |
| 3412 | { | ||
| 3413 | 337 | int i = -id; | |
| 3414 | 337 | FFCore.reset_script_engine_data(ScriptType::Item, i); | |
| 3415 | 337 | ZScriptVersion::RunScript(ScriptType::Item, itemsbuf[id].collect_script, i); | |
| 3416 | 337 | FFCore.deallocateAllScriptOwned(ScriptType::Item, i); | |
| 3417 | 337 | } | |
| 3418 | ✗ | else if (id == 0 && !(FFCore.doscript(ScriptType::Item, -id) && get_qr(qr_ITEMSCRIPTSKEEPRUNNING))) //item 0 | |
| 3419 | { | ||
| 3420 | ✗ | int i = COLLECT_SCRIPT_ITEM_ZERO; | |
| 3421 | ✗ | FFCore.reset_script_engine_data(ScriptType::Item, i); | |
| 3422 | ✗ | ZScriptVersion::RunScript(ScriptType::Item, itemsbuf[id].collect_script, i); | |
| 3423 | ✗ | FFCore.deallocateAllScriptOwned(ScriptType::Item, i); | |
| 3424 | ✗ | } | |
| 3425 | //runningItemScripts[id] = 0; | ||
| 3426 | 337 | } | |
| 3427 | 22930 | } | |
| 3428 | 4270 | void passiveitem_script(int32_t id, bool doRun = false) | |
| 3429 | { | ||
| 3430 | //Passive item scripts on colelction | ||
| 3431 |
3/6✓ Branch 0 taken 64 times.
✓ Branch 1 taken 4206 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 64 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
4270 | if(itemsbuf[id].script && ( (itemsbuf[id].flags&item_passive_script) && (get_qr(qr_ITEMSCRIPTSKEEPRUNNING)) )) |
| 3432 | { | ||
| 3433 | ✗ | FFCore.reset_script_engine_data(ScriptType::Item, id); | |
| 3434 | |||
| 3435 | ✗ | if(get_qr(qr_PASSIVE_ITEM_SCRIPT_ONLY_HIGHEST) | |
| 3436 | ✗ | && current_item(itemsbuf[id].type) > itemsbuf[id].level) | |
| 3437 | { | ||
| 3438 | ✗ | FFCore.doscript(ScriptType::Item, id) = false; | |
| 3439 | ✗ | return; | |
| 3440 | } | ||
| 3441 | ✗ | if(doRun) | |
| 3442 | ✗ | ZScriptVersion::RunScript(ScriptType::Item, itemsbuf[id].script, id); | |
| 3443 | ✗ | } | |
| 3444 | 4270 | } | |
| 3445 | |||
| 3446 | // separate case for sword/wand/hammer/slashed weapons only | ||
| 3447 | // the main weapon checking is in the global function check_collisions() | ||
| 3448 | 14835443 | bool HeroClass::checkstab() | |
| 3449 | { | ||
| 3450 |
14/14✓ Branch 0 taken 13130310 times.
✓ Branch 1 taken 1705133 times.
✓ Branch 2 taken 381548 times.
✓ Branch 3 taken 1323585 times.
✓ Branch 4 taken 356079 times.
✓ Branch 5 taken 25469 times.
✓ Branch 6 taken 285954 times.
✓ Branch 7 taken 70125 times.
✓ Branch 8 taken 285926 times.
✓ Branch 9 taken 28 times.
✓ Branch 10 taken 259258 times.
✓ Branch 11 taken 26668 times.
✓ Branch 12 taken 394707 times.
✓ Branch 13 taken 1051168 times.
|
14835443 | if(action!=attacking && action!=sideswimattacking || (attack!=wSword && attack!=wWand && attack!=wHammer && attack!=wCByrna && attack!=wFire && attack != wBugNet) |
| 3451 | 1705133 | || (attackclk<=4)) | |
| 3452 | 13784275 | return false; | |
| 3453 | |||
| 3454 | 1051168 | weapon *w=NULL; | |
| 3455 | |||
| 3456 | 1051168 | int32_t wx=0,wy=0,wz=0,wxsz=0,wysz=0; | |
| 3457 | 1051168 | bool found = false; | |
| 3458 | 1051168 | int32_t melee_weapon_index = 0; | |
| 3459 | 1051168 | int32_t parentitem=-1; | |
| 3460 | 1051168 | weapon* meleeweap = nullptr; | |
| 3461 |
2/2✓ Branch 0 taken 63861 times.
✓ Branch 1 taken 1277086 times.
|
1340947 | for(int32_t i=0; i<Lwpns.Count(); i++) |
| 3462 | { | ||
| 3463 | 1277086 | w = (weapon*)Lwpns.spr(i); | |
| 3464 | |||
| 3465 |
6/6✓ Branch 0 taken 1277048 times.
✓ Branch 1 taken 38 times.
✓ Branch 2 taken 38533 times.
✓ Branch 3 taken 1238515 times.
✓ Branch 4 taken 289779 times.
✓ Branch 5 taken 987307 times.
|
1277086 | if(w->id == (attack==wCByrna || attack==wFire ? wWand : attack)) // Kludge: Byrna and Candle sticks are wWand-type. |
| 3466 | { | ||
| 3467 | 987307 | found = true; | |
| 3468 | 987307 | melee_weapon_index = i+1; | |
| 3469 | 987307 | meleeweap = w; | |
| 3470 | // Position the sword as Hero slashes with it. | ||
| 3471 |
4/4✓ Branch 0 taken 926813 times.
✓ Branch 1 taken 60494 times.
✓ Branch 2 taken 114 times.
✓ Branch 3 taken 926699 times.
|
987307 | if(w->id!=wHammer&&w->id!=wBugNet) |
| 3472 | 926699 | positionSword(w,w->parentitem); | |
| 3473 | |||
| 3474 | 987307 | wx=w->x; | |
| 3475 | 987307 | wy=w->y; | |
| 3476 | 987307 | wz=w->z; | |
| 3477 | 987307 | wxsz = w->hit_width; | |
| 3478 | 987307 | wysz = w->hit_height; | |
| 3479 | 987307 | parentitem = w->parentitem; | |
| 3480 | 987307 | break; | |
| 3481 | } | ||
| 3482 | 289779 | } | |
| 3483 | |||
| 3484 |
6/6✓ Branch 0 taken 954496 times.
✓ Branch 1 taken 96672 times.
✓ Branch 2 taken 147006 times.
✓ Branch 3 taken 807490 times.
✓ Branch 4 taken 45825 times.
✓ Branch 5 taken 101181 times.
|
1051168 | if(attack==wSword && attackclk>=14 && charging==0) |
| 3485 | 101181 | return false; | |
| 3486 | |||
| 3487 |
2/2✓ Branch 0 taken 886126 times.
✓ Branch 1 taken 63861 times.
|
949987 | if(!found) |
| 3488 | 63861 | return false; | |
| 3489 | |||
| 3490 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 885703 times.
|
886126 | if(attack == wFire) |
| 3491 | 423 | return false; | |
| 3492 | |||
| 3493 |
2/2✓ Branch 0 taken 825209 times.
✓ Branch 1 taken 60494 times.
|
885703 | if(attack==wHammer) |
| 3494 | { | ||
| 3495 |
2/2✓ Branch 0 taken 24704 times.
✓ Branch 1 taken 35790 times.
|
60494 | if(attackclk<15) |
| 3496 | { | ||
| 3497 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 4705 times.
✓ Branch 2 taken 5517 times.
✓ Branch 3 taken 7835 times.
✓ Branch 4 taken 6647 times.
|
24704 | switch(w->dir) |
| 3498 | { | ||
| 3499 | case up: | ||
| 3500 | 4705 | wx=x-1; | |
| 3501 | 4705 | wy=y-4; | |
| 3502 | 4705 | break; | |
| 3503 | |||
| 3504 | case down: | ||
| 3505 | 5517 | wx=x+8; | |
| 3506 | 5517 | wy=y+28; | |
| 3507 | 5517 | break; // This is consistent with 2.10 | |
| 3508 | |||
| 3509 | case left: | ||
| 3510 | 7835 | wx=x-13; | |
| 3511 | 7835 | wy=y+14; | |
| 3512 | 7835 | break; | |
| 3513 | |||
| 3514 | case right: | ||
| 3515 | 6647 | wx=x+21; | |
| 3516 | 6647 | wy=y+14; | |
| 3517 | 6647 | break; | |
| 3518 | } | ||
| 3519 | |||
| 3520 |
6/8✓ Branch 0 taken 2328 times.
✓ Branch 1 taken 22376 times.
✓ Branch 2 taken 2328 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2328 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 5 times.
✓ Branch 7 taken 2323 times.
|
24704 | if(attackclk==12 && z==0 && fakez==0 && sideviewhammerpound()) |
| 3521 | { | ||
| 3522 | //decorations.add(new dHammerSmack((zfix)wx, (zfix)wy, dHAMMERSMACK, 0)); | ||
| 3523 | /* The hammer smack sprites weren't being positioned properly if Hero changed directions on the same frame that they are created. | ||
| 3524 | switch(dir) | ||
| 3525 | { | ||
| 3526 | case up: | ||
| 3527 | decorations.add(new dHammerSmack(x-1, y-4, dHAMMERSMACK, 0)); | ||
| 3528 | break; | ||
| 3529 | |||
| 3530 | case down: | ||
| 3531 | decorations.add(new dHammerSmack(x+8, y+28, dHAMMERSMACK, 0)); | ||
| 3532 | break; | ||
| 3533 | |||
| 3534 | case left: | ||
| 3535 | decorations.add(new dHammerSmack(x-13, y+14, dHAMMERSMACK, 0)); | ||
| 3536 | break; | ||
| 3537 | |||
| 3538 | case right: | ||
| 3539 | decorations.add(new dHammerSmack(x+21, y+14, dHAMMERSMACK, 0)); | ||
| 3540 | break; | ||
| 3541 | } | ||
| 3542 | */ | ||
| 3543 | 2323 | } | |
| 3544 | |||
| 3545 | 24704 | return false; | |
| 3546 | } | ||
| 3547 |
2/2✓ Branch 0 taken 33517 times.
✓ Branch 1 taken 2273 times.
|
35790 | else if(attackclk==15) |
| 3548 | { | ||
| 3549 | // Hammer's reach needs adjusted slightly for backward compatibility | ||
| 3550 |
2/2✓ Branch 0 taken 1884 times.
✓ Branch 1 taken 389 times.
|
2273 | if(w->dir==up) |
| 3551 | 389 | w->hyofs-=1; | |
| 3552 |
2/2✓ Branch 0 taken 1154 times.
✓ Branch 1 taken 730 times.
|
1884 | else if(w->dir==left) |
| 3553 | 730 | w->hxofs-=2; | |
| 3554 | 2273 | } | |
| 3555 | 35790 | } | |
| 3556 | |||
| 3557 | // The return of Spaghetti Code Constants! | ||
| 3558 |
6/6✓ Branch 0 taken 16297 times.
✓ Branch 1 taken 844702 times.
✓ Branch 2 taken 808780 times.
✓ Branch 3 taken 35922 times.
✓ Branch 4 taken 18 times.
✓ Branch 5 taken 35904 times.
|
860999 | int32_t itype = (attack==wWand ? itype_wand : attack==wSword ? itype_sword : attack==wCByrna ? itype_cbyrna : attack==wBugNet ? itype_bugnet : itype_hammer); |
| 3559 |
4/4✓ Branch 0 taken 126903 times.
✓ Branch 1 taken 734096 times.
✓ Branch 2 taken 141 times.
✓ Branch 3 taken 126762 times.
|
860999 | int32_t itemid = (directWpn>-1 && itemsbuf[directWpn].type==itype) ? directWpn : current_item_id(itype); |
| 3560 | 860999 | itemid = vbound(itemid, 0, MAXITEMS-1); | |
| 3561 | |||
| 3562 | // The sword offsets aren't based on anything other than what felt about right | ||
| 3563 | // compared to the NES game and what mostly kept it from hitting things that | ||
| 3564 | // should clearly be out of range. They could probably still use more tweaking. | ||
| 3565 | // Don't use 2.10 for reference; it's pretty far off. | ||
| 3566 | // - Saf | ||
| 3567 | |||
| 3568 |
6/6✓ Branch 0 taken 478562 times.
✓ Branch 1 taken 382437 times.
✓ Branch 2 taken 27110 times.
✓ Branch 3 taken 451452 times.
✓ Branch 4 taken 448610 times.
✓ Branch 5 taken 29952 times.
|
860999 | if(game->get_canslash() && (attack==wSword || attack==wWand) && itemsbuf[itemid].flags & item_flag4) |
| 3569 | { | ||
| 3570 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 77437 times.
✓ Branch 2 taken 98018 times.
✓ Branch 3 taken 140678 times.
✓ Branch 4 taken 132477 times.
|
448610 | switch(w->dir) |
| 3571 | { | ||
| 3572 | case up: | ||
| 3573 |
2/2✓ Branch 0 taken 51960 times.
✓ Branch 1 taken 25477 times.
|
77437 | if(attackclk<8) |
| 3574 | { | ||
| 3575 | 25477 | wy-=4; | |
| 3576 | 25477 | } | |
| 3577 | |||
| 3578 | 77437 | break; | |
| 3579 | |||
| 3580 | case down: | ||
| 3581 | //if(attackclk<8) | ||
| 3582 | { | ||
| 3583 | 98018 | wy-=2; | |
| 3584 | } | ||
| 3585 | 98018 | break; | |
| 3586 | |||
| 3587 | case left: | ||
| 3588 | |||
| 3589 | //if(attackclk<8) | ||
| 3590 | { | ||
| 3591 | 140678 | wx+=2; | |
| 3592 | } | ||
| 3593 | |||
| 3594 | 140678 | break; | |
| 3595 | |||
| 3596 | case right: | ||
| 3597 | |||
| 3598 | //if(attackclk<8) | ||
| 3599 | { | ||
| 3600 | 132477 | wx-=3; | |
| 3601 | //wy+=((spins>0 || get_qr(qr_SLASHFLIPFIX)) ? -4 : 4); | ||
| 3602 | } | ||
| 3603 | |||
| 3604 | 132477 | break; | |
| 3605 | } | ||
| 3606 | 448610 | } | |
| 3607 | |||
| 3608 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 172905 times.
✓ Branch 2 taken 185572 times.
✓ Branch 3 taken 253247 times.
✓ Branch 4 taken 249275 times.
|
860999 | switch(w->dir) |
| 3609 | { | ||
| 3610 | case up: | ||
| 3611 | 172905 | wx+=2; | |
| 3612 | 172905 | break; | |
| 3613 | |||
| 3614 | case down: | ||
| 3615 | 185572 | break; | |
| 3616 | |||
| 3617 | case left: | ||
| 3618 | 253247 | wy-=3; | |
| 3619 | 253247 | break; | |
| 3620 | |||
| 3621 | case right: | ||
| 3622 | 249275 | wy-=3; | |
| 3623 | 249275 | break; | |
| 3624 | } | ||
| 3625 | |||
| 3626 | 860999 | wx+=w->hxofs; | |
| 3627 | 860999 | wy+=w->hyofs; | |
| 3628 | 860999 | wy-=(w->fakez).getInt(); | |
| 3629 | |||
| 3630 |
2/2✓ Branch 0 taken 854732 times.
✓ Branch 1 taken 3609259 times.
|
4463991 | for(int32_t i=0; i<guys.Count(); i++) |
| 3631 | { | ||
| 3632 |
2/2✓ Branch 0 taken 3609164 times.
✓ Branch 1 taken 95 times.
|
3609259 | if(attack==wBugNet) break; |
| 3633 | // So that Hero can actually hit peahats while jumping, his weapons' hzsz becomes 16 in midair. | ||
| 3634 |
6/6✓ Branch 0 taken 77095 times.
✓ Branch 1 taken 3532069 times.
✓ Branch 2 taken 76500 times.
✓ Branch 3 taken 595 times.
✓ Branch 4 taken 74721 times.
✓ Branch 5 taken 1779 times.
|
3609735 | if((guys.spr(i)->hit(wx,wy,wz,wxsz,wysz,wz>0?16:8) && ((attack!=wWand && attack!=wHammer && attack!=wCByrna) || !(itemsbuf[itemid].flags & item_flag3))) |
| 3635 |
5/6✓ Branch 0 taken 855 times.
✓ Branch 1 taken 2623 times.
✓ Branch 2 taken 3429091 times.
✓ Branch 3 taken 103833 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 3532924 times.
|
3534443 | || ((attack==wWand || attack==wCByrna) && guys.spr(i)->hit(wx,wy-8,z,16,24,z>8) && !(itemsbuf[itemid].flags & item_flag3)) |
| 3636 |
4/4✓ Branch 0 taken 125406 times.
✓ Branch 1 taken 3407518 times.
✓ Branch 2 taken 571 times.
✓ Branch 3 taken 124835 times.
|
3532924 | || (attack==wHammer && guys.spr(i)->hit(wx,wy-8,z,16,24,z>0?16:8) && !(itemsbuf[itemid].flags & item_flag3))) |
| 3637 | { | ||
| 3638 | // Checking the whimsical ring for every collision check causes | ||
| 3639 | // an odd bug. It's much more likely to activate on a 0-damage | ||
| 3640 | // weapon, since a 0-damage hit won't make the enemy invulnerable | ||
| 3641 | // to damaging hits in the following frames. | ||
| 3642 | |||
| 3643 | 77344 | int32_t whimsyid = current_item_id(itype_whimsicalring); | |
| 3644 | |||
| 3645 | 77344 | int32_t dmg = weaponattackpower(itemid); | |
| 3646 |
2/2✓ Branch 0 taken 75435 times.
✓ Branch 1 taken 1909 times.
|
77344 | if(whimsyid>-1) |
| 3647 | { | ||
| 3648 |
3/4✓ Branch 0 taken 1909 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1793 times.
✓ Branch 3 taken 116 times.
|
1909 | if(!(zc_oldrand()%zc_max(itemsbuf[whimsyid].misc1,1))) |
| 3649 | 116 | dmg += current_item_power(itype_whimsicalring); | |
| 3650 | 1793 | else whimsyid = -1; | |
| 3651 | 1909 | } | |
| 3652 | 77344 | int32_t atkringid = current_item_id(itype_atkring); | |
| 3653 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 77336 times.
|
77344 | if(atkringid>-1) |
| 3654 | { | ||
| 3655 | 8 | dmg *= itemsbuf[atkringid].misc2; //Multiplier | |
| 3656 | 8 | dmg += itemsbuf[atkringid].misc1; //Additive | |
| 3657 | 8 | } | |
| 3658 | |||
| 3659 | 77344 | int32_t h = hit_enemy(i,attack,dmg*game->get_hero_dmgmult(),wx,wy,dir,directWpn,w); | |
| 3660 | 77344 | enemy *e = (enemy*)guys.spr(i); | |
| 3661 |
2/2✓ Branch 0 taken 20168 times.
✓ Branch 1 taken 57176 times.
|
77344 | if (h < 0) |
| 3662 | { | ||
| 3663 | 57176 | e->hitby[HIT_BY_LWEAPON] = melee_weapon_index; | |
| 3664 | 57176 | e->hitby[HIT_BY_LWEAPON_UID] = w->getUID(); | |
| 3665 | 57176 | e->hitby[HIT_BY_LWEAPON_TYPE] = w->id; | |
| 3666 |
1/2✓ Branch 0 taken 57176 times.
✗ Branch 1 not taken.
|
57176 | if (w->parentitem > -1) e->hitby[HIT_BY_LWEAPON_PARENT_FAMILY] = itemsbuf[w->parentitem].type; |
| 3667 | ✗ | else e->hitby[HIT_BY_LWEAPON_PARENT_FAMILY] = -1; | |
| 3668 | 57176 | e->hitby[HIT_BY_LWEAPON_PARENT_ID] = w->parentitem; | |
| 3669 | 57176 | e->hitby[HIT_BY_LWEAPON_ENGINE_UID] = w->getUID(); | |
| 3670 | 57176 | } //temp_hit = true; } | |
| 3671 | //melee weapons and non-melee weapons both writing to this index may be a problem. It needs to be cleared by something earlier than this check. | ||
| 3672 | |||
| 3673 |
4/4✓ Branch 0 taken 57176 times.
✓ Branch 1 taken 20168 times.
✓ Branch 2 taken 75 times.
✓ Branch 3 taken 57101 times.
|
77344 | if(h<0 && whimsyid>-1) |
| 3674 | { | ||
| 3675 | 75 | sfx(itemsbuf[whimsyid].usesound); | |
| 3676 | 75 | } | |
| 3677 | |||
| 3678 |
4/4✓ Branch 0 taken 65912 times.
✓ Branch 1 taken 11432 times.
✓ Branch 2 taken 65340 times.
✓ Branch 3 taken 572 times.
|
77344 | if(h && charging>0) |
| 3679 | { | ||
| 3680 | 572 | attackclk = SWORDTAPFRAME; | |
| 3681 | 572 | spins=0; | |
| 3682 | 572 | } | |
| 3683 | |||
| 3684 |
8/8✓ Branch 0 taken 65912 times.
✓ Branch 1 taken 11432 times.
✓ Branch 2 taken 56015 times.
✓ Branch 3 taken 9897 times.
✓ Branch 4 taken 55977 times.
✓ Branch 5 taken 38 times.
✓ Branch 6 taken 1217 times.
✓ Branch 7 taken 54760 times.
|
77344 | if(h && hclk==0 && inlikelike != 1 && !get_qr(qr_DYING_ENEMIES_IGNORE_STUN)) |
| 3685 | { | ||
| 3686 |
2/2✓ Branch 0 taken 54603 times.
✓ Branch 1 taken 157 times.
|
54760 | if(GuyHit(i,x+7,y+7-fakez,z,2,2,hzsz)!=-1) |
| 3687 | { | ||
| 3688 | 157 | hithero(i); | |
| 3689 | 157 | } | |
| 3690 | 54760 | } | |
| 3691 | |||
| 3692 |
2/2✓ Branch 0 taken 70068 times.
✓ Branch 1 taken 7276 times.
|
77344 | if(abs(h)==2) |
| 3693 | 7276 | break; | |
| 3694 | 70068 | } | |
| 3695 | 3602992 | } | |
| 3696 | |||
| 3697 |
2/2✓ Branch 0 taken 19100 times.
✓ Branch 1 taken 841785 times.
|
1722988 | if(attack == wBugNet |
| 3698 |
3/4✓ Branch 0 taken 860885 times.
✓ Branch 1 taken 1218 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 860885 times.
|
862103 | || (parentitem==-1&&!get_qr(qr_NOITEMMELEE)) |
| 3699 |
1/2✓ Branch 0 taken 860885 times.
✗ Branch 1 not taken.
|
860885 | || (parentitem>-1&&!(itemsbuf[parentitem].flags & item_flag7))) |
| 3700 | { | ||
| 3701 |
3/4✓ Branch 0 taken 842889 times.
✓ Branch 1 taken 114 times.
✓ Branch 2 taken 114 times.
✗ Branch 3 not taken.
|
843003 | int32_t bugnetid = attack != wBugNet ? -1 : (parentitem > -1 ? parentitem : current_item_id(itype_bugnet)); |
| 3702 |
2/2✓ Branch 0 taken 843003 times.
✓ Branch 1 taken 280579 times.
|
1123582 | for(int32_t j=0; j<items.Count(); j++) |
| 3703 | { | ||
| 3704 | 280579 | item* ptr = (item*)items.spr(j); | |
| 3705 |
2/2✓ Branch 0 taken 20 times.
✓ Branch 1 taken 280559 times.
|
280580 | bool dofairy = (attack==wBugNet && itemsbuf[ptr->id].type == itype_fairy) |
| 3706 |
3/4✓ Branch 0 taken 19 times.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
|
20 | && (bugnetid > -1 && !(itemsbuf[bugnetid].flags & item_flag1)); |
| 3707 | |||
| 3708 |
2/4✓ Branch 0 taken 280579 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 280579 times.
✗ Branch 3 not taken.
|
280579 | if((itemsbuf[ptr->id].type == itype_bottlefill || dofairy) && !game->hasBottle(0)) |
| 3709 | ✗ | continue; //No picking these up unless you have a bottle to fill! | |
| 3710 |
5/6✓ Branch 0 taken 280552 times.
✓ Branch 1 taken 27 times.
✓ Branch 2 taken 52238 times.
✓ Branch 3 taken 228314 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 52238 times.
|
280579 | if((ptr->pickup & ipCANGRAB) || (ptr->pickup & ipTIMER) || dofairy) |
| 3711 | { | ||
| 3712 |
7/8✓ Branch 0 taken 228314 times.
✓ Branch 1 taken 27 times.
✓ Branch 2 taken 109724 times.
✓ Branch 3 taken 118590 times.
✓ Branch 4 taken 118617 times.
✓ Branch 5 taken 109724 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 118617 times.
|
228341 | if(((ptr->pickup & ipCANGRAB) || ptr->clk2 >= game->get_item_spawn_flicker() || dofairy) && !ptr->fallclk && !ptr->drownclk) |
| 3713 | { | ||
| 3714 |
6/6✓ Branch 0 taken 110946 times.
✓ Branch 1 taken 7671 times.
✓ Branch 2 taken 981 times.
✓ Branch 3 taken 109965 times.
✓ Branch 4 taken 110931 times.
✓ Branch 5 taken 7686 times.
|
229560 | if(ptr->hit(wx,wy,z,wxsz,wysz,1) || (attack==wWand && ptr->hit(x,y-8-fakez,z,wxsz,wysz,1)) |
| 3715 |
4/4✓ Branch 0 taken 3 times.
✓ Branch 1 taken 978 times.
✓ Branch 2 taken 108138 times.
✓ Branch 3 taken 2805 times.
|
110946 | || (attack==wHammer && ptr->hit(x,y-8-fakez,z,wxsz,wysz,1))) |
| 3716 | { | ||
| 3717 | 7686 | int screen = get_screen_for_world_xy(wx, wy); | |
| 3718 | 7686 | mapscr* scr = get_scr_for_world_xy(wx, wy); | |
| 3719 | 7686 | int32_t pickup = ptr->pickup; | |
| 3720 | 7686 | int32_t id2 = ptr->id; | |
| 3721 | 7686 | int32_t pstr = ptr->pstring; | |
| 3722 | 7686 | int32_t pstr_flags = ptr->pickup_string_flags; | |
| 3723 | 7686 | int32_t pstr_screen = ptr->screen_spawned; | |
| 3724 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 7685 times.
|
7686 | if(!dofairy) |
| 3725 | { | ||
| 3726 | 7685 | std::vector<int32_t> &ev = FFCore.eventData; | |
| 3727 | 7685 | ev.clear(); | |
| 3728 | 7685 | ev.push_back(id2*10000); | |
| 3729 | 7685 | ev.push_back(pickup*10000); | |
| 3730 | 7685 | ev.push_back(pstr*10000); | |
| 3731 | 7685 | ev.push_back(pstr_flags*10000); | |
| 3732 | 7685 | ev.push_back(0); | |
| 3733 | 7685 | ev.push_back(ptr->getUID()); | |
| 3734 | 7685 | ev.push_back(GENEVT_ICTYPE_MELEE*10000); | |
| 3735 | 7685 | ev.push_back(w->getUID()); | |
| 3736 | |||
| 3737 | 7685 | throwGenScriptEvent(GENSCR_EVENT_COLLECT_ITEM); | |
| 3738 | 7685 | bool nullify = ev[4] != 0; | |
| 3739 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7685 times.
|
7685 | if(nullify) continue; |
| 3740 | 7685 | id2 = ev[0]/10000; | |
| 3741 | 7685 | pickup = (pickup&(ipCHECK|ipDUMMY)) | (ev[1]/10000); | |
| 3742 | 7685 | pstr = ev[2] / 10000; | |
| 3743 | 7685 | pstr_flags = ev[3] / 10000; | |
| 3744 | 7685 | } | |
| 3745 | |||
| 3746 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7686 times.
|
7686 | if(pickup&ipONETIME) // set mITEM for one-time-only items |
| 3747 | ✗ | setmapflag(scr, mITEM); | |
| 3748 |
1/2✓ Branch 0 taken 7686 times.
✗ Branch 1 not taken.
|
7686 | else if(pickup&ipONETIME2) // set mSPECIALITEM flag for other one-time-only items |
| 3749 | ✗ | setmapflag(scr, (cur_screen < 128 && get_qr(qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM); | |
| 3750 | |||
| 3751 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 7686 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
7686 | if(ptr->pickupexstate > -1 && ptr->pickupexstate < 32) |
| 3752 | ✗ | setxmapflag(screen, 1<<ptr->pickupexstate); | |
| 3753 |
1/2✓ Branch 0 taken 7686 times.
✗ Branch 1 not taken.
|
7686 | if(pickup&ipSECRETS) // Trigger secrets if this item has the secret pickup |
| 3754 | { | ||
| 3755 | ✗ | if (scr->flags9&fITEMSECRETPERM) setmapflag(scr, mSECRET); | |
| 3756 | ✗ | trigger_secrets_for_screen(TriggerSource::ItemsSecret, scr, false); | |
| 3757 | ✗ | } | |
| 3758 | //!DIMI | ||
| 3759 | |||
| 3760 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 7685 times.
|
7686 | if(dofairy) |
| 3761 | { | ||
| 3762 | 1 | game->fillBottle(itemsbuf[ptr->id].misc4); | |
| 3763 | 1 | } | |
| 3764 | else | ||
| 3765 | { | ||
| 3766 | 7685 | collectitem_script(id2); | |
| 3767 | |||
| 3768 | 7685 | getitem(id2, ptr->noSound, true); | |
| 3769 | } | ||
| 3770 | 7686 | items.del(j); | |
| 3771 | |||
| 3772 |
2/2✓ Branch 0 taken 10379 times.
✓ Branch 1 taken 7686 times.
|
18065 | for(int32_t i=0; i<Lwpns.Count(); i++) |
| 3773 | { | ||
| 3774 | 10379 | weapon *w2 = (weapon*)Lwpns.spr(i); | |
| 3775 | |||
| 3776 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10379 times.
|
10379 | if(w2->dragging==j) |
| 3777 | { | ||
| 3778 | ✗ | w2->dragging=-1; | |
| 3779 | ✗ | } | |
| 3780 |
1/2✓ Branch 0 taken 10379 times.
✗ Branch 1 not taken.
|
10379 | else if(w2->dragging>j) |
| 3781 | { | ||
| 3782 | ✗ | w2->dragging-=1; | |
| 3783 | ✗ | } | |
| 3784 | 10379 | } | |
| 3785 | |||
| 3786 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 7686 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
7686 | if ( (pstr > 0 && pstr < msg_count) ) |
| 3787 | { | ||
| 3788 | ✗ | if ( ( (!(pstr_flags&itemdataPSTRING_IP_HOLDUP)) && ( pstr_flags&itemdataPSTRING_NOMARK || pstr_flags&itemdataPSTRING_ALWAYS || (!(FFCore.GetItemMessagePlayed(id2))) ) ) ) | |
| 3789 | { | ||
| 3790 | ✗ | if ( (!(pstr_flags&itemdataPSTRING_NOMARK)) ) | |
| 3791 | ✗ | FFCore.SetItemMessagePlayed(id2); | |
| 3792 | ✗ | donewmsg(get_scr(pstr_screen), pstr); | |
| 3793 | ✗ | break; | |
| 3794 | } | ||
| 3795 | ✗ | } | |
| 3796 | |||
| 3797 | 7686 | --j; | |
| 3798 | 7686 | } | |
| 3799 | 118617 | } | |
| 3800 | 228341 | } | |
| 3801 | 280579 | } | |
| 3802 | 843003 | } | |
| 3803 | |||
| 3804 |
4/4✓ Branch 0 taken 860981 times.
✓ Branch 1 taken 1122 times.
✓ Branch 2 taken 114 times.
✓ Branch 3 taken 860867 times.
|
862103 | if(attack==wCByrna || attack==wBugNet) |
| 3805 | 1236 | return false; | |
| 3806 | |||
| 3807 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 860867 times.
|
860867 | if(meleeweap->no_triggers()) |
| 3808 | ✗ | return false; | |
| 3809 | |||
| 3810 |
2/2✓ Branch 0 taken 808780 times.
✓ Branch 1 taken 52087 times.
|
860867 | if(attack==wSword) |
| 3811 | { | ||
| 3812 |
2/2✓ Branch 0 taken 718315 times.
✓ Branch 1 taken 90465 times.
|
808780 | if(attackclk == 6) |
| 3813 | { | ||
| 3814 |
2/2✓ Branch 0 taken 15921840 times.
✓ Branch 1 taken 90465 times.
|
16012305 | for(int32_t q=0; q<176; q++) |
| 3815 | { | ||
| 3816 | 15921840 | set_bit(screengrid,q,0); | |
| 3817 | 15921840 | set_bit(screengrid_layer[0],q,0); | |
| 3818 | 15921840 | set_bit(screengrid_layer[1],q,0); | |
| 3819 | 15921840 | } | |
| 3820 | |||
| 3821 | 2741393 | for_every_ffc([&](const ffc_handle_t& ffc_handle) { | |
| 3822 | 2650928 | ffc_handle.ffc->recently_hit = false; | |
| 3823 | 2650928 | }); | |
| 3824 | 90465 | } | |
| 3825 | |||
| 3826 |
4/4✓ Branch 0 taken 163642 times.
✓ Branch 1 taken 645138 times.
✓ Branch 2 taken 74052 times.
✓ Branch 3 taken 89590 times.
|
808780 | if(dir==up && ((x.getInt()&15)==0)) |
| 3827 | { | ||
| 3828 | 74052 | check_slash_block(wx,wy); | |
| 3829 | 74052 | check_slash_block(wx,wy+8); | |
| 3830 | |||
| 3831 | //layers | ||
| 3832 | 74052 | check_slash_block_layer(wx,wy,1); | |
| 3833 | 74052 | check_slash_block_layer(wx,wy+8,1); | |
| 3834 | 74052 | check_slash_block_layer(wx,wy,1); | |
| 3835 | 74052 | check_slash_block_layer(wx,wy+8,1); | |
| 3836 | //2 | ||
| 3837 | 74052 | check_slash_block_layer(wx,wy,2); | |
| 3838 | 74052 | check_slash_block_layer(wx,wy+8,2); | |
| 3839 | 74052 | check_slash_block_layer(wx,wy,2); | |
| 3840 | 74052 | check_slash_block_layer(wx,wy+8,2); | |
| 3841 | 74052 | } | |
| 3842 |
8/10✓ Branch 0 taken 89590 times.
✓ Branch 1 taken 645138 times.
✓ Branch 2 taken 30943 times.
✓ Branch 3 taken 58647 times.
✓ Branch 4 taken 240 times.
✓ Branch 5 taken 30703 times.
✓ Branch 6 taken 240 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 240 times.
|
734728 | else if(dir==up && ((x.getInt()&15)==8||diagonalMovement||NO_GRIDLOCK)) |
| 3843 | { | ||
| 3844 | 89350 | check_slash_block(wx,wy); | |
| 3845 | 89350 | check_slash_block(wx,wy+8); | |
| 3846 | 89350 | check_slash_block(wx+8,wy); | |
| 3847 | 89350 | check_slash_block(wx+8,wy+8); | |
| 3848 | ///layer 1 | ||
| 3849 | 89350 | check_slash_block_layer(wx,wy,1); | |
| 3850 | 89350 | check_slash_block_layer(wx,wy+8,1); | |
| 3851 | 89350 | check_slash_block_layer(wx+8,wy,1); | |
| 3852 | 89350 | check_slash_block_layer(wx+8,wy+8,1); | |
| 3853 | ///layer 2 | ||
| 3854 | 89350 | check_slash_block_layer(wx,wy,2); | |
| 3855 | 89350 | check_slash_block_layer(wx,wy+8,2); | |
| 3856 | 89350 | check_slash_block_layer(wx+8,wy,2); | |
| 3857 | 89350 | check_slash_block_layer(wx+8,wy+8,2); | |
| 3858 | 89350 | } | |
| 3859 |
4/4✓ Branch 0 taken 174722 times.
✓ Branch 1 taken 634058 times.
✓ Branch 2 taken 93610 times.
✓ Branch 3 taken 81112 times.
|
808780 | if(dir==down && ((x.getInt()&15)==0)) |
| 3860 | { | ||
| 3861 | 81112 | check_slash_block(wx,wy+wysz-8); | |
| 3862 | 81112 | check_slash_block(wx,wy+wysz); | |
| 3863 | |||
| 3864 | //layer 1 | ||
| 3865 | 81112 | check_slash_block_layer(wx,wy+wysz-8,1); | |
| 3866 | 81112 | check_slash_block_layer(wx,wy+wysz,1); | |
| 3867 | //layer 2 | ||
| 3868 | 81112 | check_slash_block_layer(wx,wy+wysz-8,2); | |
| 3869 | 81112 | check_slash_block_layer(wx,wy+wysz,2); | |
| 3870 | 81112 | } | |
| 3871 |
8/10✓ Branch 0 taken 93610 times.
✓ Branch 1 taken 634058 times.
✓ Branch 2 taken 41708 times.
✓ Branch 3 taken 51902 times.
✓ Branch 4 taken 333 times.
✓ Branch 5 taken 41375 times.
✓ Branch 6 taken 333 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 333 times.
|
727668 | else if(dir==down && ((x.getInt()&15)==8||diagonalMovement||NO_GRIDLOCK)) |
| 3872 | { | ||
| 3873 | 93277 | check_slash_block(wx,wy+wysz-8); | |
| 3874 | 93277 | check_slash_block(wx,wy+wysz); | |
| 3875 | 93277 | check_slash_block(wx+8,wy+wysz-8); | |
| 3876 | 93277 | check_slash_block(wx+8,wy+wysz); | |
| 3877 | //layer 1 | ||
| 3878 | 93277 | check_slash_block_layer(wx,wy+wysz-8,1); | |
| 3879 | 93277 | check_slash_block_layer(wx,wy+wysz,1); | |
| 3880 | 93277 | check_slash_block_layer(wx+8,wy+wysz-8,1); | |
| 3881 | 93277 | check_slash_block_layer(wx+8,wy+wysz,1); | |
| 3882 | //layer 2 | ||
| 3883 | 93277 | check_slash_block_layer(wx,wy+wysz-8,2); | |
| 3884 | 93277 | check_slash_block_layer(wx,wy+wysz,2); | |
| 3885 | 93277 | check_slash_block_layer(wx+8,wy+wysz-8,2); | |
| 3886 | 93277 | check_slash_block_layer(wx+8,wy+wysz,2); | |
| 3887 | 93277 | } | |
| 3888 | |||
| 3889 |
2/2✓ Branch 0 taken 573138 times.
✓ Branch 1 taken 235642 times.
|
808780 | if(dir==left) |
| 3890 | { | ||
| 3891 | 235642 | check_slash_block(wx,wy+8); | |
| 3892 | 235642 | check_slash_block(wx+8,wy+8); | |
| 3893 | //layer 1 | ||
| 3894 | 235642 | check_slash_block_layer(wx,wy+8,1); | |
| 3895 | 235642 | check_slash_block_layer(wx+8,wy+8,1); | |
| 3896 | //layer 2 | ||
| 3897 | 235642 | check_slash_block_layer(wx,wy+8,2); | |
| 3898 | 235642 | check_slash_block_layer(wx+8,wy+8,2); | |
| 3899 | 235642 | } | |
| 3900 | |||
| 3901 |
2/2✓ Branch 0 taken 574006 times.
✓ Branch 1 taken 234774 times.
|
808780 | if(dir==right) |
| 3902 | { | ||
| 3903 | 234774 | check_slash_block(wx+wxsz,wy+8); | |
| 3904 | 234774 | check_slash_block(wx+wxsz-8,wy+8); | |
| 3905 | //layer 1 | ||
| 3906 | 234774 | check_slash_block_layer(wx+wxsz,wy+8,1); | |
| 3907 | 234774 | check_slash_block_layer(wx+wxsz-8,wy+8,1); | |
| 3908 | //layer 2 | ||
| 3909 | 234774 | check_slash_block_layer(wx+wxsz,wy+8,2); | |
| 3910 | 234774 | check_slash_block_layer(wx+wxsz-8,wy+8,2); | |
| 3911 | 234774 | } | |
| 3912 | 808780 | } | |
| 3913 |
2/2✓ Branch 0 taken 16297 times.
✓ Branch 1 taken 35790 times.
|
52087 | else if(attack==wWand) |
| 3914 | { | ||
| 3915 |
1/2✓ Branch 0 taken 16297 times.
✗ Branch 1 not taken.
|
16297 | if(attackclk == 5) |
| 3916 | { | ||
| 3917 | ✗ | for(int32_t q=0; q<176; q++) | |
| 3918 | { | ||
| 3919 | ✗ | set_bit(screengrid,q,0); | |
| 3920 | ✗ | set_bit(screengrid_layer[0],q,0); | |
| 3921 | ✗ | set_bit(screengrid_layer[1],q,0); | |
| 3922 | ✗ | } | |
| 3923 | |||
| 3924 | ✗ | for_every_ffc([&](const ffc_handle_t& ffc_handle) { | |
| 3925 | ✗ | ffc_handle.ffc->recently_hit = false; | |
| 3926 | ✗ | }); | |
| 3927 | ✗ | } | |
| 3928 | |||
| 3929 | // cutable blocks | ||
| 3930 |
4/4✓ Branch 0 taken 3074 times.
✓ Branch 1 taken 13223 times.
✓ Branch 2 taken 1386 times.
✓ Branch 3 taken 1688 times.
|
16297 | if(dir==up && (x.getInt()&15)==0) |
| 3931 | { | ||
| 3932 | 1386 | check_wand_block(wx,wy); | |
| 3933 | 1386 | check_wand_block(wx,wy+8); | |
| 3934 | 1386 | } | |
| 3935 |
5/10✓ Branch 0 taken 1688 times.
✓ Branch 1 taken 13223 times.
✓ Branch 2 taken 813 times.
✓ Branch 3 taken 875 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 813 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
14911 | else if(dir==up && ((x.getInt()&15)==8||diagonalMovement||NO_GRIDLOCK)) |
| 3936 | { | ||
| 3937 | 1688 | check_wand_block(wx,wy); | |
| 3938 | 1688 | check_wand_block(wx,wy+8); | |
| 3939 | 1688 | check_wand_block(wx+8,wy); | |
| 3940 | 1688 | check_wand_block(wx+8,wy+8); | |
| 3941 | 1688 | } | |
| 3942 | |||
| 3943 |
4/4✓ Branch 0 taken 2366 times.
✓ Branch 1 taken 13931 times.
✓ Branch 2 taken 1135 times.
✓ Branch 3 taken 1231 times.
|
16297 | if(dir==down && (x.getInt()&15)==0) |
| 3944 | { | ||
| 3945 | 1231 | check_wand_block(wx,wy+wysz-8); | |
| 3946 | 1231 | check_wand_block(wx,wy+wysz); | |
| 3947 | 1231 | } | |
| 3948 |
5/10✓ Branch 0 taken 1135 times.
✓ Branch 1 taken 13931 times.
✓ Branch 2 taken 307 times.
✓ Branch 3 taken 828 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 307 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
15066 | else if(dir==down && ((x.getInt()&15)==8||diagonalMovement||NO_GRIDLOCK)) |
| 3949 | { | ||
| 3950 | 1135 | check_wand_block(wx,wy+wysz-8); | |
| 3951 | 1135 | check_wand_block(wx,wy+wysz); | |
| 3952 | 1135 | check_wand_block(wx+8,wy+wysz-8); | |
| 3953 | 1135 | check_wand_block(wx+8,wy+wysz); | |
| 3954 | 1135 | } | |
| 3955 | |||
| 3956 |
2/2✓ Branch 0 taken 10184 times.
✓ Branch 1 taken 6113 times.
|
16297 | if(dir==left) |
| 3957 | { | ||
| 3958 | 6113 | check_wand_block(wx,y+8); | |
| 3959 | 6113 | check_wand_block(wx+8,y+8); | |
| 3960 | 6113 | } | |
| 3961 | |||
| 3962 |
2/2✓ Branch 0 taken 11553 times.
✓ Branch 1 taken 4744 times.
|
16297 | if(dir==right) |
| 3963 | { | ||
| 3964 | 4744 | check_wand_block(wx+wxsz,y+8); | |
| 3965 | 4744 | check_wand_block(wx+wxsz-8,y+8); | |
| 3966 | 4744 | } | |
| 3967 | 16297 | } | |
| 3968 |
6/8✓ Branch 0 taken 35790 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 33517 times.
✓ Branch 3 taken 2273 times.
✓ Branch 4 taken 96 times.
✓ Branch 5 taken 33421 times.
✓ Branch 6 taken 96 times.
✗ Branch 7 not taken.
|
35790 | else if((attack==wHammer) && ((attackclk==15) || ( spins>0 && attackclk >=15 ))) |
| 3969 | { | ||
| 3970 | // poundable blocks | ||
| 3971 |
2/2✓ Branch 0 taken 416944 times.
✓ Branch 1 taken 2369 times.
|
419313 | for(int32_t q=0; q<176; q++) |
| 3972 | { | ||
| 3973 | 416944 | set_bit(screengrid,q,0); | |
| 3974 | 416944 | set_bit(screengrid_layer[0],q,0); | |
| 3975 | 416944 | set_bit(screengrid_layer[1],q,0); | |
| 3976 | 416944 | } | |
| 3977 | |||
| 3978 | 70379 | for_every_ffc([&](const ffc_handle_t& ffc_handle) { | |
| 3979 | 68010 | ffc_handle.ffc->recently_hit = false; | |
| 3980 | 68010 | }); | |
| 3981 | |||
| 3982 |
4/4✓ Branch 0 taken 420 times.
✓ Branch 1 taken 1949 times.
✓ Branch 2 taken 236 times.
✓ Branch 3 taken 184 times.
|
2369 | if(dir==up && (x.getInt()&15)==0) |
| 3983 | { | ||
| 3984 | 184 | check_pound_block(wx,wy); | |
| 3985 | 184 | check_pound_block(wx,wy+8); | |
| 3986 | 184 | } | |
| 3987 |
5/10✓ Branch 0 taken 236 times.
✓ Branch 1 taken 1949 times.
✓ Branch 2 taken 104 times.
✓ Branch 3 taken 132 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 104 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
2185 | else if(dir==up && ((x.getInt()&15)==8||diagonalMovement||NO_GRIDLOCK)) |
| 3988 | { | ||
| 3989 | 236 | check_pound_block(wx,wy); | |
| 3990 | 236 | check_pound_block(wx,wy+8); | |
| 3991 | 236 | check_pound_block(wx+8,wy); | |
| 3992 | 236 | check_pound_block(wx+8,wy+8); | |
| 3993 | 236 | } | |
| 3994 | |||
| 3995 |
4/4✓ Branch 0 taken 528 times.
✓ Branch 1 taken 1841 times.
✓ Branch 2 taken 281 times.
✓ Branch 3 taken 247 times.
|
2369 | if(dir==down && (x.getInt()&15)==0) |
| 3996 | { | ||
| 3997 | 247 | check_pound_block(wx,wy+wysz-8); | |
| 3998 | 247 | check_pound_block(wx,wy+wysz); | |
| 3999 | 247 | } | |
| 4000 |
8/10✓ Branch 0 taken 281 times.
✓ Branch 1 taken 1841 times.
✓ Branch 2 taken 128 times.
✓ Branch 3 taken 153 times.
✓ Branch 4 taken 1 times.
✓ Branch 5 taken 127 times.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 1 times.
|
2122 | else if(dir==down && ((x.getInt()&15)==8||diagonalMovement||NO_GRIDLOCK)) |
| 4001 | { | ||
| 4002 | 280 | check_pound_block(wx,wy+wysz-8); | |
| 4003 | 280 | check_pound_block(wx,wy+wysz); | |
| 4004 | 280 | check_pound_block(wx+8,wy+wysz-8); | |
| 4005 | 280 | check_pound_block(wx+8,wy+wysz); | |
| 4006 | 280 | } | |
| 4007 | |||
| 4008 |
2/2✓ Branch 0 taken 1602 times.
✓ Branch 1 taken 767 times.
|
2369 | if(dir==left) |
| 4009 | { | ||
| 4010 | 767 | check_pound_block(wx,y+8); | |
| 4011 | 767 | check_pound_block(wx+8,y+8); | |
| 4012 | 767 | } | |
| 4013 | |||
| 4014 |
2/2✓ Branch 0 taken 1715 times.
✓ Branch 1 taken 654 times.
|
2369 | if(dir==right) |
| 4015 | { | ||
| 4016 | 654 | check_pound_block(wx+wxsz,y+8); | |
| 4017 | 654 | check_pound_block(wx+wxsz-8,y+8); | |
| 4018 | 654 | } | |
| 4019 | 2369 | } | |
| 4020 | 33421 | else return false; | |
| 4021 | |||
| 4022 | 827446 | return true; | |
| 4023 | 14836547 | } | |
| 4024 | |||
| 4025 | 4259544 | void HeroClass::check_slash_block_layer(int32_t bx, int32_t by, int32_t layer) | |
| 4026 | { | ||
| 4027 |
2/2✓ Branch 0 taken 3847388 times.
✓ Branch 1 taken 412156 times.
|
4259544 | if(!(get_qr(qr_BUSHESONLAYERS1AND2))) |
| 4028 | { | ||
| 4029 | 3847388 | return; | |
| 4030 | } | ||
| 4031 | //keep things inside the screen boundaries | ||
| 4032 | 412156 | bx=vbound(bx, 0, world_w-1); | |
| 4033 | 412156 | by=vbound(by, 0, world_h-1); | |
| 4034 | 412156 | int32_t fx=bx; | |
| 4035 | 412156 | int32_t fy=by; | |
| 4036 | //first things first | ||
| 4037 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 412156 times.
|
412156 | if(attack!=wSword) |
| 4038 | ✗ | return; | |
| 4039 | |||
| 4040 |
4/6✓ Branch 0 taken 412156 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 412156 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3548 times.
✓ Branch 5 taken 41372 times.
|
457076 | if(z>8||fakez>8 || attackclk==SWORDCHARGEFRAME // is not charging>0, as tapping a wall reduces attackclk but retains charging |
| 4041 |
4/4✓ Branch 0 taken 367780 times.
✓ Branch 1 taken 44376 times.
✓ Branch 2 taken 44920 times.
✓ Branch 3 taken 322860 times.
|
412156 | || (attackclk>SWORDTAPFRAME && tapping)) |
| 4042 | 47924 | return; | |
| 4043 | |||
| 4044 | //find out which combo row/column the coordinates are in | ||
| 4045 | 364232 | bx = TRUNCATE_TILE(bx); | |
| 4046 | 364232 | by = TRUNCATE_TILE(by); | |
| 4047 | |||
| 4048 | 364232 | int32_t flag = MAPFLAGL(layer,bx,by); | |
| 4049 | 364232 | int32_t flag2 = MAPCOMBOFLAGL(layer,bx,by); | |
| 4050 | 364232 | int32_t cid = MAPCOMBOL(layer,bx,by); | |
| 4051 | 364232 | int32_t type = combobuf[cid].type; | |
| 4052 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 364232 times.
|
364232 | if(combobuf[cid].only_gentrig) |
| 4053 | ✗ | type = cNONE; | |
| 4054 | |||
| 4055 | 364232 | auto rpos_handle = get_rpos_handle_for_world_xy(bx, by, layer); | |
| 4056 | 364232 | int screen = rpos_handle.screen; | |
| 4057 | 364232 | mapscr* s = rpos_handle.scr; | |
| 4058 | 364232 | int i = rpos_handle.pos; | |
| 4059 | |||
| 4060 | 364232 | bool ignorescreen=false; | |
| 4061 | |||
| 4062 |
4/4✓ Branch 0 taken 354732 times.
✓ Branch 1 taken 9500 times.
✓ Branch 2 taken 352091 times.
✓ Branch 3 taken 2641 times.
|
364232 | if((get_bit(screengrid_layer[layer-1], i) != 0) || (!isCuttableType(type))) |
| 4063 | 361591 | return; | |
| 4064 | |||
| 4065 |
4/4✓ Branch 0 taken 2454 times.
✓ Branch 1 taken 187 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 2452 times.
|
2641 | int32_t sworditem = (directWpn>-1 && itemsbuf[directWpn].type==itype_sword) ? itemsbuf[directWpn].level : current_item(itype_sword); |
| 4066 | |||
| 4067 |
3/4✓ Branch 0 taken 2541 times.
✓ Branch 1 taken 100 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2541 times.
|
2641 | if(!isTouchyType(type) && !get_qr(qr_CONT_SWORD_TRIGGERS)) set_bit(screengrid_layer[layer-1],i,1); |
| 4068 |
2/2✓ Branch 0 taken 2599 times.
✓ Branch 1 taken 42 times.
|
2641 | if(isCuttableNextType(type)) |
| 4069 | { | ||
| 4070 | 2599 | s->data[i]++; | |
| 4071 | 2599 | } | |
| 4072 | else | ||
| 4073 | { | ||
| 4074 | 42 | s->data[i] = s->undercombo; | |
| 4075 | 42 | s->cset[i] = s->undercset; | |
| 4076 | 42 | s->sflag[i] = 0; | |
| 4077 | } | ||
| 4078 |
2/8✓ Branch 0 taken 2641 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2641 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
2641 | if((flag==mfARMOS_ITEM||flag2==mfARMOS_ITEM) && (!getmapflag(screen, (screen < 128 && get_qr(qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM) || (s->flags9&fBELOWRETURN))) |
| 4079 | { | ||
| 4080 | ✗ | items.add(new item((zfix)bx, (zfix)by,(zfix)0, s->catchall, ipONETIME2 + ipBIGRANGE + ipHOLDUP | ((s->flags8&fITEMSECRET) ? ipSECRETS : 0), 0)); | |
| 4081 | ✗ | sfx(s->secretsfx); | |
| 4082 | ✗ | } | |
| 4083 |
2/2✓ Branch 0 taken 26 times.
✓ Branch 1 taken 2615 times.
|
2641 | else if(isCuttableItemType(type)) |
| 4084 | { | ||
| 4085 | 2615 | int32_t it = -1; | |
| 4086 | 2615 | int32_t thedropset = -1; | |
| 4087 | |||
| 4088 | //select_dropitem( (combobuf[MAPCOMBO(bx,by)-1].usrflags&cflag2) ? (combobuf[MAPCOMBO(bx,by)-1].attributes[1])/10000L : 12, bx, by); | ||
| 4089 |
2/2✓ Branch 0 taken 2304 times.
✓ Branch 1 taken 311 times.
|
2615 | if ( (combobuf[cid].usrflags&cflag2) ) |
| 4090 | { | ||
| 4091 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2304 times.
|
2304 | if(combobuf[cid].usrflags&cflag11) |
| 4092 | ✗ | it = combobuf[cid].attribytes[1]; | |
| 4093 | else | ||
| 4094 | { | ||
| 4095 | 2304 | it = select_dropitem(combobuf[cid].attribytes[1]); | |
| 4096 | 2304 | thedropset = combobuf[cid].attribytes[1]; | |
| 4097 | } | ||
| 4098 | 2304 | } | |
| 4099 | else | ||
| 4100 | { | ||
| 4101 | 311 | it = select_dropitem(12); | |
| 4102 | 311 | thedropset = 12; | |
| 4103 | } | ||
| 4104 |
2/2✓ Branch 0 taken 1554 times.
✓ Branch 1 taken 1061 times.
|
2615 | if(it!=-1) |
| 4105 | { | ||
| 4106 |
4/8✓ Branch 0 taken 1061 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1061 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1061 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1061 times.
✗ Branch 7 not taken.
|
1061 | item* itm = (new item((zfix)bx, (zfix)by,(zfix)0, it, ipBIGRANGE + ipTIMER, 0)); |
| 4107 | 1061 | itm->from_dropset = thedropset; | |
| 4108 | 1061 | items.add(itm); | |
| 4109 | 1061 | } | |
| 4110 | 2615 | } | |
| 4111 | |||
| 4112 | 2641 | putcombo(scrollbuf,bx - viewport.x,by - viewport.y,rpos_handle.data(),rpos_handle.cset()); | |
| 4113 | |||
| 4114 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2641 times.
|
2641 | if(get_qr(qr_MORESOUNDS)) |
| 4115 | { | ||
| 4116 |
5/6✓ Branch 0 taken 2461 times.
✓ Branch 1 taken 180 times.
✓ Branch 2 taken 2461 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1299 times.
✓ Branch 5 taken 1162 times.
|
2641 | if (!isBushType(type) && !isFlowersType(type) && !isGrassType(type)) |
| 4117 | { | ||
| 4118 |
2/2✓ Branch 0 taken 563 times.
✓ Branch 1 taken 599 times.
|
1162 | if (combobuf[cid].usrflags&cflag3) |
| 4119 | { | ||
| 4120 | 599 | sfx(combobuf[cid].attribytes[2],pan(bx)); | |
| 4121 | 599 | } | |
| 4122 | 1162 | } | |
| 4123 | else | ||
| 4124 | { | ||
| 4125 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1479 times.
|
1479 | if (combobuf[cid].usrflags&cflag3) |
| 4126 | { | ||
| 4127 | ✗ | sfx(combobuf[cid].attribytes[2],pan(bx)); | |
| 4128 | ✗ | } | |
| 4129 | 1479 | else sfx(QMisc.miscsfx[sfxBUSHGRASS],pan(bx)); | |
| 4130 | } | ||
| 4131 | 2641 | } | |
| 4132 | |||
| 4133 | 2641 | spawn_decoration_xy(combobuf[cid], fx, fy, bx+8, by+8); | |
| 4134 | 4259544 | } | |
| 4135 | |||
| 4136 | 1981668 | void HeroClass::check_slash_block(int32_t bx, int32_t by) | |
| 4137 | { | ||
| 4138 | //first things first | ||
| 4139 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1981668 times.
|
1981668 | if(attack!=wSword) |
| 4140 | ✗ | return; | |
| 4141 | |||
| 4142 | // keep things inside the screen boundaries | ||
| 4143 | 1981668 | bx=vbound(bx, 0, world_w-1); | |
| 4144 | 1981668 | by=vbound(by, 0, world_h-1); | |
| 4145 | 1981668 | int32_t fx=bx; | |
| 4146 | 1981668 | int32_t fy=by; | |
| 4147 | |||
| 4148 |
5/6✓ Branch 0 taken 1981524 times.
✓ Branch 1 taken 144 times.
✓ Branch 2 taken 1981524 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 10398 times.
✓ Branch 5 taken 220278 times.
|
2212344 | if(z>8||fakez>8 || attackclk==SWORDCHARGEFRAME // is not charging>0, as tapping a wall reduces attackclk but retains charging |
| 4149 |
4/4✓ Branch 0 taken 1881932 times.
✓ Branch 1 taken 99592 times.
✓ Branch 2 taken 230676 times.
✓ Branch 3 taken 1651256 times.
|
1981524 | || (attackclk>SWORDTAPFRAME && tapping)) |
| 4150 | 110134 | return; | |
| 4151 | |||
| 4152 | // find out which combo row/column the coordinates are in | ||
| 4153 | 1871534 | bx = TRUNCATE_TILE(bx); | |
| 4154 | 1871534 | by = TRUNCATE_TILE(by); | |
| 4155 | |||
| 4156 | 1871534 | int cid = MAPCOMBO(bx,by); | |
| 4157 | 1871534 | int cid_ff = MAPFFCOMBO(fx,fy); | |
| 4158 | 1871534 | auto current_ffc_handle = getFFCAt(fx,fy); | |
| 4159 | 1871534 | newcombo const& cmb = combobuf[cid]; | |
| 4160 | 1871534 | newcombo const& cmb_ff = combobuf[cid_ff]; | |
| 4161 | 1871534 | int type = cmb.type; | |
| 4162 | 1871534 | int type2 = cmb_ff.type; | |
| 4163 | 1871534 | int flag = MAPFLAG(bx,by); | |
| 4164 | 1871534 | int flag2 = cmb.flag; | |
| 4165 | 1871534 | int flag3 = cmb_ff.flag; | |
| 4166 | |||
| 4167 | 1871534 | auto rpos_handle = get_rpos_handle_for_world_xy(bx, by, 0); | |
| 4168 | 1871534 | int32_t i = rpos_handle.pos; | |
| 4169 | |||
| 4170 | 1871534 | bool ignorescreen=false; | |
| 4171 | 1871534 | bool ignoreffc=false; | |
| 4172 | |||
| 4173 |
2/2✓ Branch 0 taken 1845556 times.
✓ Branch 1 taken 25978 times.
|
1871534 | if(get_bit(screengrid, i) != 0) |
| 4174 | { | ||
| 4175 | 25978 | ignorescreen = true; | |
| 4176 | 25978 | } | |
| 4177 |
2/2✓ Branch 0 taken 1845551 times.
✓ Branch 1 taken 5 times.
|
1845556 | else if(cmb.only_gentrig) |
| 4178 | 5 | ignorescreen = true; | |
| 4179 | |||
| 4180 | |||
| 4181 |
3/4✓ Branch 0 taken 13558 times.
✓ Branch 1 taken 1857976 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 13558 times.
|
1871534 | if (!current_ffc_handle || current_ffc_handle->ffc->recently_hit) |
| 4182 | { | ||
| 4183 | 1857976 | ignoreffc = true; | |
| 4184 | 1857976 | } | |
| 4185 |
2/2✓ Branch 0 taken 19 times.
✓ Branch 1 taken 13539 times.
|
13558 | else if(cmb_ff.only_gentrig) |
| 4186 | 19 | ignoreffc = true; | |
| 4187 | |||
| 4188 |
4/4✓ Branch 0 taken 1853447 times.
✓ Branch 1 taken 18087 times.
✓ Branch 2 taken 48 times.
✓ Branch 3 taken 1853028 times.
|
3724610 | if(!isCuttableType(type) && |
| 4189 |
6/6✓ Branch 0 taken 7172 times.
✓ Branch 1 taken 1846275 times.
✓ Branch 2 taken 1853076 times.
✓ Branch 3 taken 371 times.
✓ Branch 4 taken 4700 times.
✓ Branch 5 taken 1848376 times.
|
1853447 | (flag<mfSWORD || flag>mfXSWORD) && flag!=mfSTRIKE && (flag2<mfSWORD || flag2>mfXSWORD) && flag2!=mfSTRIKE) |
| 4190 | { | ||
| 4191 | 1853028 | ignorescreen = true; | |
| 4192 | 1853028 | } | |
| 4193 | |||
| 4194 |
4/4✓ Branch 0 taken 1871515 times.
✓ Branch 1 taken 19 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 1871514 times.
|
3743049 | if(!isCuttableType(type2) && |
| 4195 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1871514 times.
|
1871515 | (flag3<mfSWORD || flag3>mfXSWORD) && flag3!=mfSTRIKE) |
| 4196 | { | ||
| 4197 | 1871514 | ignoreffc = true; | |
| 4198 | 1871514 | } | |
| 4199 | |||
| 4200 |
2/2✓ Branch 0 taken 10822 times.
✓ Branch 1 taken 1860712 times.
|
1871534 | mapscr *s = cur_screen >= 128 ? special_warp_return_scr : rpos_handle.scr; |
| 4201 | |||
| 4202 |
4/4✓ Branch 0 taken 168662 times.
✓ Branch 1 taken 1702872 times.
✓ Branch 2 taken 322 times.
✓ Branch 3 taken 168340 times.
|
1871534 | int32_t sworditem = (directWpn>-1 && itemsbuf[directWpn].type==itype_sword) ? itemsbuf[directWpn].level : current_item(itype_sword); |
| 4203 | 1871534 | byte skipsecrets = 0; | |
| 4204 | |||
| 4205 |
2/2✓ Branch 0 taken 1864623 times.
✓ Branch 1 taken 6911 times.
|
1871534 | if ( isNextType(type) ) //->Next combos should not trigger secrets. Their child combo, may want to do that! -Z 17th December, 2019 |
| 4206 | { | ||
| 4207 |
2/2✓ Branch 0 taken 5639 times.
✓ Branch 1 taken 1272 times.
|
6911 | if (get_qr(qr_OLD_SLASHNEXT_SECRETS)) |
| 4208 | { | ||
| 4209 | 5639 | skipsecrets = 0; | |
| 4210 | 5639 | } | |
| 4211 | 1272 | else skipsecrets = 1; | |
| 4212 | 6911 | } | |
| 4213 | |||
| 4214 |
6/6✓ Branch 0 taken 16749 times.
✓ Branch 1 taken 1854785 times.
✓ Branch 2 taken 1093 times.
✓ Branch 3 taken 15656 times.
✓ Branch 4 taken 138 times.
✓ Branch 5 taken 1231 times.
|
1871534 | if(!ignorescreen && (!skipsecrets || !get_qr(qr_BUGGY_BUGGY_SLASH_TRIGGERS))) |
| 4215 | { | ||
| 4216 |
6/6✓ Branch 0 taken 2005 times.
✓ Branch 1 taken 14882 times.
✓ Branch 2 taken 1526 times.
✓ Branch 3 taken 479 times.
✓ Branch 4 taken 30 times.
✓ Branch 5 taken 1496 times.
|
16887 | if((flag >= 16)&&(flag <= 31) && !skipsecrets) |
| 4217 | { | ||
| 4218 | 1496 | s->data[i] = s->secretcombo[(s->sflag[i])-16+4]; | |
| 4219 | 1496 | s->cset[i] = s->secretcset[(s->sflag[i])-16+4]; | |
| 4220 | 1496 | s->sflag[i] = s->secretflag[(s->sflag[i])-16+4]; | |
| 4221 | 1496 | } | |
| 4222 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 15387 times.
|
15391 | else if(flag == mfARMOS_SECRET) |
| 4223 | { | ||
| 4224 | 4 | s->data[i] = s->secretcombo[sSTAIRS]; | |
| 4225 | 4 | s->cset[i] = s->secretcset[sSTAIRS]; | |
| 4226 | 4 | s->sflag[i] = s->secretflag[sSTAIRS]; | |
| 4227 | 4 | sfx(s->secretsfx); | |
| 4228 | 4 | } | |
| 4229 |
4/4✓ Branch 0 taken 443 times.
✓ Branch 1 taken 14944 times.
✓ Branch 2 taken 69 times.
✓ Branch 3 taken 14875 times.
|
15387 | else if(((flag>=mfSWORD&&flag<=mfXSWORD)||(flag==mfSTRIKE))) |
| 4230 | { | ||
| 4231 |
4/4✓ Branch 0 taken 1083 times.
✓ Branch 1 taken 155 times.
✓ Branch 2 taken 864 times.
✓ Branch 3 taken 374 times.
|
1376 | for(int32_t i2=0; i2<=zc_min(sworditem-1,3); i2++) |
| 4232 | { | ||
| 4233 | 864 | trigger_secrets_if_flag(bx,by,mfSWORD+i2,true); | |
| 4234 | 864 | } | |
| 4235 | |||
| 4236 | 374 | trigger_secrets_if_flag(bx,by,mfSTRIKE,true); | |
| 4237 | 374 | } | |
| 4238 |
3/4✓ Branch 0 taken 17 times.
✓ Branch 1 taken 14858 times.
✓ Branch 2 taken 17 times.
✗ Branch 3 not taken.
|
14875 | else if(((flag2 >= 16)&&(flag2 <= 31))) |
| 4239 | { | ||
| 4240 | ✗ | s->data[i] = s->secretcombo[(s->sflag[i])-16+4]; | |
| 4241 | ✗ | s->cset[i] = s->secretcset[(s->sflag[i])-16+4]; | |
| 4242 | ✗ | s->sflag[i] = s->secretflag[(s->sflag[i])-16+4]; | |
| 4243 | ✗ | } | |
| 4244 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14875 times.
|
14875 | else if(flag2 == mfARMOS_SECRET) |
| 4245 | { | ||
| 4246 | ✗ | s->data[i] = s->secretcombo[sSTAIRS]; | |
| 4247 | ✗ | s->cset[i] = s->secretcset[sSTAIRS]; | |
| 4248 | ✗ | s->sflag[i] = s->secretflag[sSTAIRS]; | |
| 4249 | ✗ | sfx(s->secretsfx); | |
| 4250 | ✗ | } | |
| 4251 |
3/4✓ Branch 0 taken 17 times.
✓ Branch 1 taken 14858 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 14858 times.
|
14875 | else if(((flag2>=mfSWORD&&flag2<=mfXSWORD)||(flag2==mfSTRIKE))) |
| 4252 | { | ||
| 4253 |
3/4✓ Branch 0 taken 42 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 25 times.
✓ Branch 3 taken 17 times.
|
42 | for(int32_t i2=0; i2<=zc_min(sworditem-1,3); i2++) |
| 4254 | { | ||
| 4255 | 25 | trigger_secrets_if_flag(bx,by,mfSWORD+i2,true); | |
| 4256 | 25 | } | |
| 4257 | |||
| 4258 | 17 | trigger_secrets_if_flag(bx,by,mfSTRIKE,true); | |
| 4259 | 17 | } | |
| 4260 | else | ||
| 4261 | { | ||
| 4262 |
2/2✓ Branch 0 taken 5179 times.
✓ Branch 1 taken 9679 times.
|
14858 | if(isCuttableNextType(type)) |
| 4263 | { | ||
| 4264 | 5179 | s->data[i]++; | |
| 4265 | 5179 | } | |
| 4266 | else | ||
| 4267 | { | ||
| 4268 | 9679 | s->data[i] = s->undercombo; | |
| 4269 | 9679 | s->cset[i] = s->undercset; | |
| 4270 | 9679 | s->sflag[i] = 0; | |
| 4271 | } | ||
| 4272 | } | ||
| 4273 | 16749 | } | |
| 4274 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1854923 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1854923 | else if(!ignorescreen && skipsecrets) |
| 4275 | { | ||
| 4276 | ✗ | if(isCuttableNextType(type)) | |
| 4277 | { | ||
| 4278 | ✗ | s->data[i]++; | |
| 4279 | ✗ | } | |
| 4280 | else | ||
| 4281 | { | ||
| 4282 | ✗ | s->data[i] = s->undercombo; | |
| 4283 | ✗ | s->cset[i] = s->undercset; | |
| 4284 | ✗ | s->sflag[i] = 0; | |
| 4285 | } | ||
| 4286 | ✗ | } | |
| 4287 | |||
| 4288 |
3/4✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1871671 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1871671 times.
|
1871672 | if(((flag3>=mfSWORD&&flag3<=mfXSWORD)||(flag3==mfSTRIKE)) && !ignoreffc) |
| 4289 | { | ||
| 4290 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 1 times.
|
5 | for(int32_t i2=0; i2<=zc_min(sworditem-1,3); i2++) |
| 4291 | { | ||
| 4292 | 4 | trigger_secrets_if_flag(bx,by,mfSWORD+i2,true); | |
| 4293 | 4 | } | |
| 4294 | |||
| 4295 | 1 | trigger_secrets_if_flag(fx,fy,mfSTRIKE,true); | |
| 4296 | 1 | } | |
| 4297 |
1/2✓ Branch 0 taken 1871671 times.
✗ Branch 1 not taken.
|
1871671 | else if(!ignoreffc) |
| 4298 | { | ||
| 4299 | ✗ | if(isCuttableNextType(type2)) | |
| 4300 | { | ||
| 4301 | ✗ | current_ffc_handle->increment_data(); | |
| 4302 | ✗ | } | |
| 4303 | else | ||
| 4304 | { | ||
| 4305 | ✗ | current_ffc_handle->set_data(s->undercombo); | |
| 4306 | ✗ | current_ffc_handle->ffc->cset = s->undercset; | |
| 4307 | } | ||
| 4308 | ✗ | } | |
| 4309 | |||
| 4310 |
2/2✓ Branch 0 taken 1854923 times.
✓ Branch 1 taken 16749 times.
|
1871672 | if(!ignorescreen) |
| 4311 | { | ||
| 4312 |
4/4✓ Branch 0 taken 5541 times.
✓ Branch 1 taken 11208 times.
✓ Branch 2 taken 290 times.
✓ Branch 3 taken 5251 times.
|
16749 | if(!isTouchyType(type) && !get_qr(qr_CONT_SWORD_TRIGGERS)) set_bit(screengrid,i,1); |
| 4313 | |||
| 4314 |
8/8✓ Branch 0 taken 16444 times.
✓ Branch 1 taken 305 times.
✓ Branch 2 taken 45 times.
✓ Branch 3 taken 16489 times.
✓ Branch 4 taken 45 times.
✓ Branch 5 taken 305 times.
✓ Branch 6 taken 45 times.
✓ Branch 7 taken 215 times.
|
16749 | if((flag==mfARMOS_ITEM||flag2==mfARMOS_ITEM) && (!getmapflag(s, (cur_screen < 128 && get_qr(qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM) || (s->flags9&fBELOWRETURN))) |
| 4315 | { | ||
| 4316 |
4/8✓ Branch 0 taken 260 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 260 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 260 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 260 times.
✗ Branch 7 not taken.
|
260 | items.add(new item((zfix)bx, (zfix)by,(zfix)0, s->catchall, ipONETIME2 + ipBIGRANGE + ipHOLDUP | ((s->flags8&fITEMSECRET) ? ipSECRETS : 0), 0)); |
| 4317 | 260 | sfx(s->secretsfx); | |
| 4318 | 260 | } | |
| 4319 |
2/2✓ Branch 0 taken 425 times.
✓ Branch 1 taken 16064 times.
|
16489 | else if(isCuttableItemType(type)) |
| 4320 | { | ||
| 4321 | 16064 | int32_t it = -1; | |
| 4322 | 16064 | int32_t thedropset = -1; | |
| 4323 |
2/2✓ Branch 0 taken 68 times.
✓ Branch 1 taken 15996 times.
|
16064 | if ( (cmb.usrflags&cflag2) ) //specific dropset or item |
| 4324 | { | ||
| 4325 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 68 times.
|
68 | if ( cmb.usrflags&cflag11 ) |
| 4326 | { | ||
| 4327 | ✗ | it = cmb.attribytes[1]; | |
| 4328 | ✗ | } | |
| 4329 | else | ||
| 4330 | { | ||
| 4331 | 68 | it = select_dropitem(cmb.attribytes[1]); | |
| 4332 | 68 | thedropset = cmb.attribytes[1]; | |
| 4333 | } | ||
| 4334 | 68 | } | |
| 4335 | else | ||
| 4336 | { | ||
| 4337 | 15996 | it = select_dropitem(12); | |
| 4338 | 15996 | thedropset = 12; | |
| 4339 | } | ||
| 4340 | |||
| 4341 |
2/2✓ Branch 0 taken 11222 times.
✓ Branch 1 taken 4842 times.
|
16064 | if(it!=-1) |
| 4342 | { | ||
| 4343 |
4/8✓ Branch 0 taken 4842 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4842 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4842 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 4842 times.
✗ Branch 7 not taken.
|
4842 | item* itm = (new item((zfix)bx, (zfix)by,(zfix)0, it, ipBIGRANGE + ipTIMER, 0)); |
| 4344 | 4842 | itm->from_dropset = thedropset; | |
| 4345 | 4842 | items.add(itm); | |
| 4346 | 4842 | } | |
| 4347 | 16064 | } | |
| 4348 | |||
| 4349 | 16749 | putcombo(scrollbuf, bx - viewport.x, by - viewport.y, s->data[i], s->cset[i]); | |
| 4350 | |||
| 4351 |
2/2✓ Branch 0 taken 8270 times.
✓ Branch 1 taken 8479 times.
|
16749 | if(get_qr(qr_MORESOUNDS)) |
| 4352 | { | ||
| 4353 |
6/6✓ Branch 0 taken 6893 times.
✓ Branch 1 taken 1586 times.
✓ Branch 2 taken 4848 times.
✓ Branch 3 taken 2045 times.
✓ Branch 4 taken 4218 times.
✓ Branch 5 taken 630 times.
|
8479 | if (!isBushType(type) && !isFlowersType(type) && !isGrassType(type)) |
| 4354 | { | ||
| 4355 |
2/2✓ Branch 0 taken 586 times.
✓ Branch 1 taken 44 times.
|
630 | if (cmb.usrflags&cflag3) |
| 4356 | { | ||
| 4357 | 44 | sfx(cmb.attribytes[2],pan(bx)); | |
| 4358 | 44 | } | |
| 4359 | 630 | } | |
| 4360 | else | ||
| 4361 | { | ||
| 4362 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7849 times.
|
7849 | if (cmb.usrflags&cflag3) |
| 4363 | { | ||
| 4364 | ✗ | sfx(cmb.attribytes[2],pan(bx)); | |
| 4365 | ✗ | } | |
| 4366 | 7849 | else sfx(QMisc.miscsfx[sfxBUSHGRASS],pan(bx)); | |
| 4367 | } | ||
| 4368 | 8479 | } | |
| 4369 | |||
| 4370 | 16749 | spawn_decoration_xy(cmb, fx, fy, bx+8, by+8); | |
| 4371 | 16749 | } | |
| 4372 | |||
| 4373 |
2/2✓ Branch 0 taken 1871671 times.
✓ Branch 1 taken 1 times.
|
1871672 | if(!ignoreffc) |
| 4374 | { | ||
| 4375 |
2/4✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
|
1 | if(!isTouchyType(type2) && !get_qr(qr_CONT_SWORD_TRIGGERS)) |
| 4376 | { | ||
| 4377 | 1 | current_ffc_handle->ffc->recently_hit = true; | |
| 4378 | 1 | } | |
| 4379 | |||
| 4380 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | if(isCuttableItemType(type2)) |
| 4381 | { | ||
| 4382 | ✗ | int32_t it=-1; | |
| 4383 | ✗ | int32_t thedropset=-1; | |
| 4384 | ✗ | if ( (cmb_ff.usrflags&cflag2) ) | |
| 4385 | { | ||
| 4386 | ✗ | if(cmb_ff.usrflags&cflag11) | |
| 4387 | ✗ | it = cmb_ff.attribytes[1]; | |
| 4388 | else | ||
| 4389 | { | ||
| 4390 | ✗ | it = select_dropitem(cmb_ff.attribytes[1]); | |
| 4391 | ✗ | thedropset = cmb_ff.attribytes[1]; | |
| 4392 | } | ||
| 4393 | ✗ | } | |
| 4394 | else | ||
| 4395 | { | ||
| 4396 | ✗ | if(get_qr(qr_HARDCODED_FFC_BUSH_DROPS)) | |
| 4397 | { | ||
| 4398 | ✗ | int32_t r=zc_oldrand()%100; | |
| 4399 | |||
| 4400 | ✗ | if(r<15) | |
| 4401 | ✗ | it=iHeart; // 15% | |
| 4402 | ✗ | else if(r<35) | |
| 4403 | ✗ | it=iRupy; // 20% | |
| 4404 | ✗ | } | |
| 4405 | else | ||
| 4406 | { | ||
| 4407 | ✗ | it = select_dropitem(12); | |
| 4408 | ✗ | thedropset = 12; | |
| 4409 | } | ||
| 4410 | } | ||
| 4411 | |||
| 4412 | ✗ | if(it!=-1 && itemsbuf[it].type != itype_misc) // Don't drop non-gameplay items | |
| 4413 | { | ||
| 4414 | ✗ | item* itm = (new item((zfix)fx, (zfix)fy,(zfix)0, it, ipBIGRANGE + ipTIMER, 0)); | |
| 4415 | ✗ | itm->from_dropset = thedropset; | |
| 4416 | ✗ | items.add(itm); | |
| 4417 | ✗ | } | |
| 4418 | ✗ | } | |
| 4419 | |||
| 4420 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | if(get_qr(qr_MORESOUNDS)) |
| 4421 | { | ||
| 4422 |
3/6✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1 times.
|
1 | if (!isBushType(type2) && !isFlowersType(type2) && !isGrassType(type2)) |
| 4423 | { | ||
| 4424 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | if (cmb_ff.usrflags&cflag3) |
| 4425 | { | ||
| 4426 | ✗ | sfx(cmb_ff.attribytes[2],pan(bx)); | |
| 4427 | ✗ | } | |
| 4428 | 1 | } | |
| 4429 | else | ||
| 4430 | { | ||
| 4431 | ✗ | if (cmb_ff.usrflags&cflag3) | |
| 4432 | { | ||
| 4433 | ✗ | sfx(cmb_ff.attribytes[2],pan(bx)); | |
| 4434 | ✗ | } | |
| 4435 | ✗ | else sfx(QMisc.miscsfx[sfxBUSHGRASS],pan(bx)); | |
| 4436 | } | ||
| 4437 | 1 | } | |
| 4438 | |||
| 4439 | 1 | auto& ffc = *current_ffc_handle->ffc; | |
| 4440 | 1 | spawn_decoration_xy(cmb_ff, fx, fy, ffc.x+(ffc.hit_width / 2), ffc.y+(ffc.hit_height / 2)); | |
| 4441 | 1 | } | |
| 4442 | 1981806 | } | |
| 4443 | |||
| 4444 | 34751851 | void HeroClass::check_wpn_triggers(int32_t bx, int32_t by, weapon *w) | |
| 4445 | { | ||
| 4446 | 34751851 | bx=vbound(bx, 0, world_w-1); | |
| 4447 | 34751851 | by=vbound(by, 0, world_h-1); | |
| 4448 |
5/30✓ Branch 0 taken 3120 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✓ Branch 8 taken 648 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 201384 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✓ Branch 26 taken 34542035 times.
✗ Branch 27 not taken.
✓ Branch 28 taken 4664 times.
✗ Branch 29 not taken.
|
34751851 | switch(w->useweapon) |
| 4449 | { | ||
| 4450 | case wArrow: | ||
| 4451 | 3120 | trigger_secrets_if_flag(bx,by,mfARROW,true); | |
| 4452 | 3120 | trigger_secrets_if_flag(bx,by,mfSARROW,true); | |
| 4453 | 3120 | trigger_secrets_if_flag(bx,by,mfGARROW,true); | |
| 4454 | 3120 | break; | |
| 4455 | case wBeam: | ||
| 4456 | ✗ | for(int32_t i = 0; i <4; i++) trigger_secrets_if_flag(bx,by,mfSWORDBEAM+i,true); | |
| 4457 | ✗ | break; | |
| 4458 | case wHookshot: | ||
| 4459 | ✗ | trigger_secrets_if_flag(bx,by,mfHOOKSHOT,true); | |
| 4460 | ✗ | break; | |
| 4461 | case wBrang: | ||
| 4462 | ✗ | for(int32_t i = 0; i <3; i++) trigger_secrets_if_flag(bx,by,mfBRANG+i,true); | |
| 4463 | ✗ | break; | |
| 4464 | case wMagic: | ||
| 4465 | ✗ | trigger_secrets_if_flag(bx,by,mfWANDMAGIC,true); | |
| 4466 | ✗ | break; | |
| 4467 | case wRefMagic: | ||
| 4468 | ✗ | trigger_secrets_if_flag(bx,by,mfWANDMAGIC,true); | |
| 4469 | ✗ | break; | |
| 4470 | case wRefBeam: | ||
| 4471 | ✗ | for(int32_t i = 0; i <4; i++) trigger_secrets_if_flag(bx,by,mfSWORDBEAM+i,true); | |
| 4472 | ✗ | break; | |
| 4473 | //reflected magic needs to happen in mirrors: | ||
| 4474 | // | ||
| 4475 | //trigger_secrets_if_flag(bx,by,mfREFMAGIC,true) | ||
| 4476 | case wRefFireball: | ||
| 4477 | ✗ | trigger_secrets_if_flag(bx,by,mfREFFIREBALL,true); | |
| 4478 | ✗ | break; | |
| 4479 | case wBomb: | ||
| 4480 | 648 | trigger_secrets_if_flag(bx+w->txsz,by+tysz+(isSideViewGravity()?2:-3),mfBOMB,true); | |
| 4481 | 648 | break; | |
| 4482 | |||
| 4483 | case wSBomb: | ||
| 4484 | ✗ | trigger_secrets_if_flag(bx+w->txsz,by+tysz+(isSideViewGravity()?2:-3),mfSBOMB,true); | |
| 4485 | ✗ | break; | |
| 4486 | |||
| 4487 | case wFire: | ||
| 4488 | 201384 | trigger_secrets_if_flag(bx,by,mfANYFIRE,true); | |
| 4489 | 201384 | trigger_secrets_if_flag(bx,by,mfSTRONGFIRE,true); | |
| 4490 | 201384 | trigger_secrets_if_flag(bx,by,mfMAGICFIRE,true); | |
| 4491 | 201384 | break; | |
| 4492 | |||
| 4493 | case wScript1: | ||
| 4494 | ✗ | break; | |
| 4495 | case wScript2: | ||
| 4496 | ✗ | break; | |
| 4497 | case wScript3: | ||
| 4498 | ✗ | break; | |
| 4499 | case wScript4: | ||
| 4500 | ✗ | break; | |
| 4501 | case wScript5: | ||
| 4502 | ✗ | break; | |
| 4503 | case wScript6: | ||
| 4504 | ✗ | break; | |
| 4505 | case wScript7: | ||
| 4506 | ✗ | break; | |
| 4507 | case wScript8: | ||
| 4508 | ✗ | break; | |
| 4509 | case wScript9: | ||
| 4510 | ✗ | break; | |
| 4511 | case wScript10: | ||
| 4512 | ✗ | break; | |
| 4513 | case wIce: | ||
| 4514 | ✗ | break; | |
| 4515 | case wCByrna: | ||
| 4516 | ✗ | break; | |
| 4517 | case wWhistle: | ||
| 4518 | ✗ | break; | |
| 4519 | case wSSparkle: | ||
| 4520 | case wFSparkle: | ||
| 4521 | ✗ | break; | |
| 4522 | case wWind: | ||
| 4523 | ✗ | break; | |
| 4524 | case wBait: | ||
| 4525 | ✗ | break; | |
| 4526 | case wFlame: | ||
| 4527 | case wThrown: | ||
| 4528 | case wBombos: | ||
| 4529 | case wEther: | ||
| 4530 | case wQuake: | ||
| 4531 | case wSwordLA: | ||
| 4532 | case wSword180: | ||
| 4533 | case wStomp: | ||
| 4534 | ✗ | break; | |
| 4535 | case wSword: | ||
| 4536 | case wWand: | ||
| 4537 | //case wCandle: | ||
| 4538 | case wHSHandle: | ||
| 4539 | case wLitBomb: | ||
| 4540 | case wLitSBomb: | ||
| 4541 | 4664 | break; | |
| 4542 | 34542035 | default: break; | |
| 4543 | |||
| 4544 | } | ||
| 4545 | 34751851 | } | |
| 4546 | |||
| 4547 | 69503702 | void HeroClass::check_slash_block_layer2(int32_t bx, int32_t by, weapon *w, int32_t layer) | |
| 4548 | { | ||
| 4549 |
2/2✓ Branch 0 taken 20499434 times.
✓ Branch 1 taken 49004268 times.
|
69503702 | if(!(get_qr(qr_BUSHESONLAYERS1AND2))) |
| 4550 | { | ||
| 4551 | 49004268 | return; | |
| 4552 | } | ||
| 4553 | //keep things inside the screen boundaries | ||
| 4554 | 20499434 | bx=vbound(bx, 0, world_w-1); | |
| 4555 | 20499434 | by=vbound(by, 0, world_h-1); | |
| 4556 | 20499434 | int32_t fx=bx; | |
| 4557 | 20499434 | int32_t fy=by; | |
| 4558 | //first things first | ||
| 4559 |
2/2✓ Branch 0 taken 20492602 times.
✓ Branch 1 taken 6832 times.
|
20499434 | if(w->useweapon != wSword) |
| 4560 | 20492602 | return; | |
| 4561 | |||
| 4562 | //find out which combo row/column the coordinates are in | ||
| 4563 | 6832 | bx = TRUNCATE_TILE(bx); | |
| 4564 | 6832 | by = TRUNCATE_TILE(by); | |
| 4565 | |||
| 4566 | |||
| 4567 | 6832 | int32_t flag = MAPFLAGL(layer,bx,by); | |
| 4568 | 6832 | int32_t flag2 = MAPCOMBOFLAGL(layer,bx,by); | |
| 4569 | 6832 | int32_t cid = MAPCOMBOL(layer,bx,by); | |
| 4570 | 6832 | int32_t type = combobuf[cid].type; | |
| 4571 |
1/2✓ Branch 0 taken 6832 times.
✗ Branch 1 not taken.
|
6832 | if(combobuf[cid].only_gentrig) |
| 4572 | ✗ | type = cNONE; | |
| 4573 | |||
| 4574 | 6832 | auto rpos_handle = get_rpos_handle_for_world_xy(bx, by, layer); | |
| 4575 | 6832 | int32_t i = rpos_handle.pos; | |
| 4576 | |||
| 4577 | // bool checked = w->rposes_checked.contains({rpos_handle.layer, rpos_handle.rpos}); | ||
| 4578 |
3/4✓ Branch 0 taken 6832 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6826 times.
✓ Branch 3 taken 6 times.
|
6832 | if((get_bit(w->wscreengrid_layer[layer-1], i) != 0) || (!isCuttableType(type))) |
| 4579 | { | ||
| 4580 | 6826 | return; | |
| 4581 | } | ||
| 4582 | |||
| 4583 | 6 | mapscr* s = rpos_handle.scr; | |
| 4584 | |||
| 4585 |
2/4✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
|
6 | int32_t sworditem = (directWpn>-1 && itemsbuf[directWpn].type==itype_sword) ? itemsbuf[directWpn].level : current_item(itype_sword); |
| 4586 | |||
| 4587 | { | ||
| 4588 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
6 | if(!isTouchyType(type) && !get_qr(qr_CONT_SWORD_TRIGGERS)) set_bit(w->wscreengrid_layer[layer-1],i,1); |
| 4589 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
6 | if(isCuttableNextType(type) || isCuttableNextType(type)) |
| 4590 | { | ||
| 4591 | 6 | s->data[i]++; | |
| 4592 | 6 | } | |
| 4593 | else | ||
| 4594 | { | ||
| 4595 | ✗ | s->data[i] = s->undercombo; | |
| 4596 | ✗ | s->cset[i] = s->undercset; | |
| 4597 | ✗ | s->sflag[i] = 0; | |
| 4598 | } | ||
| 4599 |
2/8✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
6 | if((flag==mfARMOS_ITEM||flag2==mfARMOS_ITEM) && (!getmapflag(s, (cur_screen < 128 && get_qr(qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM) || (s->flags9&fBELOWRETURN))) |
| 4600 | { | ||
| 4601 | ✗ | items.add(new item((zfix)bx, (zfix)by,(zfix)0, s->catchall, ipONETIME2 + ipBIGRANGE + ipHOLDUP | ((s->flags8&fITEMSECRET) ? ipSECRETS : 0), 0)); | |
| 4602 | ✗ | sfx(s->secretsfx); | |
| 4603 | ✗ | } | |
| 4604 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
|
6 | else if(isCuttableItemType(type)) |
| 4605 | { | ||
| 4606 | 6 | int32_t it = -1; | |
| 4607 | 6 | int32_t thedropset = -1; | |
| 4608 | |||
| 4609 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
|
6 | if ( (combobuf[cid].usrflags&cflag2) ) |
| 4610 | { | ||
| 4611 | ✗ | if(combobuf[cid].usrflags&cflag11) | |
| 4612 | ✗ | it = combobuf[cid].attribytes[1]; | |
| 4613 | else | ||
| 4614 | { | ||
| 4615 | ✗ | it = select_dropitem(combobuf[cid].attribytes[1]); | |
| 4616 | ✗ | thedropset = combobuf[cid].attribytes[1]; | |
| 4617 | } | ||
| 4618 | ✗ | } | |
| 4619 | else | ||
| 4620 | { | ||
| 4621 | 6 | it = select_dropitem(12); | |
| 4622 | 6 | thedropset = 12; | |
| 4623 | } | ||
| 4624 | |||
| 4625 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 2 times.
|
6 | if(it!=-1) |
| 4626 | { | ||
| 4627 |
4/8✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
|
2 | item* itm = (new item((zfix)bx, (zfix)by,(zfix)0, it, ipBIGRANGE + ipTIMER, 0)); |
| 4628 | 2 | itm->from_dropset = thedropset; | |
| 4629 | 2 | items.add(itm); | |
| 4630 | 2 | } | |
| 4631 | 6 | } | |
| 4632 | |||
| 4633 | 6 | putcombo(scrollbuf,bx - viewport.x, by - viewport.y,rpos_handle.data(),rpos_handle.cset()); | |
| 4634 | |||
| 4635 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
|
6 | if(get_qr(qr_MORESOUNDS)) |
| 4636 | { | ||
| 4637 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
6 | if (!isBushType(type) && !isFlowersType(type) && !isGrassType(type)) |
| 4638 | { | ||
| 4639 | ✗ | if (combobuf[cid].usrflags&cflag3) | |
| 4640 | { | ||
| 4641 | ✗ | sfx(combobuf[cid].attribytes[2],pan(bx)); | |
| 4642 | ✗ | } | |
| 4643 | ✗ | } | |
| 4644 | else | ||
| 4645 | { | ||
| 4646 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
|
6 | if (combobuf[cid].usrflags&cflag3) |
| 4647 | { | ||
| 4648 | ✗ | sfx(combobuf[cid].attribytes[2],pan(bx)); | |
| 4649 | ✗ | } | |
| 4650 | 6 | else sfx(QMisc.miscsfx[sfxBUSHGRASS],pan(bx)); | |
| 4651 | } | ||
| 4652 | 6 | } | |
| 4653 | |||
| 4654 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
6 | int16_t decotype = (combobuf[cid].usrflags & cflag1) ? ((combobuf[cid].usrflags & cflag10) ? (combobuf[cid].attribytes[0]) : (-1)) : (0); |
| 4655 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | if(decotype > 3) decotype = 0; |
| 4656 |
2/8✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
6 | if(!decotype) decotype = (isBushType(type) ? 1 : (isFlowersType(type) ? 2 : (isGrassType(type) ? 3 : ((combobuf[cid].usrflags & cflag1) ? -1 : -2)))); |
| 4657 |
1/6✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
6 | switch(decotype) |
| 4658 | { | ||
| 4659 | ✗ | case -2: break; //nothing | |
| 4660 | case -1: | ||
| 4661 | ✗ | decorations.add(new comboSprite((zfix)fx, (zfix)fy, dCOMBOSPRITE, 0, combobuf[cid].attribytes[0])); | |
| 4662 | ✗ | break; | |
| 4663 |
3/6✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
|
6 | case 1: decorations.add(new dBushLeaves((zfix)fx, (zfix)fy, dBUSHLEAVES, 0, 0)); break; |
| 4664 | ✗ | case 2: decorations.add(new dFlowerClippings((zfix)fx, (zfix)fy, dFLOWERCLIPPINGS, 0, 0)); break; | |
| 4665 | ✗ | case 3: decorations.add(new dGrassClippings((zfix)fx, (zfix)fy, dGRASSCLIPPINGS, 0, 0)); break; | |
| 4666 | } | ||
| 4667 | |||
| 4668 | } | ||
| 4669 | |||
| 4670 | 69503702 | } | |
| 4671 | |||
| 4672 | 34751869 | void HeroClass::check_slash_block2(int32_t bx, int32_t by, weapon *w) | |
| 4673 | { | ||
| 4674 | //keep things inside the screen boundaries | ||
| 4675 | 34751869 | bx=vbound(bx, 0, world_w-1); | |
| 4676 | 34751869 | by=vbound(by, 0, world_h-1); | |
| 4677 | 34751869 | int32_t fx=bx; | |
| 4678 | 34751869 | int32_t fy=by; | |
| 4679 | 34751869 | int32_t cid = MAPCOMBO(bx,by); | |
| 4680 | |||
| 4681 | //find out which combo row/column the coordinates are in | ||
| 4682 | 34751869 | bx = TRUNCATE_TILE(bx); | |
| 4683 | 34751869 | by = TRUNCATE_TILE(by); | |
| 4684 | |||
| 4685 | 34751869 | int32_t type = COMBOTYPE(bx,by); | |
| 4686 | 34751869 | int32_t type2 = FFCOMBOTYPE(fx,fy); | |
| 4687 | 34751869 | int32_t flag = MAPFLAG(bx,by); | |
| 4688 | 34751869 | int32_t flag2 = MAPCOMBOFLAG(bx,by); | |
| 4689 | 34751869 | int32_t flag3 = MAPFFCOMBOFLAG(fx,fy); | |
| 4690 |
2/2✓ Branch 0 taken 34751655 times.
✓ Branch 1 taken 214 times.
|
34751869 | if(combobuf[cid].only_gentrig) |
| 4691 | 214 | type = cNONE; | |
| 4692 | 34751869 | byte dontignore = 0; | |
| 4693 | 34751869 | byte dontignoreffc = 0; | |
| 4694 | |||
| 4695 |
4/4✓ Branch 0 taken 431619 times.
✓ Branch 1 taken 34320250 times.
✓ Branch 2 taken 431021 times.
✓ Branch 3 taken 598 times.
|
34751869 | if (isCuttableType(type) && FindComboTriggerMatch(w, cid) > -1) |
| 4696 | { | ||
| 4697 | 598 | dontignore = 1; | |
| 4698 | 598 | } | |
| 4699 |
4/4✓ Branch 0 taken 34747187 times.
✓ Branch 1 taken 4682 times.
✓ Branch 2 taken 34746589 times.
✓ Branch 3 taken 598 times.
|
34751869 | if(w->useweapon != wSword && !dontignore) return; |
| 4700 | |||
| 4701 | 5280 | auto rpos_handle = get_rpos_handle_for_world_xy(bx, by, 0); | |
| 4702 | 5280 | int32_t i = rpos_handle.pos; | |
| 4703 | |||
| 4704 |
2/2✓ Branch 0 taken 21 times.
✓ Branch 1 taken 5259 times.
|
5280 | if (get_bit(w->wscreengrid,i)) return; |
| 4705 | |||
| 4706 | 5259 | bool ignorescreen=false; | |
| 4707 | 5259 | bool ignoreffc=false; | |
| 4708 | |||
| 4709 |
1/2✓ Branch 0 taken 5259 times.
✗ Branch 1 not taken.
|
5259 | if(get_bit(w->wscreengrid, i) != 0) |
| 4710 | { | ||
| 4711 | ✗ | ignorescreen = true; dontignore = 0; | |
| 4712 | ✗ | } | |
| 4713 | |||
| 4714 | 5259 | auto current_ffc_handle = getFFCAt(fx,fy); | |
| 4715 | |||
| 4716 |
3/4✓ Branch 0 taken 266 times.
✓ Branch 1 taken 4993 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 266 times.
|
5259 | if (!current_ffc_handle || current_ffc_handle->ffc->recently_hit) |
| 4717 | { | ||
| 4718 | 4993 | ignoreffc = true; | |
| 4719 | 4993 | } | |
| 4720 |
1/2✓ Branch 0 taken 266 times.
✗ Branch 1 not taken.
|
266 | else if(combobuf[current_ffc_handle->data()].only_gentrig) |
| 4721 | ✗ | type2 = cNONE; | |
| 4722 |
3/4✓ Branch 0 taken 4631 times.
✓ Branch 1 taken 628 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4631 times.
|
9890 | if(!isCuttableType(type) && |
| 4723 |
5/6✓ Branch 0 taken 148 times.
✓ Branch 1 taken 4483 times.
✓ Branch 2 taken 4631 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 718 times.
✓ Branch 5 taken 3913 times.
|
4631 | (flag<mfSWORD || flag>mfXSWORD) && flag!=mfSTRIKE && (flag2<mfSWORD || flag2>mfXSWORD) && flag2!=mfSTRIKE) |
| 4724 | { | ||
| 4725 | 4631 | ignorescreen = true; | |
| 4726 | 4631 | } | |
| 4727 | |||
| 4728 |
3/4✓ Branch 0 taken 5241 times.
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5241 times.
|
10500 | if(!isCuttableType(type2) && |
| 4729 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5241 times.
|
5241 | (flag3<mfSWORD || flag3>mfXSWORD) && flag3!=mfSTRIKE) |
| 4730 | { | ||
| 4731 | 5241 | ignoreffc = true; | |
| 4732 | 5241 | } | |
| 4733 | |||
| 4734 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 5241 times.
|
5259 | mapscr *s = cur_screen >= 128 ? special_warp_return_scr : rpos_handle.scr; |
| 4735 | |||
| 4736 |
4/4✓ Branch 0 taken 4851 times.
✓ Branch 1 taken 408 times.
✓ Branch 2 taken 233 times.
✓ Branch 3 taken 4618 times.
|
5259 | int32_t sworditem = (directWpn>-1 && itemsbuf[directWpn].type==itype_sword) ? itemsbuf[directWpn].level : current_item(itype_sword); |
| 4737 | 5259 | byte skipsecrets = 0; | |
| 4738 |
2/2✓ Branch 0 taken 4722 times.
✓ Branch 1 taken 501 times.
|
5259 | if ( isNextType(type) ) //->Next combos should not trigger secrets. Their child combo, may want to do that! -Z 17th December, 2019 |
| 4739 | { | ||
| 4740 |
2/2✓ Branch 0 taken 498 times.
✓ Branch 1 taken 3 times.
|
501 | if (get_qr(qr_OLD_SLASHNEXT_SECRETS)) |
| 4741 | { | ||
| 4742 | 498 | skipsecrets = 0; | |
| 4743 | 498 | } | |
| 4744 | 3 | else skipsecrets = 1; | |
| 4745 | 501 | } | |
| 4746 |
6/6✓ Branch 0 taken 3 times.
✓ Branch 1 taken 5220 times.
✓ Branch 2 taken 4631 times.
✓ Branch 3 taken 4628 times.
✓ Branch 4 taken 4631 times.
✓ Branch 5 taken 5217 times.
|
5223 | if((!skipsecrets || !get_qr(qr_BUGGY_BUGGY_SLASH_TRIGGERS)) && (!ignorescreen || dontignore)) |
| 4747 | { | ||
| 4748 |
3/6✓ Branch 0 taken 2 times.
✓ Branch 1 taken 608 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
9848 | if((flag >= 16)&&(flag <= 31)&&!skipsecrets) |
| 4749 | { | ||
| 4750 | ✗ | s->data[i] = s->secretcombo[(s->sflag[i])-16+4]; | |
| 4751 | ✗ | s->cset[i] = s->secretcset[(s->sflag[i])-16+4]; | |
| 4752 | ✗ | s->sflag[i] = s->secretflag[(s->sflag[i])-16+4]; | |
| 4753 | ✗ | } | |
| 4754 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 610 times.
|
610 | else if(flag == mfARMOS_SECRET) |
| 4755 | { | ||
| 4756 | ✗ | s->data[i] = s->secretcombo[sSTAIRS]; | |
| 4757 | ✗ | s->cset[i] = s->secretcset[sSTAIRS]; | |
| 4758 | ✗ | s->sflag[i] = s->secretflag[sSTAIRS]; | |
| 4759 | ✗ | sfx(s->secretsfx); | |
| 4760 | ✗ | } | |
| 4761 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 610 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 610 times.
|
610 | else if(((flag>=mfSWORD&&flag<=mfXSWORD)||(flag==mfSTRIKE))) |
| 4762 | { | ||
| 4763 | ✗ | for(int32_t i2=0; i2<=zc_min(sworditem-1,3); i2++) | |
| 4764 | { | ||
| 4765 | ✗ | trigger_secrets_if_flag(bx,by,mfSWORD+i2,true); | |
| 4766 | ✗ | } | |
| 4767 | |||
| 4768 | ✗ | trigger_secrets_if_flag(bx,by,mfSTRIKE,true); | |
| 4769 | ✗ | } | |
| 4770 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 610 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
610 | else if(((flag2 >= 16)&&(flag2 <= 31))) |
| 4771 | { | ||
| 4772 | ✗ | s->data[i] = s->secretcombo[(s->sflag[i])-16+4]; | |
| 4773 | ✗ | s->cset[i] = s->secretcset[(s->sflag[i])-16+4]; | |
| 4774 | ✗ | s->sflag[i] = s->secretflag[(s->sflag[i])-16+4]; | |
| 4775 | ✗ | } | |
| 4776 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 610 times.
|
610 | else if(flag2 == mfARMOS_SECRET) |
| 4777 | { | ||
| 4778 | ✗ | s->data[i] = s->secretcombo[sSTAIRS]; | |
| 4779 | ✗ | s->cset[i] = s->secretcset[sSTAIRS]; | |
| 4780 | ✗ | s->sflag[i] = s->secretflag[sSTAIRS]; | |
| 4781 | ✗ | sfx(s->secretsfx); | |
| 4782 | ✗ | } | |
| 4783 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 610 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 610 times.
|
610 | else if(((flag2>=mfSWORD&&flag2<=mfXSWORD)||(flag2==mfSTRIKE))) |
| 4784 | { | ||
| 4785 | ✗ | for(int32_t i2=0; i2<=zc_min(sworditem-1,3); i2++) | |
| 4786 | { | ||
| 4787 | ✗ | trigger_secrets_if_flag(bx,by,mfSWORD+i2,true); | |
| 4788 | ✗ | } | |
| 4789 | |||
| 4790 | ✗ | trigger_secrets_if_flag(bx,by,mfSTRIKE,true); | |
| 4791 | ✗ | } | |
| 4792 | else | ||
| 4793 | { | ||
| 4794 |
2/2✓ Branch 0 taken 501 times.
✓ Branch 1 taken 109 times.
|
610 | if(isCuttableNextType(type)) |
| 4795 | { | ||
| 4796 | 501 | s->data[i]++; | |
| 4797 | 501 | } | |
| 4798 | else | ||
| 4799 | { | ||
| 4800 | 109 | s->data[i] = s->undercombo; | |
| 4801 | 109 | s->cset[i] = s->undercset; | |
| 4802 | 109 | s->sflag[i] = 0; | |
| 4803 | } | ||
| 4804 | } | ||
| 4805 | 610 | } | |
| 4806 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 4631 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
4631 | else if(skipsecrets && (!ignorescreen || dontignore)) |
| 4807 | { | ||
| 4808 | ✗ | if(isCuttableNextType(type)) | |
| 4809 | { | ||
| 4810 | ✗ | s->data[i]++; | |
| 4811 | ✗ | } | |
| 4812 | else | ||
| 4813 | { | ||
| 4814 | ✗ | s->data[i] = s->undercombo; | |
| 4815 | ✗ | s->cset[i] = s->undercset; | |
| 4816 | ✗ | s->sflag[i] = 0; | |
| 4817 | } | ||
| 4818 | ✗ | } | |
| 4819 | |||
| 4820 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 5241 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5241 times.
|
5241 | if(((flag3>=mfSWORD&&flag3<=mfXSWORD)||(flag3==mfSTRIKE)) && !ignoreffc) |
| 4821 | { | ||
| 4822 | ✗ | for(int32_t i2=0; i2<=zc_min(sworditem-1,3); i2++) | |
| 4823 | { | ||
| 4824 | ✗ | trigger_secrets_if_flag(bx,by,mfSWORD+i2,true); | |
| 4825 | ✗ | } | |
| 4826 | |||
| 4827 | ✗ | trigger_secrets_if_flag(fx,fy,mfSTRIKE,true); | |
| 4828 | ✗ | } | |
| 4829 |
1/2✓ Branch 0 taken 5241 times.
✗ Branch 1 not taken.
|
5241 | else if(!ignoreffc) |
| 4830 | { | ||
| 4831 | ✗ | if(isCuttableNextType(type2)) | |
| 4832 | { | ||
| 4833 | ✗ | current_ffc_handle->increment_data(); | |
| 4834 | ✗ | } | |
| 4835 | else | ||
| 4836 | { | ||
| 4837 | ✗ | current_ffc_handle->set_data(s->undercombo); | |
| 4838 | ✗ | current_ffc_handle->ffc->cset = s->undercset; | |
| 4839 | } | ||
| 4840 | ✗ | } | |
| 4841 | |||
| 4842 |
3/4✓ Branch 0 taken 4631 times.
✓ Branch 1 taken 610 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4631 times.
|
5241 | if(!ignorescreen || dontignore) |
| 4843 | { | ||
| 4844 |
3/4✓ Branch 0 taken 425 times.
✓ Branch 1 taken 185 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 425 times.
|
610 | if(!isTouchyType(type) && !get_qr(qr_CONT_SWORD_TRIGGERS)) set_bit(w->wscreengrid,i,1); |
| 4845 | |||
| 4846 |
2/8✓ Branch 0 taken 610 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 610 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
610 | if((flag==mfARMOS_ITEM||flag2==mfARMOS_ITEM) && (!getmapflag(s, (cur_screen < 128 && get_qr(qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM) || (s->flags9&fBELOWRETURN))) |
| 4847 | { | ||
| 4848 | ✗ | items.add(new item((zfix)bx, (zfix)by,(zfix)0, s->catchall, ipONETIME2 + ipBIGRANGE + ipHOLDUP | ((s->flags8&fITEMSECRET) ? ipSECRETS : 0), 0)); | |
| 4849 | ✗ | sfx(s->secretsfx); | |
| 4850 | ✗ | } | |
| 4851 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 610 times.
|
610 | else if(isCuttableItemType(type)) |
| 4852 | { | ||
| 4853 | 610 | int32_t it = -1; | |
| 4854 | 610 | int32_t thedropset = -1; | |
| 4855 |
2/2✓ Branch 0 taken 9 times.
✓ Branch 1 taken 601 times.
|
610 | if ( (combobuf[cid].usrflags&cflag2) ) //specific dropset or item |
| 4856 | { | ||
| 4857 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
|
9 | if ( combobuf[cid].usrflags&cflag11 ) |
| 4858 | { | ||
| 4859 | ✗ | it = combobuf[cid].attribytes[1]; | |
| 4860 | ✗ | } | |
| 4861 | else | ||
| 4862 | { | ||
| 4863 | 9 | it = select_dropitem(combobuf[cid].attribytes[1]); | |
| 4864 | 9 | thedropset = combobuf[cid].attribytes[1]; | |
| 4865 | } | ||
| 4866 | 9 | } | |
| 4867 | else | ||
| 4868 | { | ||
| 4869 | 601 | it = select_dropitem(12); | |
| 4870 | 601 | thedropset = 12; | |
| 4871 | } | ||
| 4872 | |||
| 4873 |
2/2✓ Branch 0 taken 412 times.
✓ Branch 1 taken 198 times.
|
610 | if(it!=-1) |
| 4874 | { | ||
| 4875 |
4/8✓ Branch 0 taken 198 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 198 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 198 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 198 times.
✗ Branch 7 not taken.
|
198 | item* itm = (new item((zfix)bx, (zfix)by,(zfix)0, it, ipBIGRANGE + ipTIMER, 0)); |
| 4876 | 198 | itm->from_dropset = thedropset; | |
| 4877 | 198 | items.add(itm); | |
| 4878 | 198 | } | |
| 4879 | 610 | } | |
| 4880 | |||
| 4881 | |||
| 4882 | 610 | putcombo(scrollbuf,bx-viewport.x,by-viewport.y,s->data[i],s->cset[i]); | |
| 4883 | |||
| 4884 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 610 times.
|
610 | if(get_qr(qr_MORESOUNDS)) |
| 4885 | { | ||
| 4886 |
5/6✓ Branch 0 taken 431 times.
✓ Branch 1 taken 179 times.
✓ Branch 2 taken 331 times.
✓ Branch 3 taken 100 times.
✓ Branch 4 taken 331 times.
✗ Branch 5 not taken.
|
610 | if (!isBushType(type) && !isFlowersType(type) && !isGrassType(type)) |
| 4887 | { | ||
| 4888 | ✗ | if (combobuf[cid].usrflags&cflag3) | |
| 4889 | { | ||
| 4890 | ✗ | sfx(combobuf[cid].attribytes[2],pan(bx)); | |
| 4891 | ✗ | } | |
| 4892 | ✗ | } | |
| 4893 | else | ||
| 4894 | { | ||
| 4895 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 610 times.
|
610 | if (combobuf[cid].usrflags&cflag3) |
| 4896 | { | ||
| 4897 | ✗ | sfx(combobuf[cid].attribytes[2],pan(bx)); | |
| 4898 | ✗ | } | |
| 4899 | 610 | else sfx(QMisc.miscsfx[sfxBUSHGRASS],pan(bx)); | |
| 4900 | } | ||
| 4901 | 610 | } | |
| 4902 | |||
| 4903 |
3/4✓ Branch 0 taken 598 times.
✓ Branch 1 taken 12 times.
✓ Branch 2 taken 598 times.
✗ Branch 3 not taken.
|
610 | int16_t decotype = (combobuf[cid].usrflags & cflag1) ? ((combobuf[cid].usrflags & cflag10) ? (combobuf[cid].attribytes[0]) : (-1)) : (0); |
| 4904 |
1/2✓ Branch 0 taken 610 times.
✗ Branch 1 not taken.
|
610 | if(decotype > 3) decotype = 0; |
| 4905 |
6/8✓ Branch 0 taken 598 times.
✓ Branch 1 taken 12 times.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 9 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 9 times.
✓ Branch 6 taken 9 times.
✗ Branch 7 not taken.
|
610 | if(!decotype) decotype = (isBushType(type) ? 1 : (isFlowersType(type) ? 2 : (isGrassType(type) ? 3 : ((combobuf[cid].usrflags & cflag1) ? -1 : -2)))); |
| 4906 |
3/6✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 501 times.
✓ Branch 4 taken 100 times.
✓ Branch 5 taken 9 times.
|
610 | switch(decotype) |
| 4907 | { | ||
| 4908 | ✗ | case -2: break; //nothing | |
| 4909 | case -1: | ||
| 4910 | ✗ | decorations.add(new comboSprite((zfix)fx, (zfix)fy, dCOMBOSPRITE, 0, combobuf[cid].attribytes[0])); | |
| 4911 | ✗ | break; | |
| 4912 |
3/6✓ Branch 0 taken 501 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 501 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 501 times.
✗ Branch 5 not taken.
|
501 | case 1: decorations.add(new dBushLeaves((zfix)fx, (zfix)fy, dBUSHLEAVES, 0, 0)); break; |
| 4913 |
3/6✓ Branch 0 taken 100 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 100 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 100 times.
✗ Branch 5 not taken.
|
100 | case 2: decorations.add(new dFlowerClippings((zfix)fx, (zfix)fy, dFLOWERCLIPPINGS, 0, 0)); break; |
| 4914 |
3/6✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 9 times.
✗ Branch 5 not taken.
|
9 | case 3: decorations.add(new dGrassClippings((zfix)fx, (zfix)fy, dGRASSCLIPPINGS, 0, 0)); break; |
| 4915 | } | ||
| 4916 | 610 | } | |
| 4917 | |||
| 4918 |
1/2✓ Branch 0 taken 5241 times.
✗ Branch 1 not taken.
|
5241 | if(!ignoreffc) |
| 4919 | { | ||
| 4920 | ✗ | if(!isTouchyType(type2) && !get_qr(qr_CONT_SWORD_TRIGGERS)) | |
| 4921 | { | ||
| 4922 | ✗ | current_ffc_handle->ffc->recently_hit = true; | |
| 4923 | ✗ | } | |
| 4924 | |||
| 4925 | ✗ | if(isCuttableItemType(type2)) | |
| 4926 | { | ||
| 4927 | ✗ | int32_t it=-1; | |
| 4928 | ✗ | int32_t thedropset=-1; | |
| 4929 | ✗ | if ( (combobuf[cid].usrflags&cflag2) ) | |
| 4930 | { | ||
| 4931 | ✗ | if(combobuf[cid].usrflags&cflag11) | |
| 4932 | ✗ | it = combobuf[cid].attribytes[1]; | |
| 4933 | else | ||
| 4934 | { | ||
| 4935 | ✗ | it = select_dropitem(combobuf[cid].attribytes[1]); | |
| 4936 | ✗ | thedropset = combobuf[cid].attribytes[1]; | |
| 4937 | } | ||
| 4938 | ✗ | } | |
| 4939 | else | ||
| 4940 | { | ||
| 4941 | ✗ | int32_t r=zc_oldrand()%100; | |
| 4942 | |||
| 4943 | ✗ | if(r<15) | |
| 4944 | { | ||
| 4945 | ✗ | it=iHeart; // 15% | |
| 4946 | ✗ | } | |
| 4947 | ✗ | else if(r<35) | |
| 4948 | { | ||
| 4949 | ✗ | it=iRupy; // 20% | |
| 4950 | ✗ | } | |
| 4951 | } | ||
| 4952 | |||
| 4953 | ✗ | if(it!=-1 && itemsbuf[it].type != itype_misc) // Don't drop non-gameplay items | |
| 4954 | { | ||
| 4955 | ✗ | item* itm = (new item((zfix)fx, (zfix)fy,(zfix)0, it, ipBIGRANGE + ipTIMER, 0)); | |
| 4956 | ✗ | itm->from_dropset = thedropset; | |
| 4957 | ✗ | items.add(itm); | |
| 4958 | ✗ | } | |
| 4959 | ✗ | } | |
| 4960 | |||
| 4961 | ✗ | if(get_qr(qr_MORESOUNDS)) | |
| 4962 | { | ||
| 4963 | ✗ | if (!isBushType(type2) && !isFlowersType(type2) && !isGrassType(type2)) | |
| 4964 | { | ||
| 4965 | ✗ | if (combobuf[cid].usrflags&cflag3) | |
| 4966 | { | ||
| 4967 | ✗ | sfx(combobuf[cid].attribytes[2],pan(bx)); | |
| 4968 | ✗ | } | |
| 4969 | ✗ | } | |
| 4970 | else | ||
| 4971 | { | ||
| 4972 | ✗ | if (combobuf[cid].usrflags&cflag3) | |
| 4973 | { | ||
| 4974 | ✗ | sfx(combobuf[cid].attribytes[2],pan(bx)); | |
| 4975 | ✗ | } | |
| 4976 | ✗ | else sfx(QMisc.miscsfx[sfxBUSHGRASS],pan(bx)); | |
| 4977 | } | ||
| 4978 | ✗ | } | |
| 4979 | |||
| 4980 | ✗ | int16_t decotype = (combobuf[cid].usrflags & cflag1) ? ((combobuf[cid].usrflags & cflag10) ? (combobuf[cid].attribytes[0]) : (-1)) : (0); | |
| 4981 | ✗ | if(decotype > 3) decotype = 0; | |
| 4982 | ✗ | if(!decotype) decotype = (isBushType(type2) ? 1 : (isFlowersType(type2) ? 2 : (isGrassType(type2) ? 3 : ((combobuf[cid].usrflags & cflag1) ? -1 : -2)))); | |
| 4983 | ✗ | switch(decotype) | |
| 4984 | { | ||
| 4985 | ✗ | case -2: break; //nothing | |
| 4986 | case -1: | ||
| 4987 | ✗ | decorations.add(new comboSprite((zfix)fx, (zfix)fy, dCOMBOSPRITE, 0, combobuf[cid].attribytes[0])); | |
| 4988 | ✗ | break; | |
| 4989 | ✗ | case 1: decorations.add(new dBushLeaves((zfix)fx, (zfix)fy, dBUSHLEAVES, 0, 0)); break; | |
| 4990 | ✗ | case 2: decorations.add(new dFlowerClippings((zfix)fx, (zfix)fy, dFLOWERCLIPPINGS, 0, 0)); break; | |
| 4991 | ✗ | case 3: decorations.add(new dGrassClippings((zfix)fx, (zfix)fy, dGRASSCLIPPINGS, 0, 0)); break; | |
| 4992 | } | ||
| 4993 | ✗ | } | |
| 4994 | 34751851 | } | |
| 4995 | |||
| 4996 | 34751851 | void HeroClass::check_wand_block2(int32_t bx, int32_t by, weapon *w) | |
| 4997 | { | ||
| 4998 | 34751851 | byte dontignore = 0; | |
| 4999 | 34751851 | byte dontignoreffc = 0; | |
| 5000 | |||
| 5001 | //keep things inside the screen boundaries | ||
| 5002 | 34751851 | bx=vbound(bx, 0, world_w-1); | |
| 5003 | 34751851 | by=vbound(by, 0, world_h-1); | |
| 5004 | 34751851 | int32_t fx=bx; | |
| 5005 | 34751851 | int32_t fy=by; | |
| 5006 | 34751851 | int32_t cid = MAPCOMBO(bx,by); | |
| 5007 | |||
| 5008 | //Z_scripterrlog("check_wand_block2 MatchComboTrigger() returned: %d\n", ); | ||
| 5009 |
3/4✓ Branch 0 taken 34751851 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2762 times.
✓ Branch 3 taken 34749089 times.
|
34751851 | if(w->useweapon != wWand && FindComboTriggerMatch (w, cid) < 0) return; |
| 5010 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2762 times.
|
2762 | if ( FindComboTriggerMatch (w, cid) != -1 ) dontignore = 1; |
| 5011 | |||
| 5012 | //first things first | ||
| 5013 |
2/4✓ Branch 0 taken 2762 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2762 times.
✗ Branch 3 not taken.
|
2762 | if(z>8||fakez>8) return; |
| 5014 | |||
| 5015 | //find out which combo row/column the coordinates are in | ||
| 5016 | 2762 | bx = TRUNCATE_TILE(bx); | |
| 5017 | 2762 | by = TRUNCATE_TILE(by); | |
| 5018 | |||
| 5019 | 2762 | int32_t flag = MAPFLAG(bx,by); | |
| 5020 | 2762 | int32_t flag2 = MAPCOMBOFLAG(bx,by); | |
| 5021 | 2762 | int32_t flag3=0; | |
| 5022 | 2762 | int32_t flag31 = MAPFFCOMBOFLAG(fx,fy); | |
| 5023 | 2762 | int32_t flag32 = MAPFFCOMBOFLAG(fx,fy); | |
| 5024 | 2762 | int32_t flag33 = MAPFFCOMBOFLAG(fx,fy); | |
| 5025 | 2762 | int32_t flag34 = MAPFFCOMBOFLAG(fx,fy); | |
| 5026 | |||
| 5027 |
4/8✓ Branch 0 taken 2762 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2762 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2762 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 2762 times.
|
2762 | if(flag31==mfWAND||flag32==mfWAND||flag33==mfWAND||flag34==mfWAND) |
| 5028 | ✗ | flag3=mfWAND; | |
| 5029 | |||
| 5030 |
4/8✓ Branch 0 taken 2762 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2762 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2762 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 2762 times.
|
2762 | if(flag31==mfSTRIKE||flag32==mfSTRIKE||flag33==mfSTRIKE||flag34==mfSTRIKE) |
| 5031 | ✗ | flag3=mfSTRIKE; | |
| 5032 | |||
| 5033 |
6/12✓ Branch 0 taken 2762 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2762 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2762 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2762 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2762 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 2762 times.
|
2762 | if(flag!=mfWAND&&flag2!=mfWAND&&flag3!=mfWAND&&flag!=mfSTRIKE&&flag2!=mfSTRIKE&&flag3!=mfSTRIKE) |
| 5034 | 2762 | return; | |
| 5035 | |||
| 5036 | ✗ | if((trigger_secrets_if_flag(bx,by,mfWAND,true)==false)&&(trigger_secrets_if_flag(bx,by,mfSTRIKE,true)==false)) | |
| 5037 | { | ||
| 5038 | ✗ | if(flag3==mfWAND||flag3==mfSTRIKE) | |
| 5039 | { | ||
| 5040 | ✗ | trigger_secrets_if_flag(fx,fy,mfWAND,true); | |
| 5041 | ✗ | trigger_secrets_if_flag(fx,fy,mfSTRIKE,true); | |
| 5042 | ✗ | } | |
| 5043 | ✗ | } | |
| 5044 | |||
| 5045 | ✗ | if(dontignore) | |
| 5046 | ✗ | trigger_secrets_if_flag(bx,by,mfWAND,true); | |
| 5047 | 34751851 | } | |
| 5048 | |||
| 5049 | ✗ | void HeroClass::check_slash_block(weapon *w) | |
| 5050 | { | ||
| 5051 | //first things | ||
| 5052 | |||
| 5053 | ✗ | int32_t par_item = w->parentitem; | |
| 5054 | ✗ | int32_t usewpn = -1; | |
| 5055 | ✗ | if ( par_item > -1 ) | |
| 5056 | { | ||
| 5057 | ✗ | usewpn = itemsbuf[par_item].weap_data.imitate_weapon; | |
| 5058 | ✗ | } | |
| 5059 | ✗ | else if ( par_item == -1 && w->ScriptGenerated ) | |
| 5060 | { | ||
| 5061 | ✗ | usewpn = w->useweapon; | |
| 5062 | ✗ | } | |
| 5063 | ✗ | if(usewpn != wSword) return; | |
| 5064 | |||
| 5065 | |||
| 5066 | ✗ | int32_t bx = 0, by = 0; | |
| 5067 | ✗ | bx = ((int32_t)w->x) + (((int32_t)w->hit_width)/2); | |
| 5068 | ✗ | by = ((int32_t)w->y) + (((int32_t)w->hit_height)/2); | |
| 5069 | //keep things inside the screen boundaries | ||
| 5070 | ✗ | bx=vbound(bx, 0, world_w-1); | |
| 5071 | ✗ | by=vbound(by, 0, world_h-1); | |
| 5072 | ✗ | int32_t fx=bx; | |
| 5073 | ✗ | int32_t fy=by; | |
| 5074 | |||
| 5075 | ✗ | int32_t cid = MAPCOMBO(bx,by); | |
| 5076 | |||
| 5077 | //find out which combo row/column the coordinates are in | ||
| 5078 | ✗ | bx = TRUNCATE_TILE(bx); | |
| 5079 | ✗ | by = TRUNCATE_TILE(by); | |
| 5080 | |||
| 5081 | ✗ | int32_t type = COMBOTYPE(bx,by); | |
| 5082 | ✗ | int32_t type2 = FFCOMBOTYPE(fx,fy); | |
| 5083 | ✗ | int32_t flag = MAPFLAG(bx,by); | |
| 5084 | ✗ | int32_t flag2 = MAPCOMBOFLAG(bx,by); | |
| 5085 | ✗ | int32_t flag3 = MAPFFCOMBOFLAG(fx,fy); | |
| 5086 | ✗ | auto rpos_handle = get_rpos_handle_for_world_xy(bx, by, 0); | |
| 5087 | ✗ | int32_t i = rpos_handle.pos; | |
| 5088 | |||
| 5089 | ✗ | if(combobuf[cid].only_gentrig) | |
| 5090 | ✗ | type = cNONE; | |
| 5091 | ✗ | bool ignorescreen=false; | |
| 5092 | ✗ | bool ignoreffc=false; | |
| 5093 | |||
| 5094 | ✗ | if(get_bit(screengrid, i) != 0) | |
| 5095 | { | ||
| 5096 | ✗ | ignorescreen = true; | |
| 5097 | ✗ | } | |
| 5098 | |||
| 5099 | ✗ | auto current_ffc_handle = getFFCAt(fx,fy); | |
| 5100 | |||
| 5101 | ✗ | if (!current_ffc_handle || current_ffc_handle->ffc->recently_hit) | |
| 5102 | { | ||
| 5103 | ✗ | ignoreffc = true; | |
| 5104 | ✗ | } | |
| 5105 | ✗ | else if(combobuf[current_ffc_handle->data()].only_gentrig) | |
| 5106 | ✗ | type2 = cNONE; | |
| 5107 | ✗ | if(!isCuttableType(type) && | |
| 5108 | ✗ | (flag<mfSWORD || flag>mfXSWORD) && flag!=mfSTRIKE && (flag2<mfSWORD || flag2>mfXSWORD) && flag2!=mfSTRIKE) | |
| 5109 | { | ||
| 5110 | ✗ | ignorescreen = true; | |
| 5111 | ✗ | } | |
| 5112 | |||
| 5113 | ✗ | if(!isCuttableType(type2) && | |
| 5114 | ✗ | (flag3<mfSWORD || flag3>mfXSWORD) && flag3!=mfSTRIKE) | |
| 5115 | { | ||
| 5116 | ✗ | ignoreffc = true; | |
| 5117 | ✗ | } | |
| 5118 | |||
| 5119 | ✗ | mapscr *s = cur_screen >= 128 ? special_warp_return_scr : rpos_handle.scr; | |
| 5120 | |||
| 5121 | ✗ | int32_t sworditem = (par_item >-1 ? itemsbuf[par_item].level : current_item(itype_sword)); //Get the level of the item, else the highest sword level in inventory. | |
| 5122 | |||
| 5123 | ✗ | if(!ignorescreen) | |
| 5124 | { | ||
| 5125 | ✗ | if((flag >= 16)&&(flag <= 31)) | |
| 5126 | { | ||
| 5127 | ✗ | s->data[i] = s->secretcombo[(s->sflag[i])-16+4]; | |
| 5128 | ✗ | s->cset[i] = s->secretcset[(s->sflag[i])-16+4]; | |
| 5129 | ✗ | s->sflag[i] = s->secretflag[(s->sflag[i])-16+4]; | |
| 5130 | ✗ | } | |
| 5131 | ✗ | else if(flag == mfARMOS_SECRET) | |
| 5132 | { | ||
| 5133 | ✗ | s->data[i] = s->secretcombo[sSTAIRS]; | |
| 5134 | ✗ | s->cset[i] = s->secretcset[sSTAIRS]; | |
| 5135 | ✗ | s->sflag[i] = s->secretflag[sSTAIRS]; | |
| 5136 | ✗ | sfx(s->secretsfx); | |
| 5137 | ✗ | } | |
| 5138 | ✗ | else if(((flag>=mfSWORD&&flag<=mfXSWORD)||(flag==mfSTRIKE))) | |
| 5139 | { | ||
| 5140 | ✗ | for(int32_t i2=0; i2<=zc_min(sworditem-1,3); i2++) | |
| 5141 | { | ||
| 5142 | ✗ | trigger_secrets_if_flag(bx,by,mfSWORD+i2,true); | |
| 5143 | ✗ | } | |
| 5144 | |||
| 5145 | ✗ | trigger_secrets_if_flag(bx,by,mfSTRIKE,true); | |
| 5146 | ✗ | } | |
| 5147 | ✗ | else if(((flag2 >= 16)&&(flag2 <= 31))) | |
| 5148 | { | ||
| 5149 | ✗ | s->data[i] = s->secretcombo[(s->sflag[i])-16+4]; | |
| 5150 | ✗ | s->cset[i] = s->secretcset[(s->sflag[i])-16+4]; | |
| 5151 | ✗ | s->sflag[i] = s->secretflag[(s->sflag[i])-16+4]; | |
| 5152 | ✗ | } | |
| 5153 | ✗ | else if(flag2 == mfARMOS_SECRET) | |
| 5154 | { | ||
| 5155 | ✗ | s->data[i] = s->secretcombo[sSTAIRS]; | |
| 5156 | ✗ | s->cset[i] = s->secretcset[sSTAIRS]; | |
| 5157 | ✗ | s->sflag[i] = s->secretflag[sSTAIRS]; | |
| 5158 | ✗ | sfx(s->secretsfx); | |
| 5159 | ✗ | } | |
| 5160 | ✗ | else if(((flag2>=mfSWORD&&flag2<=mfXSWORD)||(flag2==mfSTRIKE))) | |
| 5161 | { | ||
| 5162 | ✗ | for(int32_t i2=0; i2<=zc_min(sworditem-1,3); i2++) | |
| 5163 | { | ||
| 5164 | ✗ | trigger_secrets_if_flag(bx,by,mfSWORD+i2,true); | |
| 5165 | ✗ | } | |
| 5166 | |||
| 5167 | ✗ | trigger_secrets_if_flag(bx,by,mfSTRIKE,true); | |
| 5168 | ✗ | } | |
| 5169 | else | ||
| 5170 | { | ||
| 5171 | ✗ | if(isCuttableNextType(type)) | |
| 5172 | { | ||
| 5173 | ✗ | s->data[i]++; | |
| 5174 | ✗ | } | |
| 5175 | else | ||
| 5176 | { | ||
| 5177 | ✗ | s->data[i] = s->undercombo; | |
| 5178 | ✗ | s->cset[i] = s->undercset; | |
| 5179 | ✗ | s->sflag[i] = 0; | |
| 5180 | } | ||
| 5181 | } | ||
| 5182 | ✗ | } | |
| 5183 | |||
| 5184 | ✗ | if(((flag3>=mfSWORD&&flag3<=mfXSWORD)||(flag3==mfSTRIKE)) && !ignoreffc) | |
| 5185 | { | ||
| 5186 | ✗ | for(int32_t i2=0; i2<=zc_min(sworditem-1,3); i2++) | |
| 5187 | { | ||
| 5188 | ✗ | trigger_secrets_if_flag(bx,by,mfSWORD+i2,true); | |
| 5189 | ✗ | } | |
| 5190 | |||
| 5191 | ✗ | trigger_secrets_if_flag(fx,fy,mfSTRIKE,true); | |
| 5192 | ✗ | } | |
| 5193 | ✗ | else if(!ignoreffc) | |
| 5194 | { | ||
| 5195 | ✗ | if(isCuttableNextType(type2)) | |
| 5196 | { | ||
| 5197 | ✗ | current_ffc_handle->increment_data(); | |
| 5198 | ✗ | } | |
| 5199 | else | ||
| 5200 | { | ||
| 5201 | ✗ | current_ffc_handle->set_data(s->undercombo); | |
| 5202 | ✗ | current_ffc_handle->set_cset(s->undercset); | |
| 5203 | } | ||
| 5204 | ✗ | } | |
| 5205 | |||
| 5206 | ✗ | if(!ignorescreen) | |
| 5207 | { | ||
| 5208 | ✗ | if(!isTouchyType(type) && !get_qr(qr_CONT_SWORD_TRIGGERS)) set_bit(screengrid,i,1); | |
| 5209 | |||
| 5210 | ✗ | if((flag==mfARMOS_ITEM||flag2==mfARMOS_ITEM) && (!getmapflag(s, (cur_screen < 128 && get_qr(qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM) || (s->flags9&fBELOWRETURN))) | |
| 5211 | { | ||
| 5212 | ✗ | items.add(new item((zfix)bx, (zfix)by,(zfix)0, s->catchall, ipONETIME2 + ipBIGRANGE + ipHOLDUP | ((s->flags8&fITEMSECRET) ? ipSECRETS : 0), 0)); | |
| 5213 | ✗ | sfx(s->secretsfx); | |
| 5214 | ✗ | } | |
| 5215 | ✗ | else if(isCuttableItemType(type)) | |
| 5216 | { | ||
| 5217 | ✗ | int32_t it = -1; | |
| 5218 | ✗ | int32_t thedropset = -1; | |
| 5219 | ✗ | if ( (combobuf[cid].usrflags&cflag2) ) //specific dropset or item | |
| 5220 | { | ||
| 5221 | ✗ | if ( combobuf[cid].usrflags&cflag11 ) | |
| 5222 | { | ||
| 5223 | ✗ | it = combobuf[cid].attribytes[1]; | |
| 5224 | ✗ | } | |
| 5225 | else | ||
| 5226 | { | ||
| 5227 | ✗ | it = select_dropitem(combobuf[cid].attribytes[1]); | |
| 5228 | ✗ | thedropset = combobuf[cid].attribytes[1]; | |
| 5229 | } | ||
| 5230 | ✗ | } | |
| 5231 | else | ||
| 5232 | { | ||
| 5233 | ✗ | it = select_dropitem(12); | |
| 5234 | ✗ | thedropset = 12; | |
| 5235 | } | ||
| 5236 | |||
| 5237 | ✗ | if(it!=-1) | |
| 5238 | { | ||
| 5239 | ✗ | item* itm = (new item((zfix)bx, (zfix)by,(zfix)0, it, ipBIGRANGE + ipTIMER, 0)); | |
| 5240 | ✗ | itm->from_dropset = thedropset; | |
| 5241 | ✗ | items.add(itm); | |
| 5242 | ✗ | } | |
| 5243 | ✗ | } | |
| 5244 | |||
| 5245 | ✗ | putcombo(scrollbuf,bx-viewport.x,by-viewport.y,s->data[i],s->cset[i]); | |
| 5246 | |||
| 5247 | ✗ | if(get_qr(qr_MORESOUNDS)) | |
| 5248 | { | ||
| 5249 | ✗ | if (!isBushType(type) && !isFlowersType(type) && !isGrassType(type)) | |
| 5250 | { | ||
| 5251 | ✗ | if (combobuf[cid].usrflags&cflag3) | |
| 5252 | { | ||
| 5253 | ✗ | sfx(combobuf[cid].attribytes[2],pan(bx)); | |
| 5254 | ✗ | } | |
| 5255 | ✗ | } | |
| 5256 | else | ||
| 5257 | { | ||
| 5258 | ✗ | if (combobuf[cid].usrflags&cflag3) | |
| 5259 | { | ||
| 5260 | ✗ | sfx(combobuf[cid].attribytes[2],pan(bx)); | |
| 5261 | ✗ | } | |
| 5262 | ✗ | else sfx(QMisc.miscsfx[sfxBUSHGRASS],pan(bx)); | |
| 5263 | } | ||
| 5264 | ✗ | } | |
| 5265 | |||
| 5266 | ✗ | int16_t decotype = (combobuf[cid].usrflags & cflag1) ? ((combobuf[cid].usrflags & cflag10) ? (combobuf[cid].attribytes[0]) : (-1)) : (0); | |
| 5267 | ✗ | if(decotype > 3) decotype = 0; | |
| 5268 | ✗ | if(!decotype) decotype = (isBushType(type) ? 1 : (isFlowersType(type) ? 2 : (isGrassType(type) ? 3 : ((combobuf[cid].usrflags & cflag1) ? -1 : -2)))); | |
| 5269 | ✗ | switch(decotype) | |
| 5270 | { | ||
| 5271 | ✗ | case -2: break; //nothing | |
| 5272 | case -1: | ||
| 5273 | ✗ | decorations.add(new comboSprite((zfix)fx, (zfix)fy, dCOMBOSPRITE, 0, combobuf[cid].attribytes[0])); | |
| 5274 | ✗ | break; | |
| 5275 | ✗ | case 1: decorations.add(new dBushLeaves((zfix)fx, (zfix)fy, dBUSHLEAVES, 0, 0)); break; | |
| 5276 | ✗ | case 2: decorations.add(new dFlowerClippings((zfix)fx, (zfix)fy, dFLOWERCLIPPINGS, 0, 0)); break; | |
| 5277 | ✗ | case 3: decorations.add(new dGrassClippings((zfix)fx, (zfix)fy, dGRASSCLIPPINGS, 0, 0)); break; | |
| 5278 | } | ||
| 5279 | ✗ | } | |
| 5280 | |||
| 5281 | ✗ | if(!ignoreffc) | |
| 5282 | { | ||
| 5283 | ✗ | if(!isTouchyType(type2) && !get_qr(qr_CONT_SWORD_TRIGGERS)) | |
| 5284 | { | ||
| 5285 | ✗ | current_ffc_handle->ffc->recently_hit = true; | |
| 5286 | ✗ | } | |
| 5287 | |||
| 5288 | ✗ | if(isCuttableItemType(type2)) | |
| 5289 | { | ||
| 5290 | ✗ | int32_t it=-1; | |
| 5291 | ✗ | int32_t thedropset = -1; | |
| 5292 | ✗ | if ( (combobuf[MAPCOMBO(bx,by)-1].usrflags&cflag2) ) | |
| 5293 | { | ||
| 5294 | ✗ | if(combobuf[MAPCOMBO(bx,by)-1].usrflags&cflag11) | |
| 5295 | ✗ | it = combobuf[MAPCOMBO(bx,by)-1].attribytes[1]; | |
| 5296 | else | ||
| 5297 | { | ||
| 5298 | ✗ | thedropset = combobuf[MAPCOMBO(bx,by)-1].attribytes[1]; | |
| 5299 | ✗ | it = select_dropitem(thedropset); | |
| 5300 | } | ||
| 5301 | ✗ | } | |
| 5302 | else | ||
| 5303 | { | ||
| 5304 | ✗ | it = select_dropitem(12); | |
| 5305 | ✗ | thedropset = 12; | |
| 5306 | } | ||
| 5307 | |||
| 5308 | ✗ | if(it!=-1 && itemsbuf[it].type != itype_misc) // Don't drop non-gameplay items | |
| 5309 | { | ||
| 5310 | ✗ | item* itm = (new item((zfix)fx, (zfix)fy,(zfix)0, it, ipBIGRANGE + ipTIMER, 0)); | |
| 5311 | ✗ | itm->from_dropset = thedropset; | |
| 5312 | ✗ | items.add(itm); | |
| 5313 | ✗ | } | |
| 5314 | ✗ | } | |
| 5315 | |||
| 5316 | ✗ | if(get_qr(qr_MORESOUNDS)) | |
| 5317 | { | ||
| 5318 | ✗ | if (!isBushType(type2) && !isFlowersType(type2) && !isGrassType(type2)) | |
| 5319 | { | ||
| 5320 | ✗ | if (combobuf[cid].usrflags&cflag3) | |
| 5321 | { | ||
| 5322 | ✗ | sfx(combobuf[cid].attribytes[2],pan(bx)); | |
| 5323 | ✗ | } | |
| 5324 | ✗ | } | |
| 5325 | else | ||
| 5326 | { | ||
| 5327 | ✗ | if (combobuf[cid].usrflags&cflag3) | |
| 5328 | { | ||
| 5329 | ✗ | sfx(combobuf[cid].attribytes[2],pan(bx)); | |
| 5330 | ✗ | } | |
| 5331 | ✗ | else sfx(QMisc.miscsfx[sfxBUSHGRASS],pan(bx)); | |
| 5332 | } | ||
| 5333 | ✗ | } | |
| 5334 | |||
| 5335 | ✗ | int16_t decotype = (combobuf[cid].usrflags & cflag1) ? ((combobuf[cid].usrflags & cflag10) ? (combobuf[cid].attribytes[0]) : (-1)) : (0); | |
| 5336 | ✗ | if(decotype > 3) decotype = 0; | |
| 5337 | ✗ | if(!decotype) decotype = (isBushType(type2) ? 1 : (isFlowersType(type2) ? 2 : (isGrassType(type2) ? 3 : ((combobuf[cid].usrflags & cflag1) ? -1 : -2)))); | |
| 5338 | ✗ | switch(decotype) | |
| 5339 | { | ||
| 5340 | ✗ | case -2: break; //nothing | |
| 5341 | case -1: | ||
| 5342 | ✗ | decorations.add(new comboSprite((zfix)fx, (zfix)fy, dCOMBOSPRITE, 0, combobuf[cid].attribytes[0])); | |
| 5343 | ✗ | break; | |
| 5344 | ✗ | case 1: decorations.add(new dBushLeaves((zfix)fx, (zfix)fy, dBUSHLEAVES, 0, 0)); break; | |
| 5345 | ✗ | case 2: decorations.add(new dFlowerClippings((zfix)fx, (zfix)fy, dFLOWERCLIPPINGS, 0, 0)); break; | |
| 5346 | ✗ | case 3: decorations.add(new dGrassClippings((zfix)fx, (zfix)fy, dGRASSCLIPPINGS, 0, 0)); break; | |
| 5347 | } | ||
| 5348 | ✗ | } | |
| 5349 | ✗ | } | |
| 5350 | |||
| 5351 | 38240 | void HeroClass::check_wand_block(int32_t bx, int32_t by) | |
| 5352 | { | ||
| 5353 | //keep things inside the screen boundaries | ||
| 5354 | 38240 | bx=vbound(bx, 0, world_w-1); | |
| 5355 | 38240 | by=vbound(by, 0, world_h-1); | |
| 5356 | 38240 | int32_t fx=bx; | |
| 5357 | 38240 | int32_t fy=by; | |
| 5358 | |||
| 5359 | //first things first | ||
| 5360 |
2/4✓ Branch 0 taken 38240 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 38240 times.
✗ Branch 3 not taken.
|
38240 | if(z>8||fakez>8) return; |
| 5361 | |||
| 5362 | //find out which combo row/column the coordinates are in | ||
| 5363 | 38240 | bx = TRUNCATE_TILE(bx); | |
| 5364 | 38240 | by = TRUNCATE_TILE(by); | |
| 5365 | |||
| 5366 | 38240 | int32_t flag = MAPFLAG(bx,by); | |
| 5367 | 38240 | int32_t flag2 = MAPCOMBOFLAG(bx,by); | |
| 5368 | 38240 | int32_t flag3=0; | |
| 5369 | 38240 | int32_t flag31 = MAPFFCOMBOFLAG(fx,fy); | |
| 5370 | 38240 | int32_t flag32 = MAPFFCOMBOFLAG(fx,fy); | |
| 5371 | 38240 | int32_t flag33 = MAPFFCOMBOFLAG(fx,fy); | |
| 5372 | 38240 | int32_t flag34 = MAPFFCOMBOFLAG(fx,fy); | |
| 5373 | |||
| 5374 |
4/8✓ Branch 0 taken 38240 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 38240 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 38240 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 38240 times.
|
38240 | if(flag31==mfWAND||flag32==mfWAND||flag33==mfWAND||flag34==mfWAND) |
| 5375 | ✗ | flag3=mfWAND; | |
| 5376 | |||
| 5377 |
4/8✓ Branch 0 taken 38240 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 38240 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 38240 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 38240 times.
|
38240 | if(flag31==mfSTRIKE||flag32==mfSTRIKE||flag33==mfSTRIKE||flag34==mfSTRIKE) |
| 5378 | ✗ | flag3=mfSTRIKE; | |
| 5379 | |||
| 5380 |
7/12✓ Branch 0 taken 38240 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 38240 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 38240 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 38239 times.
✓ Branch 7 taken 1 times.
✓ Branch 8 taken 38239 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 38239 times.
✗ Branch 11 not taken.
|
38240 | if(flag!=mfWAND&&flag2!=mfWAND&&flag3!=mfWAND&&flag!=mfSTRIKE&&flag2!=mfSTRIKE&&flag3!=mfSTRIKE) |
| 5381 | 38239 | return; | |
| 5382 | |||
| 5383 |
2/4✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
1 | if((trigger_secrets_if_flag(bx,by,mfWAND,true)==false)&&(trigger_secrets_if_flag(bx,by,mfSTRIKE,true)==false)) |
| 5384 | { | ||
| 5385 | ✗ | if(flag3==mfWAND||flag3==mfSTRIKE) | |
| 5386 | { | ||
| 5387 | ✗ | trigger_secrets_if_flag(fx,fy,mfWAND,true); | |
| 5388 | ✗ | trigger_secrets_if_flag(fx,fy,mfSTRIKE,true); | |
| 5389 | ✗ | } | |
| 5390 | ✗ | } | |
| 5391 | 38240 | } | |
| 5392 | |||
| 5393 | 5768 | void HeroClass::check_pound_block(int bx, int by, weapon* w) | |
| 5394 | { | ||
| 5395 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 5768 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
5768 | if(w && w->no_triggers()) return; |
| 5396 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 5768 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
5768 | if(w && w->id == wHammer && getHammerState() < 3) |
| 5397 | ✗ | return; | |
| 5398 |
2/2✓ Branch 0 taken 5124 times.
✓ Branch 1 taken 644 times.
|
5768 | if(get_qr(qr_POUNDLAYERS1AND2)) |
| 5399 | { | ||
| 5400 | 644 | check_pound_block_layer(bx,by,1,w); | |
| 5401 | 644 | check_pound_block_layer(bx,by,2,w); | |
| 5402 | 644 | } | |
| 5403 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5768 times.
|
5768 | auto* grid = w ? w->wscreengrid : screengrid; |
| 5404 | //keep things inside the screen boundaries | ||
| 5405 | 5768 | bx=vbound(bx, 0, world_w-1); | |
| 5406 | 5768 | by=vbound(by, 0, world_h-1); | |
| 5407 | 5768 | int32_t fx=bx; | |
| 5408 | 5768 | int32_t fy=by; | |
| 5409 | |||
| 5410 | //first things first | ||
| 5411 |
2/4✓ Branch 0 taken 5768 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5768 times.
|
5768 | if(z>8||fakez>8) return; |
| 5412 | |||
| 5413 | //find out which combo row/column the coordinates are in | ||
| 5414 | 5768 | bx = TRUNCATE_TILE(bx); | |
| 5415 | 5768 | by = TRUNCATE_TILE(by); | |
| 5416 | |||
| 5417 | 5768 | int32_t type = COMBOTYPE(bx,by); | |
| 5418 | 5768 | int32_t type2 = FFCOMBOTYPE(fx,fy); | |
| 5419 | 5768 | int32_t flag = MAPFLAG(bx,by); | |
| 5420 | 5768 | int32_t flag2 = MAPCOMBOFLAG(bx,by); | |
| 5421 | 5768 | int32_t flag3 = MAPFFCOMBOFLAG(fx,fy); | |
| 5422 | |||
| 5423 | 5768 | rpos_t rpos = COMBOPOS_REGION(bx, by); | |
| 5424 | 5768 | int32_t pos = RPOS_TO_POS(rpos); | |
| 5425 |
1/2✓ Branch 0 taken 5768 times.
✗ Branch 1 not taken.
|
5768 | if (!is_valid_rpos(rpos)) |
| 5426 | ✗ | return; | |
| 5427 | |||
| 5428 | 5768 | bool ignorescreen=false; | |
| 5429 | 5768 | bool ignoreffc=false; | |
| 5430 | 5768 | bool pound=false; | |
| 5431 | |||
| 5432 |
9/10✓ Branch 0 taken 5073 times.
✓ Branch 1 taken 695 times.
✓ Branch 2 taken 5063 times.
✓ Branch 3 taken 10 times.
✓ Branch 4 taken 5063 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 5061 times.
✓ Branch 7 taken 2 times.
✓ Branch 8 taken 2 times.
✓ Branch 9 taken 5059 times.
|
5768 | if(type!=cPOUND && flag!=mfHAMMER && flag!=mfSTRIKE && flag2!=mfHAMMER && flag2!=mfSTRIKE) |
| 5433 | 5059 | ignorescreen = true; // Affect only FFCs | |
| 5434 | |||
| 5435 |
2/2✓ Branch 0 taken 5301 times.
✓ Branch 1 taken 467 times.
|
5768 | if(get_bit(grid, pos) != 0) |
| 5436 | 467 | ignorescreen = true; | |
| 5437 | |||
| 5438 | 5768 | auto current_ffc_handle = getFFCAt(fx,fy); | |
| 5439 | |||
| 5440 |
3/4✓ Branch 0 taken 42 times.
✓ Branch 1 taken 5726 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 42 times.
|
5768 | if (!current_ffc_handle || current_ffc_handle->ffc->recently_hit) |
| 5441 | 5726 | ignoreffc = true; | |
| 5442 | |||
| 5443 |
3/6✓ Branch 0 taken 5768 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5768 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 5768 times.
|
5768 | if(type2!=cPOUND && flag3!=mfSTRIKE && flag3!=mfHAMMER) |
| 5444 | 5768 | ignoreffc = true; | |
| 5445 | |||
| 5446 |
3/4✓ Branch 0 taken 5230 times.
✓ Branch 1 taken 538 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5230 times.
|
5768 | if(ignorescreen && ignoreffc) // Nothing to do. |
| 5447 | 5230 | return; | |
| 5448 | |||
| 5449 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 538 times.
|
538 | mapscr *s = cur_screen >= 128 ? special_warp_return_scr : get_scr_for_world_xy(bx, by); |
| 5450 | |||
| 5451 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 538 times.
|
538 | if(!ignorescreen) |
| 5452 | { | ||
| 5453 |
3/4✓ Branch 0 taken 510 times.
✓ Branch 1 taken 28 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 510 times.
|
538 | if(flag==mfHAMMER||flag==mfSTRIKE) // Takes precedence over Secret Tile and Armos->Secret |
| 5454 | { | ||
| 5455 | 28 | trigger_secrets_if_flag(bx,by,mfHAMMER,true); | |
| 5456 | 28 | trigger_secrets_if_flag(bx,by,mfSTRIKE,true); | |
| 5457 | 28 | } | |
| 5458 |
3/4✓ Branch 0 taken 508 times.
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 508 times.
|
510 | else if(flag2==mfHAMMER||flag2==mfSTRIKE) |
| 5459 | { | ||
| 5460 | 2 | trigger_secrets_if_flag(bx,by,mfHAMMER,true); | |
| 5461 | 2 | trigger_secrets_if_flag(bx,by,mfSTRIKE,true); | |
| 5462 | 2 | } | |
| 5463 |
3/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 503 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5 times.
|
508 | else if((flag >= 16)&&(flag <= 31)) |
| 5464 | { | ||
| 5465 | 5 | s->data[pos] = s->secretcombo[(s->sflag[pos])-16+4]; | |
| 5466 | 5 | s->cset[pos] = s->secretcset[(s->sflag[pos])-16+4]; | |
| 5467 | 5 | s->sflag[pos] = s->secretflag[(s->sflag[pos])-16+4]; | |
| 5468 | 5 | } | |
| 5469 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 503 times.
|
503 | else if(flag == mfARMOS_SECRET) |
| 5470 | { | ||
| 5471 | ✗ | s->data[pos] = s->secretcombo[sSTAIRS]; | |
| 5472 | ✗ | s->cset[pos] = s->secretcset[sSTAIRS]; | |
| 5473 | ✗ | s->sflag[pos] = s->secretflag[sSTAIRS]; | |
| 5474 | ✗ | sfx(s->secretsfx); | |
| 5475 | ✗ | } | |
| 5476 |
3/4✓ Branch 0 taken 6 times.
✓ Branch 1 taken 497 times.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
|
503 | else if((flag2 >= 16)&&(flag2 <= 31)) |
| 5477 | { | ||
| 5478 | ✗ | s->data[pos] = s->secretcombo[(s->sflag[pos])-16+4]; | |
| 5479 | ✗ | s->cset[pos] = s->secretcset[(s->sflag[pos])-16+4]; | |
| 5480 | ✗ | s->sflag[pos] = s->secretflag[(s->sflag[pos])-16+4]; | |
| 5481 | ✗ | } | |
| 5482 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 503 times.
|
503 | else if(flag2 == mfARMOS_SECRET) |
| 5483 | { | ||
| 5484 | ✗ | s->data[pos] = s->secretcombo[sSTAIRS]; | |
| 5485 | ✗ | s->cset[pos] = s->secretcset[sSTAIRS]; | |
| 5486 | ✗ | s->sflag[pos] = s->secretflag[sSTAIRS]; | |
| 5487 | ✗ | sfx(s->secretsfx); | |
| 5488 | ✗ | } | |
| 5489 | 503 | else pound = true; | |
| 5490 | 538 | } | |
| 5491 | |||
| 5492 |
1/2✓ Branch 0 taken 538 times.
✗ Branch 1 not taken.
|
538 | if(!ignoreffc) |
| 5493 | { | ||
| 5494 | ✗ | if(flag3==mfHAMMER||flag3==mfSTRIKE) | |
| 5495 | { | ||
| 5496 | ✗ | trigger_secrets_if_flag(fx,fy,mfHAMMER,true); | |
| 5497 | ✗ | trigger_secrets_if_flag(fx,fy,mfSTRIKE,true); | |
| 5498 | ✗ | } | |
| 5499 | else | ||
| 5500 | { | ||
| 5501 | ✗ | current_ffc_handle->increment_data(); | |
| 5502 | } | ||
| 5503 | ✗ | } | |
| 5504 | |||
| 5505 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 538 times.
|
538 | if(!ignorescreen) |
| 5506 | { | ||
| 5507 |
2/2✓ Branch 0 taken 35 times.
✓ Branch 1 taken 503 times.
|
538 | if(pound) |
| 5508 | 503 | s->data[pos]+=1; | |
| 5509 | |||
| 5510 | 538 | set_bit(grid,pos,1); | |
| 5511 | |||
| 5512 | 538 | set_bit(screengrid,pos,1); | |
| 5513 | |||
| 5514 |
5/8✓ Branch 0 taken 534 times.
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 534 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 4 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 4 times.
|
538 | if((flag==mfARMOS_ITEM||flag2==mfARMOS_ITEM) && (!getmapflag(s, (cur_screen < 128 && get_qr(qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM) || (s->flags9&fBELOWRETURN))) |
| 5515 | { | ||
| 5516 |
4/8✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 4 times.
✗ Branch 7 not taken.
|
4 | items.add(new item((zfix)bx, (zfix)by, (zfix)0, s->catchall, ipONETIME2 + ipBIGRANGE + ipHOLDUP | ((s->flags8&fITEMSECRET) ? ipSECRETS : 0), 0)); |
| 5517 | 4 | sfx(s->secretsfx); | |
| 5518 | 4 | } | |
| 5519 | |||
| 5520 |
4/4✓ Branch 0 taken 526 times.
✓ Branch 1 taken 12 times.
✓ Branch 2 taken 204 times.
✓ Branch 3 taken 322 times.
|
538 | if(type==cPOUND && get_qr(qr_MORESOUNDS)) |
| 5521 | 322 | sfx(QMisc.miscsfx[sfxHAMMERPOUND],pan(bx)); | |
| 5522 | |||
| 5523 | 538 | putcombo(scrollbuf, bx - viewport.x, by - viewport.y, s->data[pos], s->cset[pos]); | |
| 5524 | 538 | } | |
| 5525 | |||
| 5526 |
1/2✓ Branch 0 taken 538 times.
✗ Branch 1 not taken.
|
538 | if(!ignoreffc) |
| 5527 | { | ||
| 5528 | ✗ | current_ffc_handle->ffc->recently_hit = true; | |
| 5529 | |||
| 5530 | ✗ | if(type2==cPOUND && get_qr(qr_MORESOUNDS)) | |
| 5531 | ✗ | sfx(QMisc.miscsfx[sfxHAMMERPOUND],pan(bx)); | |
| 5532 | ✗ | } | |
| 5533 | |||
| 5534 | 538 | return; | |
| 5535 | 5768 | } | |
| 5536 | |||
| 5537 | 1288 | void HeroClass::check_pound_block_layer(int bx, int by, int lyr, weapon* w) | |
| 5538 | { | ||
| 5539 |
2/4✓ Branch 0 taken 1288 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1288 times.
|
1288 | if(lyr < 1 || lyr > 2) return; //sanity |
| 5540 | //keep things inside the screen boundaries | ||
| 5541 | 1288 | bx=vbound(bx, 0, world_w-1); | |
| 5542 | 1288 | by=vbound(by, 0, world_h-1); | |
| 5543 | 1288 | int32_t cid = MAPCOMBOL(lyr,bx,by); | |
| 5544 | 1288 | newcombo const& scr_cmb = combobuf[cid]; | |
| 5545 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1288 times.
|
1288 | auto* grid = w ? w->wscreengrid_layer[lyr-1] : screengrid_layer[lyr-1]; |
| 5546 | |||
| 5547 | //first things first | ||
| 5548 |
2/4✓ Branch 0 taken 1288 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1288 times.
|
1288 | if(z>8||fakez>8) return; |
| 5549 | |||
| 5550 | //find out which combo row/column the coordinates are in | ||
| 5551 | 1288 | bx = TRUNCATE_TILE(bx); | |
| 5552 | 1288 | by = TRUNCATE_TILE(by); | |
| 5553 | |||
| 5554 | 1288 | int32_t type = scr_cmb.type; | |
| 5555 | 1288 | int32_t flag = MAPFLAGL(lyr,bx,by); | |
| 5556 | 1288 | int32_t flag2 = scr_cmb.flag; | |
| 5557 | 1288 | auto rpos_handle = get_rpos_handle_for_world_xy(bx, by, lyr); | |
| 5558 | 1288 | int32_t i = rpos_handle.pos; | |
| 5559 | |||
| 5560 | 1288 | bool pound=false; | |
| 5561 | |||
| 5562 |
6/10✓ Branch 0 taken 1258 times.
✓ Branch 1 taken 30 times.
✓ Branch 2 taken 1258 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1258 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1258 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 1258 times.
|
1288 | if(type!=cPOUND && flag!=mfHAMMER && flag!=mfSTRIKE && flag2!=mfHAMMER && flag2!=mfSTRIKE) |
| 5563 | 1258 | return; | |
| 5564 | |||
| 5565 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 30 times.
|
30 | if(get_bit(grid, i) != 0) |
| 5566 | ✗ | return; | |
| 5567 | |||
| 5568 | 30 | mapscr *s = rpos_handle.scr; | |
| 5569 | |||
| 5570 |
2/4✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 30 times.
|
30 | if(flag==mfHAMMER||flag==mfSTRIKE) // Takes precedence over Secret Tile and Armos->Secret |
| 5571 | { | ||
| 5572 | ✗ | trigger_secrets_if_flag(bx,by,mfHAMMER,true); | |
| 5573 | ✗ | trigger_secrets_if_flag(bx,by,mfSTRIKE,true); | |
| 5574 | ✗ | } | |
| 5575 |
3/4✓ Branch 0 taken 28 times.
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 28 times.
|
30 | else if(flag2==mfHAMMER||flag2==mfSTRIKE) |
| 5576 | { | ||
| 5577 | 2 | trigger_secrets_if_flag(bx,by,mfHAMMER,true); | |
| 5578 | 2 | trigger_secrets_if_flag(bx,by,mfSTRIKE,true); | |
| 5579 | 2 | } | |
| 5580 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 28 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
28 | else if((flag >= 16)&&(flag <= 31)) |
| 5581 | { | ||
| 5582 | ✗ | s->data[i] = s->secretcombo[(s->sflag[i])-16+4]; | |
| 5583 | ✗ | s->cset[i] = s->secretcset[(s->sflag[i])-16+4]; | |
| 5584 | ✗ | s->sflag[i] = s->secretflag[(s->sflag[i])-16+4]; | |
| 5585 | ✗ | } | |
| 5586 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 28 times.
|
28 | else if(flag == mfARMOS_SECRET) |
| 5587 | { | ||
| 5588 | ✗ | s->data[i] = s->secretcombo[sSTAIRS]; | |
| 5589 | ✗ | s->cset[i] = s->secretcset[sSTAIRS]; | |
| 5590 | ✗ | s->sflag[i] = s->secretflag[sSTAIRS]; | |
| 5591 | ✗ | sfx(s->secretsfx); | |
| 5592 | ✗ | } | |
| 5593 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 28 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
28 | else if((flag2 >= 16)&&(flag2 <= 31)) |
| 5594 | { | ||
| 5595 | ✗ | s->data[i] = s->secretcombo[(s->sflag[i])-16+4]; | |
| 5596 | ✗ | s->cset[i] = s->secretcset[(s->sflag[i])-16+4]; | |
| 5597 | ✗ | s->sflag[i] = s->secretflag[(s->sflag[i])-16+4]; | |
| 5598 | ✗ | } | |
| 5599 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 28 times.
|
28 | else if(flag2 == mfARMOS_SECRET) |
| 5600 | { | ||
| 5601 | ✗ | s->data[i] = s->secretcombo[sSTAIRS]; | |
| 5602 | ✗ | s->cset[i] = s->secretcset[sSTAIRS]; | |
| 5603 | ✗ | s->sflag[i] = s->secretflag[sSTAIRS]; | |
| 5604 | ✗ | sfx(s->secretsfx); | |
| 5605 | ✗ | } | |
| 5606 | 28 | else pound = true; | |
| 5607 | |||
| 5608 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 28 times.
|
30 | if(pound) |
| 5609 | 28 | s->data[i]+=1; | |
| 5610 | |||
| 5611 | 30 | set_bit(grid,i,1); | |
| 5612 | |||
| 5613 |
2/8✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 30 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
30 | if((flag==mfARMOS_ITEM||flag2==mfARMOS_ITEM) && (!getmapflag(s, (cur_screen < 128 && get_qr(qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM) || (s->flags9&fBELOWRETURN))) |
| 5614 | { | ||
| 5615 | ✗ | items.add(new item((zfix)bx, (zfix)by, (zfix)0, s->catchall, ipONETIME2 + ipBIGRANGE + ipHOLDUP | ((s->flags8&fITEMSECRET) ? ipSECRETS : 0), 0)); | |
| 5616 | ✗ | sfx(s->secretsfx); | |
| 5617 | ✗ | } | |
| 5618 | |||
| 5619 |
2/4✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 30 times.
|
30 | if(type==cPOUND && get_qr(qr_MORESOUNDS)) |
| 5620 | 30 | sfx(QMisc.miscsfx[sfxHAMMERPOUND],pan(bx)); | |
| 5621 | |||
| 5622 | |||
| 5623 | 30 | putcombo(scrollbuf,bx-viewport.x,by-viewport.y,s->data[i],s->cset[i]); | |
| 5624 | 1288 | } | |
| 5625 | |||
| 5626 | ✗ | void HeroClass::check_wand_block(weapon *w) | |
| 5627 | { | ||
| 5628 | |||
| 5629 | ✗ | int32_t par_item = w->parentitem; | |
| 5630 | ✗ | int32_t usewpn = -1; | |
| 5631 | ✗ | if ( par_item > -1 ) | |
| 5632 | { | ||
| 5633 | ✗ | usewpn = itemsbuf[par_item].weap_data.imitate_weapon; | |
| 5634 | ✗ | } | |
| 5635 | ✗ | else if ( par_item == -1 && w->ScriptGenerated ) | |
| 5636 | { | ||
| 5637 | ✗ | usewpn = w->useweapon; | |
| 5638 | ✗ | } | |
| 5639 | ✗ | if(usewpn != wWand) return; | |
| 5640 | |||
| 5641 | |||
| 5642 | ✗ | int32_t bx = 0, by = 0; | |
| 5643 | ✗ | bx = ((int32_t)w->x) + (((int32_t)w->hit_width)/2); | |
| 5644 | ✗ | by = ((int32_t)w->y) + (((int32_t)w->hit_height)/2); | |
| 5645 | |||
| 5646 | //keep things inside the screen boundaries | ||
| 5647 | ✗ | bx=vbound(bx, 0, world_w-1); | |
| 5648 | ✗ | by=vbound(by, 0, world_h-1); | |
| 5649 | ✗ | int32_t fx=bx; | |
| 5650 | ✗ | int32_t fy=by; | |
| 5651 | ✗ | int32_t cid = MAPCOMBO(bx,by); | |
| 5652 | //first things first | ||
| 5653 | ✗ | if(z>8||fakez>8) return; | |
| 5654 | |||
| 5655 | //find out which combo row/column the coordinates are in | ||
| 5656 | ✗ | bx = TRUNCATE_TILE(bx); | |
| 5657 | ✗ | by = TRUNCATE_TILE(by); | |
| 5658 | |||
| 5659 | ✗ | int32_t flag = MAPFLAG(bx,by); | |
| 5660 | ✗ | int32_t flag2 = MAPCOMBOFLAG(bx,by); | |
| 5661 | ✗ | int32_t flag3=0; | |
| 5662 | ✗ | int32_t flag31 = MAPFFCOMBOFLAG(fx,fy); | |
| 5663 | ✗ | int32_t flag32 = MAPFFCOMBOFLAG(fx,fy); | |
| 5664 | ✗ | int32_t flag33 = MAPFFCOMBOFLAG(fx,fy); | |
| 5665 | ✗ | int32_t flag34 = MAPFFCOMBOFLAG(fx,fy); | |
| 5666 | |||
| 5667 | ✗ | if(flag31==mfWAND||flag32==mfWAND||flag33==mfWAND||flag34==mfWAND) | |
| 5668 | ✗ | flag3=mfWAND; | |
| 5669 | |||
| 5670 | ✗ | if(flag31==mfSTRIKE||flag32==mfSTRIKE||flag33==mfSTRIKE||flag34==mfSTRIKE) | |
| 5671 | ✗ | flag3=mfSTRIKE; | |
| 5672 | |||
| 5673 | ✗ | if(flag!=mfWAND&&flag2!=mfWAND&&flag3!=mfWAND&&flag!=mfSTRIKE&&flag2!=mfSTRIKE&&flag3!=mfSTRIKE) | |
| 5674 | ✗ | return; | |
| 5675 | |||
| 5676 | ✗ | if((trigger_secrets_if_flag(bx,by,mfWAND,true)==false)&&(trigger_secrets_if_flag(bx,by,mfSTRIKE,true)==false)) | |
| 5677 | { | ||
| 5678 | ✗ | if(flag3==mfWAND||flag3==mfSTRIKE) | |
| 5679 | { | ||
| 5680 | ✗ | trigger_secrets_if_flag(fx,fy,mfWAND,true); | |
| 5681 | ✗ | trigger_secrets_if_flag(fx,fy,mfSTRIKE,true); | |
| 5682 | ✗ | } | |
| 5683 | ✗ | } | |
| 5684 | ✗ | } | |
| 5685 | |||
| 5686 | //defend results should match defence types. | ||
| 5687 | //RETURN VALUES: | ||
| 5688 | // -1 iGNORE WEAPON | ||
| 5689 | // 0 No effects | ||
| 5690 | // 1 Effects, weapon is not ignored or removed | ||
| 5691 | 11869 | int32_t HeroClass::defend(weapon *w) | |
| 5692 | { | ||
| 5693 | 11869 | int32_t def = conv_edef_unblockable(defence[w->id], w->unblockable); | |
| 5694 |
2/25✓ Branch 0 taken 11860 times.
✓ Branch 1 taken 9 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
✗ Branch 22 not taken.
✗ Branch 23 not taken.
✗ Branch 24 not taken.
|
11869 | switch(def) |
| 5695 | { | ||
| 5696 | 11860 | case edNORMAL: return 1; | |
| 5697 | case edHALFDAMAGE: // : IMPLEMENTED : Take half damage | ||
| 5698 | { | ||
| 5699 | ✗ | w->power *= 0.5; | |
| 5700 | ✗ | return 1; | |
| 5701 | } | ||
| 5702 | case edQUARTDAMAGE: | ||
| 5703 | { | ||
| 5704 | ✗ | w->power *= 0.25; | |
| 5705 | ✗ | return 1; | |
| 5706 | } | ||
| 5707 | case edSTUNONLY: | ||
| 5708 | { | ||
| 5709 | ✗ | setStunClock(120); | |
| 5710 | ✗ | return 1; | |
| 5711 | } | ||
| 5712 | case edSTUNORCHINK: // : IMPLEMENTED : If damage > 0, stun instead. Else, bounce off. | ||
| 5713 | { | ||
| 5714 | ✗ | if (w->power > 0) | |
| 5715 | { | ||
| 5716 | ✗ | setStunClock(120); | |
| 5717 | ✗ | return 1; | |
| 5718 | } | ||
| 5719 | else | ||
| 5720 | { | ||
| 5721 | ✗ | sfx(WAV_CHINK,pan(x)); | |
| 5722 | ✗ | w->dead = 0; | |
| 5723 | ✗ | return -1; | |
| 5724 | } | ||
| 5725 | } | ||
| 5726 | case edSTUNORIGNORE: // : IMPLEMENTED : If damage > 0, stun instead. Else, ignore. | ||
| 5727 | { | ||
| 5728 | ✗ | if (w->power > 0) | |
| 5729 | { | ||
| 5730 | ✗ | setStunClock(120); | |
| 5731 | ✗ | return 1; | |
| 5732 | } | ||
| 5733 | else | ||
| 5734 | { | ||
| 5735 | ✗ | return -1; | |
| 5736 | } | ||
| 5737 | } | ||
| 5738 | case edCHINKL1: // : IMPLEMENTED : Bounces off, plays SFX_CHINK | ||
| 5739 | { | ||
| 5740 | ✗ | if (w->power < 1) | |
| 5741 | { | ||
| 5742 | ✗ | sfx(WAV_CHINK,pan(x)); | |
| 5743 | ✗ | w->dead = 0; | |
| 5744 | ✗ | return -1; | |
| 5745 | } | ||
| 5746 | else | ||
| 5747 | { | ||
| 5748 | ✗ | return 1; | |
| 5749 | } | ||
| 5750 | } | ||
| 5751 | case edCHINKL2: // : IMPLEMENTED : Bounce off unless damage >= 2 | ||
| 5752 | { | ||
| 5753 | ✗ | if (w->power < 2) | |
| 5754 | { | ||
| 5755 | ✗ | sfx(WAV_CHINK,pan(x)); | |
| 5756 | ✗ | w->dead = 0; | |
| 5757 | ✗ | return -1; | |
| 5758 | } | ||
| 5759 | else | ||
| 5760 | { | ||
| 5761 | ✗ | return 1; | |
| 5762 | } | ||
| 5763 | } | ||
| 5764 | case edCHINKL4: //: IMPLEMENTED : Bounce off unless damage >= 4 | ||
| 5765 | { | ||
| 5766 | ✗ | if (w->power < 4) | |
| 5767 | { | ||
| 5768 | ✗ | sfx(WAV_CHINK,pan(x)); | |
| 5769 | ✗ | w->dead = 0; | |
| 5770 | ✗ | return -1; | |
| 5771 | } | ||
| 5772 | else | ||
| 5773 | { | ||
| 5774 | ✗ | return 1; | |
| 5775 | } | ||
| 5776 | } | ||
| 5777 | case edCHINKL6: // : IMPLEMENTED : Bounce off unless damage >= 6 | ||
| 5778 | { | ||
| 5779 | ✗ | if (w->power < 6) | |
| 5780 | { | ||
| 5781 | ✗ | sfx(WAV_CHINK,pan(x)); | |
| 5782 | ✗ | w->dead = 0; | |
| 5783 | ✗ | return -1; | |
| 5784 | } | ||
| 5785 | else | ||
| 5786 | { | ||
| 5787 | ✗ | return 1; | |
| 5788 | } | ||
| 5789 | } | ||
| 5790 | case edCHINKL8: // : IMPLEMENTED : Bounce off unless damage >= 8 | ||
| 5791 | { | ||
| 5792 | ✗ | if (w->power < 8) | |
| 5793 | { | ||
| 5794 | ✗ | sfx(WAV_CHINK,pan(x)); | |
| 5795 | ✗ | w->dead = 0; | |
| 5796 | ✗ | return -1; | |
| 5797 | } | ||
| 5798 | else | ||
| 5799 | { | ||
| 5800 | ✗ | return 1; | |
| 5801 | } | ||
| 5802 | } | ||
| 5803 | case edCHINK: // : IMPLEMENTED : Bounces off, plays SFX_CHINK | ||
| 5804 | { | ||
| 5805 | ✗ | sfx(WAV_CHINK,pan(x)); | |
| 5806 | ✗ | w->dead = 0; | |
| 5807 | ✗ | return -1; | |
| 5808 | } | ||
| 5809 | case edIGNOREL1: // : IMPLEMENTED : Ignore unless damage > 1. | ||
| 5810 | { | ||
| 5811 | ✗ | if (w->power < 1) | |
| 5812 | { | ||
| 5813 | ✗ | return -1; | |
| 5814 | } | ||
| 5815 | ✗ | else return 1; | |
| 5816 | } | ||
| 5817 | case edIGNORE: // : IMPLEMENTED : Do Nothing | ||
| 5818 | { | ||
| 5819 | ✗ | return -1; | |
| 5820 | } | ||
| 5821 | case ed1HKO: // : IMPLEMENTED : One-hit knock-out | ||
| 5822 | { | ||
| 5823 | ✗ | game->set_life(0); | |
| 5824 | ✗ | return 1; | |
| 5825 | } | ||
| 5826 | case edCHINKL10: //: IMPLEMENTED : If damage is less than 10 | ||
| 5827 | { | ||
| 5828 | ✗ | if (w->power < 10) | |
| 5829 | { | ||
| 5830 | ✗ | sfx(WAV_CHINK,pan(x)); | |
| 5831 | ✗ | w->dead = 0; | |
| 5832 | ✗ | return -1; | |
| 5833 | } | ||
| 5834 | else | ||
| 5835 | { | ||
| 5836 | ✗ | return 1; | |
| 5837 | } | ||
| 5838 | } | ||
| 5839 | case ed2x: // : IMPLEMENTED : Double damage. | ||
| 5840 | { | ||
| 5841 | ✗ | w->power *= 2; | |
| 5842 | ✗ | return 1; | |
| 5843 | } | ||
| 5844 | case ed3x: // : IMPLEMENTED : Triple Damage. | ||
| 5845 | { | ||
| 5846 | ✗ | w->power *= 3; | |
| 5847 | ✗ | return 1; | |
| 5848 | } | ||
| 5849 | case ed4x: // : IMPLEMENTED : 4x damage. | ||
| 5850 | { | ||
| 5851 | ✗ | w->power *= 4; | |
| 5852 | ✗ | return 1; | |
| 5853 | } | ||
| 5854 | case edHEAL: // : IMPLEMENTED : Gain the weapon damage in HP. | ||
| 5855 | { | ||
| 5856 | //sfx(WAV_HEAL,pan(x)); | ||
| 5857 | ✗ | game->set_life(zc_min(game->get_life()+w->power, game->get_maxlife())); | |
| 5858 | ✗ | w->dead = 0; | |
| 5859 | ✗ | return -1; | |
| 5860 | } | ||
| 5861 | |||
| 5862 | ✗ | case edFREEZE: return 1; //Not IMPLEMENTED | |
| 5863 | |||
| 5864 | case edLEVELDAMAGE: //Damage * item level | ||
| 5865 | { | ||
| 5866 | ✗ | w->power *= w->family_level; | |
| 5867 | ✗ | return 1; | |
| 5868 | } | ||
| 5869 | case edLEVELREDUCTION: //Damage / item level | ||
| 5870 | { | ||
| 5871 | ✗ | if ( w->family_level > 0 ) | |
| 5872 | { | ||
| 5873 | ✗ | w->power /= w->family_level; | |
| 5874 | ✗ | } | |
| 5875 | ✗ | else w->power = 0; | |
| 5876 | ✗ | return 1; | |
| 5877 | } | ||
| 5878 | |||
| 5879 | //edLEVELCHINK2, //If item level is < 2: This needs a weapon variable that is set by | ||
| 5880 | //edLEVELCHINK3, //If item level is < 3: the item that generates it (itemdata::level stored to | ||
| 5881 | //edLEVELCHINK4, //If item level is < 4: weapon::level, or something similar; then a check to | ||
| 5882 | //edLEVELCHINK5, //If item level is < 5: read weapon::level in hit detection. | ||
| 5883 | |||
| 5884 | //edSHOCK, //buzz blob | ||
| 5885 | |||
| 5886 | |||
| 5887 | case edBREAKSHIELD: //destroy the player's present shield | ||
| 5888 | { | ||
| 5889 | ✗ | w->power = 0; | |
| 5890 | ✗ | w->dead = 0; | |
| 5891 | ✗ | int32_t itemid = getCurrentShield(); | |
| 5892 | //sfx(WAV_BREAKSHIELD,pan(x)); | ||
| 5893 | ✗ | if(itemsbuf[itemid].flags&item_edible) | |
| 5894 | ✗ | game->set_item(itemid, false); | |
| 5895 | //Remove Hero's shield | ||
| 5896 | ✗ | return -1; | |
| 5897 | } | ||
| 5898 | |||
| 5899 | |||
| 5900 | |||
| 5901 | 9 | default: return 0; | |
| 5902 | } | ||
| 5903 | 11869 | } | |
| 5904 | 1327 | ALLEGRO_COLOR HeroClass::hitboxColor(byte opacity) const | |
| 5905 | { | ||
| 5906 | 1327 | return al_map_rgba(0,0,255,opacity); | |
| 5907 | } | ||
| 5908 | 11238 | int32_t HeroClass::compareDir(int32_t other) | |
| 5909 | { | ||
| 5910 |
5/6✓ Branch 0 taken 11220 times.
✓ Branch 1 taken 18 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 11220 times.
✓ Branch 4 taken 165 times.
✓ Branch 5 taken 11073 times.
|
11238 | if(other != NORMAL_DIR(other)) |
| 5911 | 165 | return 0; //*sigh* scripts expect dirs >=8 to NOT hit shields... | |
| 5912 | 11073 | int32_t ret = 0; | |
| 5913 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11073 times.
|
11073 | auto d = (shield_forcedir < 0) ? dir : shield_forcedir; |
| 5914 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 2194 times.
✓ Branch 2 taken 1873 times.
✓ Branch 3 taken 3507 times.
✓ Branch 4 taken 3499 times.
|
11073 | switch(d) |
| 5915 | { | ||
| 5916 | case up: | ||
| 5917 | { | ||
| 5918 |
3/3✓ Branch 0 taken 547 times.
✓ Branch 1 taken 856 times.
✓ Branch 2 taken 791 times.
|
2194 | switch(X_DIR(other)) |
| 5919 | { | ||
| 5920 | case left: | ||
| 5921 | 856 | ret |= CMPDIR_RIGHT; | |
| 5922 | 856 | break; | |
| 5923 | case right: | ||
| 5924 | 791 | ret |= CMPDIR_LEFT; | |
| 5925 | 791 | break; | |
| 5926 | } | ||
| 5927 |
3/3✓ Branch 0 taken 263 times.
✓ Branch 1 taken 361 times.
✓ Branch 2 taken 1570 times.
|
2194 | switch(Y_DIR(other)) |
| 5928 | { | ||
| 5929 | case up: | ||
| 5930 | 361 | ret |= CMPDIR_BACK; | |
| 5931 | 361 | break; | |
| 5932 | case down: | ||
| 5933 | 1570 | ret |= CMPDIR_FRONT; | |
| 5934 | 1570 | break; | |
| 5935 | } | ||
| 5936 | 2194 | break; | |
| 5937 | } | ||
| 5938 | case down: | ||
| 5939 | { | ||
| 5940 |
3/3✓ Branch 0 taken 535 times.
✓ Branch 1 taken 621 times.
✓ Branch 2 taken 717 times.
|
1873 | switch(X_DIR(other)) |
| 5941 | { | ||
| 5942 | case left: | ||
| 5943 | 621 | ret |= CMPDIR_LEFT; | |
| 5944 | 621 | break; | |
| 5945 | case right: | ||
| 5946 | 717 | ret |= CMPDIR_RIGHT; | |
| 5947 | 717 | break; | |
| 5948 | } | ||
| 5949 |
3/3✓ Branch 0 taken 283 times.
✓ Branch 1 taken 1273 times.
✓ Branch 2 taken 317 times.
|
1873 | switch(Y_DIR(other)) |
| 5950 | { | ||
| 5951 | case up: | ||
| 5952 | 1273 | ret |= CMPDIR_FRONT; | |
| 5953 | 1273 | break; | |
| 5954 | case down: | ||
| 5955 | 317 | ret |= CMPDIR_BACK; | |
| 5956 | 317 | break; | |
| 5957 | } | ||
| 5958 | 1873 | break; | |
| 5959 | } | ||
| 5960 | case left: | ||
| 5961 | { | ||
| 5962 |
3/3✓ Branch 0 taken 209 times.
✓ Branch 1 taken 510 times.
✓ Branch 2 taken 2788 times.
|
3507 | switch(X_DIR(other)) |
| 5963 | { | ||
| 5964 | case left: | ||
| 5965 | 510 | ret |= CMPDIR_BACK; | |
| 5966 | 510 | break; | |
| 5967 | case right: | ||
| 5968 | 2788 | ret |= CMPDIR_FRONT; | |
| 5969 | 2788 | break; | |
| 5970 | } | ||
| 5971 |
3/3✓ Branch 0 taken 1415 times.
✓ Branch 1 taken 898 times.
✓ Branch 2 taken 1194 times.
|
3507 | switch(Y_DIR(other)) |
| 5972 | { | ||
| 5973 | case up: | ||
| 5974 | 898 | ret |= CMPDIR_LEFT; | |
| 5975 | 898 | break; | |
| 5976 | case down: | ||
| 5977 | 1194 | ret |= CMPDIR_RIGHT; | |
| 5978 | 1194 | break; | |
| 5979 | } | ||
| 5980 | 3507 | break; | |
| 5981 | } | ||
| 5982 | case right: | ||
| 5983 | { | ||
| 5984 |
3/3✓ Branch 0 taken 240 times.
✓ Branch 1 taken 2771 times.
✓ Branch 2 taken 488 times.
|
3499 | switch(X_DIR(other)) |
| 5985 | { | ||
| 5986 | case left: | ||
| 5987 | 2771 | ret |= CMPDIR_FRONT; | |
| 5988 | 2771 | break; | |
| 5989 | case right: | ||
| 5990 | 488 | ret |= CMPDIR_BACK; | |
| 5991 | 488 | break; | |
| 5992 | } | ||
| 5993 |
3/3✓ Branch 0 taken 1397 times.
✓ Branch 1 taken 884 times.
✓ Branch 2 taken 1218 times.
|
3499 | switch(Y_DIR(other)) |
| 5994 | { | ||
| 5995 | case up: | ||
| 5996 | 884 | ret |= CMPDIR_RIGHT; | |
| 5997 | 884 | break; | |
| 5998 | case down: | ||
| 5999 | 1218 | ret |= CMPDIR_LEFT; | |
| 6000 | 1218 | break; | |
| 6001 | } | ||
| 6002 | 3499 | break; | |
| 6003 | } | ||
| 6004 | } | ||
| 6005 | 11073 | return ret; | |
| 6006 | 11238 | } | |
| 6007 | |||
| 6008 | 11238 | bool compareShield(int32_t cmpdir, itemdata const& shield) | |
| 6009 | { | ||
| 6010 |
1/2✓ Branch 0 taken 11238 times.
✗ Branch 1 not taken.
|
11238 | bool standard = !(shield.flags&item_flag9) || usingActiveShield(); |
| 6011 |
1/2✓ Branch 0 taken 11238 times.
✗ Branch 1 not taken.
|
11238 | if(standard) //Use standard sides, either a passive shield, or a held active shield |
| 6012 | { | ||
| 6013 |
4/4✓ Branch 0 taken 8402 times.
✓ Branch 1 taken 2836 times.
✓ Branch 2 taken 9 times.
✓ Branch 3 taken 8393 times.
|
11238 | if((cmpdir&CMPDIR_FRONT) && (shield.flags&item_flag1)) |
| 6014 | 8393 | return true; | |
| 6015 |
3/4✓ Branch 0 taken 1676 times.
✓ Branch 1 taken 1169 times.
✓ Branch 2 taken 1676 times.
✗ Branch 3 not taken.
|
2845 | else if((cmpdir&CMPDIR_BACK) && (shield.flags&item_flag2)) |
| 6016 | ✗ | return true; | |
| 6017 |
3/4✓ Branch 0 taken 1042 times.
✓ Branch 1 taken 1803 times.
✓ Branch 2 taken 1042 times.
✗ Branch 3 not taken.
|
2845 | else if((cmpdir&CMPDIR_LEFT) && (shield.flags&item_flag3)) |
| 6018 | ✗ | return true; | |
| 6019 |
3/4✓ Branch 0 taken 1207 times.
✓ Branch 1 taken 1638 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1207 times.
|
2845 | else if((cmpdir&CMPDIR_RIGHT) && (shield.flags&item_flag4)) |
| 6020 | ✗ | return true; | |
| 6021 | 2845 | } | |
| 6022 | else //Active Shield that is NOT held down | ||
| 6023 | { | ||
| 6024 | ✗ | if((cmpdir&CMPDIR_FRONT) && (shield.flags&item_flag5)) | |
| 6025 | ✗ | return true; | |
| 6026 | ✗ | else if((cmpdir&CMPDIR_BACK) && (shield.flags&item_flag6)) | |
| 6027 | ✗ | return true; | |
| 6028 | ✗ | else if((cmpdir&CMPDIR_LEFT) && (shield.flags&item_flag7)) | |
| 6029 | ✗ | return true; | |
| 6030 | ✗ | else if((cmpdir&CMPDIR_RIGHT) && (shield.flags&item_flag8)) | |
| 6031 | ✗ | return true; | |
| 6032 | } | ||
| 6033 | 2845 | return false; | |
| 6034 | 11238 | } | |
| 6035 | |||
| 6036 | 7373 | static bool sh_check(uint fl_block, uint fl_ref, int wty, bool& reflect, bool boss, bool defret) | |
| 6037 | { | ||
| 6038 | 7373 | reflect = false; | |
| 6039 |
12/22✓ Branch 0 taken 3597 times.
✓ Branch 1 taken 381 times.
✓ Branch 2 taken 425 times.
✓ Branch 3 taken 991 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 512 times.
✓ Branch 6 taken 1039 times.
✓ Branch 7 taken 2 times.
✓ Branch 8 taken 20 times.
✓ Branch 9 taken 393 times.
✓ Branch 10 taken 10 times.
✓ Branch 11 taken 2 times.
✓ Branch 12 taken 1 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
|
7373 | switch(wty) |
| 6040 | { | ||
| 6041 | case ewBrang: | ||
| 6042 |
1/2✓ Branch 0 taken 393 times.
✗ Branch 1 not taken.
|
393 | if(!(fl_block & sh_brang)) break; |
| 6043 | |||
| 6044 | 393 | reflect = ((fl_ref & sh_brang) != 0); | |
| 6045 | 393 | return true; | |
| 6046 | case ewArrow: | ||
| 6047 | case wRefArrow: | ||
| 6048 |
1/2✓ Branch 0 taken 381 times.
✗ Branch 1 not taken.
|
381 | if(!(fl_block & sh_arrow)) break; |
| 6049 | |||
| 6050 | 381 | reflect = ((fl_ref & sh_arrow) != 0); | |
| 6051 | 381 | return true; | |
| 6052 | |||
| 6053 | case ewRock: | ||
| 6054 | case wRefRock: | ||
| 6055 |
1/2✓ Branch 0 taken 425 times.
✗ Branch 1 not taken.
|
425 | if(!(fl_block & sh_rock)) break; |
| 6056 | |||
| 6057 | 425 | reflect = ((fl_ref & sh_rock) != 0); | |
| 6058 | 425 | return true; | |
| 6059 | case ewFlame: | ||
| 6060 | case wRefFire: | ||
| 6061 |
2/2✓ Branch 0 taken 641 times.
✓ Branch 1 taken 350 times.
|
991 | if(!(fl_block & sh_flame)) break; |
| 6062 | |||
| 6063 | 641 | reflect = ((fl_ref & sh_flame) != 0); | |
| 6064 | 641 | return true; | |
| 6065 | case ewFlame2: | ||
| 6066 | case wRefFire2: | ||
| 6067 | ✗ | if(get_qr(qr_BROKEN_FLAME_ARROW_REFLECTING)) | |
| 6068 | ✗ | return true; | |
| 6069 | ✗ | if(!(fl_block & sh_flame2)) break; | |
| 6070 | |||
| 6071 | ✗ | reflect = ((fl_ref & sh_flame2) != 0); | |
| 6072 | ✗ | return true; | |
| 6073 | |||
| 6074 | case ewFireball2: | ||
| 6075 | case ewFireball: | ||
| 6076 | case wRefFireball: | ||
| 6077 | { | ||
| 6078 | 3597 | int32_t mask = (boss ? sh_fireball2 : sh_fireball); | |
| 6079 | |||
| 6080 |
2/2✓ Branch 0 taken 3113 times.
✓ Branch 1 taken 484 times.
|
3597 | if(!(fl_block & mask)) break; |
| 6081 | |||
| 6082 | 3113 | reflect = ((fl_ref & mask) != 0); | |
| 6083 | 3113 | return true; | |
| 6084 | } | ||
| 6085 | |||
| 6086 | case ewSword: | ||
| 6087 | case wRefBeam: | ||
| 6088 |
2/2✓ Branch 0 taken 421 times.
✓ Branch 1 taken 91 times.
|
512 | if(!(fl_block & sh_sword)) break; |
| 6089 | |||
| 6090 | 421 | reflect = ((fl_ref & sh_sword) != 0); | |
| 6091 | 421 | return true; | |
| 6092 | |||
| 6093 | case wRefMagic: | ||
| 6094 | case ewMagic: | ||
| 6095 |
2/2✓ Branch 0 taken 969 times.
✓ Branch 1 taken 70 times.
|
1039 | if(!(fl_block & sh_magic)) break; |
| 6096 | |||
| 6097 | 969 | reflect = ((fl_ref & sh_magic) != 0); | |
| 6098 | 969 | return true; | |
| 6099 | |||
| 6100 | #define SCRIPT_SHBLOCK(scrfl) \ | ||
| 6101 | if(!(fl_block & (sh_script|scrfl))) break; \ | ||
| 6102 | reflect = ((fl_ref & (sh_script|scrfl)) != 0); \ | ||
| 6103 | return true | ||
| 6104 |
2/2✓ Branch 0 taken 9 times.
✓ Branch 1 taken 1 times.
|
10 | case wScript1: SCRIPT_SHBLOCK(sh_script1); |
| 6105 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | case wScript2: SCRIPT_SHBLOCK(sh_script2); |
| 6106 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | case wScript3: SCRIPT_SHBLOCK(sh_script3); |
| 6107 | ✗ | case wScript4: SCRIPT_SHBLOCK(sh_script4); | |
| 6108 | ✗ | case wScript5: SCRIPT_SHBLOCK(sh_script5); | |
| 6109 | ✗ | case wScript6: SCRIPT_SHBLOCK(sh_script6); | |
| 6110 | ✗ | case wScript7: SCRIPT_SHBLOCK(sh_script7); | |
| 6111 | ✗ | case wScript8: SCRIPT_SHBLOCK(sh_script8); | |
| 6112 | ✗ | case wScript9: SCRIPT_SHBLOCK(sh_script9); | |
| 6113 | ✗ | case wScript10: SCRIPT_SHBLOCK(sh_script10); | |
| 6114 | #undef SCRIPT_SHBLOCK | ||
| 6115 | |||
| 6116 | case wWind: | ||
| 6117 | ✗ | if(!(fl_block & sh_lw_wind)) break; | |
| 6118 | |||
| 6119 | ✗ | reflect = ((fl_ref & sh_lw_wind) != 0); | |
| 6120 | ✗ | return true; | |
| 6121 | case ewWind: | ||
| 6122 | ✗ | if(!(fl_block & sh_ew_wind)) break; | |
| 6123 | |||
| 6124 | ✗ | reflect = ((fl_ref & sh_ew_wind) != 0); | |
| 6125 | ✗ | return true; | |
| 6126 | |||
| 6127 | case ewLitBomb: | ||
| 6128 | case ewLitSBomb: | ||
| 6129 | 2 | return true; | |
| 6130 | |||
| 6131 | default: | ||
| 6132 | 20 | return defret; | |
| 6133 | } | ||
| 6134 | 1004 | return false; | |
| 6135 | 7373 | } | |
| 6136 | |||
| 6137 | ✗ | bool HeroClass::check_ewpn_collide(weapon* w) | |
| 6138 | { | ||
| 6139 | ✗ | if(w->ignoreHero || w->fallclk|| w->drownclk) | |
| 6140 | ✗ | return false; | |
| 6141 | ✗ | if(!w->hit(x+7,y+7-fakez,z,2,2,1)) | |
| 6142 | ✗ | return false; | |
| 6143 | |||
| 6144 | ✗ | int32_t stompid = current_item_id(itype_stompboots); | |
| 6145 | |||
| 6146 | ✗ | if(current_item(itype_stompboots) && checkbunny(stompid) && checkmagiccost(stompid) && (stomping || | |
| 6147 | ✗ | ((z+fakez) > (w->z+(w->fakez))) || | |
| 6148 | ✗ | ((isSideViewHero() && (y+16)-(w->y)<=14) && falling_oldy<y))) | |
| 6149 | { | ||
| 6150 | ✗ | itemdata const& stomp = itemsbuf[stompid]; | |
| 6151 | ✗ | bool reflect = false; //unused, always false | |
| 6152 | ✗ | if(!sh_check(stomp.misc2, 0, w->id, reflect, w->level&1, true)) | |
| 6153 | { | ||
| 6154 | ✗ | w->onhit(false); | |
| 6155 | ✗ | sfx(WAV_CHINK,pan(x)); | |
| 6156 | ✗ | return false; | |
| 6157 | } | ||
| 6158 | ✗ | } | |
| 6159 | |||
| 6160 | ✗ | int32_t defresult = defend(w); | |
| 6161 | ✗ | if ( defresult == -1 ) return false; //The weapon did something special, but it is otherwise ignored, possibly killed by defend(). | |
| 6162 | |||
| 6163 | ✗ | if(w->id==ewWind) | |
| 6164 | { | ||
| 6165 | ✗ | xofs=1000; | |
| 6166 | ✗ | action=freeze; FFCore.setHeroAction(freeze); | |
| 6167 | ✗ | w->misc=999; // in enemy wind | |
| 6168 | ✗ | attackclk=0; | |
| 6169 | ✗ | return false; | |
| 6170 | } | ||
| 6171 | |||
| 6172 | ✗ | switch(w->id) | |
| 6173 | { | ||
| 6174 | case ewLitBomb: | ||
| 6175 | case ewBomb: | ||
| 6176 | case ewLitSBomb: | ||
| 6177 | case ewSBomb: | ||
| 6178 | ✗ | return true; | |
| 6179 | } | ||
| 6180 | |||
| 6181 | ✗ | int32_t itemid = getCurrentShield(false); | |
| 6182 | ✗ | if(itemid<0 || !(checkbunny(itemid) && checkmagiccost(itemid))) | |
| 6183 | ✗ | return true; | |
| 6184 | ✗ | itemdata const& shield = itemsbuf[itemid]; | |
| 6185 | ✗ | bool allow_inactive = (shield.flags & item_flag9); | |
| 6186 | ✗ | auto cmpdir = compareDir(w->dir); | |
| 6187 | ✗ | bool hitshield = compareShield(cmpdir, shield); | |
| 6188 | |||
| 6189 | ✗ | if(!allow_inactive && ((lift_wpn && (liftflags & LIFTFL_DIS_SHIELD)) || (action==attacking||action==sideswimattacking) || action==swimming || action == sideswimming || action == sideswimattacking || charging > 0 || spins > 0 || hopclk==0xFF)) | |
| 6190 | ✗ | return true; | |
| 6191 | |||
| 6192 | ✗ | if(!hitshield) | |
| 6193 | ✗ | return true; | |
| 6194 | |||
| 6195 | ✗ | paymagiccost(itemid); | |
| 6196 | |||
| 6197 | ✗ | bool reflect = false; | |
| 6198 | |||
| 6199 | ✗ | if(!sh_check(shield.misc1, shield.misc2, w->id, reflect, w->level&1, true)) | |
| 6200 | ✗ | return true; | |
| 6201 | |||
| 6202 | ✗ | if(reflect && (w->unblockable&WPNUNB_REFL)) | |
| 6203 | ✗ | reflect = false; | |
| 6204 | ✗ | if(!reflect && (w->unblockable&WPNUNB_SHLD)) | |
| 6205 | ✗ | return true; | |
| 6206 | |||
| 6207 | ✗ | int32_t oldid = w->id; | |
| 6208 | ✗ | w->onhit(false, reflect ? 2 : 1, dir); | |
| 6209 | |||
| 6210 | ✗ | sfx(shield.usesound,pan(x)); | |
| 6211 | ✗ | return true; | |
| 6212 | ✗ | } | |
| 6213 | |||
| 6214 | 13437160 | int32_t HeroClass::EwpnHit() | |
| 6215 | { | ||
| 6216 |
2/2✓ Branch 0 taken 13431507 times.
✓ Branch 1 taken 8130662 times.
|
21562169 | for(int32_t i=0; i<Ewpns.Count(); i++) |
| 6217 | { | ||
| 6218 |
2/2✓ Branch 0 taken 8118793 times.
✓ Branch 1 taken 11869 times.
|
8130662 | if(Ewpns.spr(i)->hit(x+7,y+7-fakez,z,2,2,1)) |
| 6219 | { | ||
| 6220 | 11869 | weapon *ew = (weapon*)(Ewpns.spr(i)); | |
| 6221 | |||
| 6222 |
3/6✓ Branch 0 taken 11869 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 11869 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 11869 times.
|
11869 | if((ew->ignoreHero)==true || ew->fallclk|| ew->drownclk) |
| 6223 | ✗ | break; | |
| 6224 | |||
| 6225 | 11869 | int32_t stompid = current_item_id(itype_stompboots); | |
| 6226 | |||
| 6227 |
5/10✓ Branch 0 taken 10 times.
✓ Branch 1 taken 11859 times.
✓ Branch 2 taken 10 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 10 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 10 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
11869 | if(current_item(itype_stompboots) && checkbunny(stompid) && checkmagiccost(stompid) && (stomping || |
| 6228 |
1/2✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
|
10 | ((z+fakez) > (ew->z+(ew->fakez))) || |
| 6229 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
10 | ((isSideViewHero() && (y+16)-(ew->y)<=14) && falling_oldy<y))) |
| 6230 | { | ||
| 6231 | ✗ | itemdata const& stomp = itemsbuf[stompid]; | |
| 6232 | ✗ | bool reflect = false; //unused, always false | |
| 6233 | ✗ | if(!sh_check(stomp.misc2, 0, ew->id, reflect, ew->level&1, true)) | |
| 6234 | { | ||
| 6235 | ✗ | ew->onhit(false); | |
| 6236 | ✗ | sfx(WAV_CHINK,pan(x)); | |
| 6237 | ✗ | continue; | |
| 6238 | } | ||
| 6239 | ✗ | } | |
| 6240 | |||
| 6241 | 11869 | int32_t defresult = defend(ew); | |
| 6242 |
1/2✓ Branch 0 taken 11869 times.
✗ Branch 1 not taken.
|
11869 | if ( defresult == -1 ) return -1; //The weapon did something special, but it is otherwise ignored, possibly killed by defend(). |
| 6243 | |||
| 6244 |
2/2✓ Branch 0 taken 11866 times.
✓ Branch 1 taken 3 times.
|
11869 | if(ew->id==ewWind) |
| 6245 | { | ||
| 6246 | 3 | xofs=1000; | |
| 6247 | 3 | action=freeze; FFCore.setHeroAction(freeze); | |
| 6248 | 3 | ew->misc=999; // in enemy wind | |
| 6249 | 3 | attackclk=0; | |
| 6250 | 3 | return -1; | |
| 6251 | } | ||
| 6252 | |||
| 6253 |
2/2✓ Branch 0 taken 93 times.
✓ Branch 1 taken 11773 times.
|
11866 | switch(ew->id) |
| 6254 | { | ||
| 6255 | case ewLitBomb: | ||
| 6256 | case ewBomb: | ||
| 6257 | case ewLitSBomb: | ||
| 6258 | case ewSBomb: | ||
| 6259 | 93 | return i; | |
| 6260 | } | ||
| 6261 | |||
| 6262 | 11773 | int32_t itemid = getCurrentShield(false); | |
| 6263 |
4/6✓ Branch 0 taken 11226 times.
✓ Branch 1 taken 547 times.
✓ Branch 2 taken 11226 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 11226 times.
|
11773 | if(itemid<0 || !(checkbunny(itemid) && checkmagiccost(itemid))) |
| 6264 | 547 | return i; | |
| 6265 | 11226 | itemdata const& shield = itemsbuf[itemid]; | |
| 6266 | 11226 | bool allow_inactive = (shield.flags & item_flag9); | |
| 6267 | 11226 | auto cmpdir = compareDir(ew->dir); | |
| 6268 | 11226 | bool hitshield = compareShield(cmpdir, shield); | |
| 6269 | |||
| 6270 |
12/20✓ Branch 0 taken 11226 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 11226 times.
✓ Branch 4 taken 9081 times.
✓ Branch 5 taken 2145 times.
✓ Branch 6 taken 9081 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 9019 times.
✓ Branch 9 taken 62 times.
✓ Branch 10 taken 9019 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 9019 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 9019 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 9019 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 9019 times.
✗ Branch 19 not taken.
|
11226 | if(!allow_inactive && ((lift_wpn && (liftflags & LIFTFL_DIS_SHIELD)) || (action==attacking||action==sideswimattacking) || action==swimming || action == sideswimming || action == sideswimattacking || charging > 0 || spins > 0 || hopclk==0xFF)) |
| 6271 | 2207 | return i; | |
| 6272 | |||
| 6273 |
2/2✓ Branch 0 taken 6875 times.
✓ Branch 1 taken 2144 times.
|
9019 | if(!hitshield) |
| 6274 | 2144 | return i; | |
| 6275 | |||
| 6276 | 6875 | paymagiccost(itemid); | |
| 6277 | |||
| 6278 | 6875 | bool reflect = false; | |
| 6279 | |||
| 6280 |
2/2✓ Branch 0 taken 6220 times.
✓ Branch 1 taken 655 times.
|
6875 | if(!sh_check(shield.misc1, shield.misc2, ew->id, reflect, ew->level&1, true)) |
| 6281 | 655 | return i; | |
| 6282 | |||
| 6283 |
3/4✓ Branch 0 taken 1609 times.
✓ Branch 1 taken 4611 times.
✓ Branch 2 taken 1609 times.
✗ Branch 3 not taken.
|
6220 | if(reflect && (ew->unblockable&WPNUNB_REFL)) |
| 6284 | ✗ | reflect = false; | |
| 6285 |
4/4✓ Branch 0 taken 4611 times.
✓ Branch 1 taken 1609 times.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 4607 times.
|
6220 | if(!reflect && (ew->unblockable&WPNUNB_SHLD)) |
| 6286 | 4 | return i; | |
| 6287 | |||
| 6288 | 6216 | int32_t oldid = ew->id; | |
| 6289 | 6216 | ew->onhit(false, reflect ? 2 : 1, dir); | |
| 6290 | |||
| 6291 | 6216 | sfx(shield.usesound,pan(x)); | |
| 6292 | 6216 | } | |
| 6293 | 8125009 | } | |
| 6294 | |||
| 6295 | 13431507 | return -1; | |
| 6296 | 13437160 | } | |
| 6297 | |||
| 6298 | 13437170 | int32_t HeroClass::LwpnHit() //only here to check magic hits | |
| 6299 | { | ||
| 6300 |
2/2✓ Branch 0 taken 13261882 times.
✓ Branch 1 taken 5651921 times.
|
18913803 | for(int32_t i=0; i<Lwpns.Count(); i++) |
| 6301 |
2/2✓ Branch 0 taken 5476627 times.
✓ Branch 1 taken 175294 times.
|
5651927 | if(Lwpns.spr(i)->hit(x+7,y+7-fakez,z,2,2,1)) |
| 6302 | { | ||
| 6303 | 175294 | weapon *lw = (weapon*)(Lwpns.spr(i)); | |
| 6304 | |||
| 6305 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 175278 times.
|
175294 | if((lw->ignoreHero)==true) |
| 6306 | 175278 | break; | |
| 6307 | |||
| 6308 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | switch(lw->id) |
| 6309 | { | ||
| 6310 | case wRefFireball: case wRefMagic: case wRefBeam: | ||
| 6311 | case wRefRock: case wRefArrow: case wRefFire: | ||
| 6312 | case wRefFire2: | ||
| 6313 | case wScript1: case wScript2: case wScript3: case wScript4: case wScript5: | ||
| 6314 | case wScript6: case wScript7: case wScript8: case wScript9: case wScript10: | ||
| 6315 | 16 | break; | |
| 6316 | default: | ||
| 6317 | ✗ | return -1; | |
| 6318 | } | ||
| 6319 | 16 | int32_t itemid = getCurrentShield(false); | |
| 6320 |
4/6✓ Branch 0 taken 12 times.
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 12 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 12 times.
|
16 | if(itemid<0 || !(checkbunny(itemid) && checkmagiccost(itemid))) |
| 6321 | 4 | return i; | |
| 6322 | 12 | itemdata const& shield = itemsbuf[itemid]; | |
| 6323 | 12 | auto cmpdir = compareDir(lw->dir); | |
| 6324 | 12 | bool hitshield = compareShield(cmpdir, shield); | |
| 6325 | 12 | bool reflect = false; | |
| 6326 | |||
| 6327 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 6 times.
|
12 | if(!hitshield) |
| 6328 | 6 | return i; | |
| 6329 | |||
| 6330 | 6 | bool allow_inactive = (shield.flags & item_flag9); | |
| 6331 |
10/20✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 6 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 6 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 6 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 6 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 6 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 6 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 6 times.
✗ Branch 19 not taken.
|
6 | if(!allow_inactive && ((lift_wpn && (liftflags & LIFTFL_DIS_SHIELD)) || (action==attacking||action==sideswimattacking) || action==swimming || action == sideswimming || action == sideswimattacking || charging > 0 || spins > 0 || hopclk==0xFF)) |
| 6332 | ✗ | return i; | |
| 6333 | |||
| 6334 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | if(!sh_check(shield.misc1, shield.misc2, lw->id, reflect, lw->level&1, true)) |
| 6335 | ✗ | return i; | |
| 6336 | |||
| 6337 | 6 | paymagiccost(itemid); | |
| 6338 | |||
| 6339 | 6 | lw->onhit(false, reflect ? 2 : 1, dir); | |
| 6340 | 6 | sfx(shield.usesound,pan(x)); | |
| 6341 | 6 | } | |
| 6342 | |||
| 6343 | 13437160 | return -1; | |
| 6344 | 13437170 | } | |
| 6345 | |||
| 6346 | 105 | bool HeroClass::try_lwpn_hit(weapon* w) | |
| 6347 | { | ||
| 6348 | 105 | int32_t itemid = w->parentitem; | |
| 6349 | 105 | int indx = Lwpns.find(w); | |
| 6350 | //if ( itemdbuf[parentitem].flags&item_flags3 ) //can damage Hero | ||
| 6351 | //if ( itemsbuf[parentitem].misc1 > 0 ) //damages Hero by this amount. | ||
| 6352 |
7/12✗ Branch 0 not taken.
✓ Branch 1 taken 105 times.
✓ Branch 2 taken 35 times.
✓ Branch 3 taken 70 times.
✓ Branch 4 taken 35 times.
✓ Branch 5 taken 35 times.
✓ Branch 6 taken 35 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 35 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
105 | if((!(itemid==-1&&get_qr(qr_FIREPROOFHERO)||((itemid>-1&&itemsbuf[itemid].type==itype_candle||itemsbuf[itemid].type==itype_book)&&(itemsbuf[itemid].flags & item_flag3)))) && scriptcoldet && !fallclk && (!superman || !get_qr(qr_FIREPROOFHERO2))) |
| 6353 | { | ||
| 6354 |
2/14✓ Branch 0 taken 35 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 35 times.
|
35 | if(w->id==wFire && (superman ? ((diagonalMovement||NO_GRIDLOCK)?w->hit(x+4,y+4-fakez,z,7,7,1):w->hit(x+7,y+7-fakez,z,2,2,1)) : w->hit(this))&& |
| 6355 | ✗ | (itemid < 0 || itemsbuf[itemid].type!=itype_divinefire)) | |
| 6356 | { | ||
| 6357 | ✗ | std::vector<int32_t> &ev = FFCore.eventData; | |
| 6358 | ✗ | ev.clear(); | |
| 6359 | ✗ | ev.push_back(lwpn_dp(indx)*10000); | |
| 6360 | ✗ | ev.push_back(w->hitdir(x,y,16,16,dir)*10000); | |
| 6361 | ✗ | ev.push_back(0); | |
| 6362 | ✗ | ev.push_back(DivineProtectionShieldClk>0?10000:0); | |
| 6363 | ✗ | ev.push_back(48*10000); | |
| 6364 | ✗ | ev.push_back(ZSD_LWPN*10000); | |
| 6365 | ✗ | ev.push_back(w->getUID()); | |
| 6366 | ✗ | ev.push_back(ZSD_NONE*10000); | |
| 6367 | ✗ | ev.push_back(0); | |
| 6368 | |||
| 6369 | ✗ | throwGenScriptEvent(GENSCR_EVENT_HERO_HIT_1); | |
| 6370 | ✗ | int32_t dmg = ev[0]/10000; | |
| 6371 | ✗ | bool nullhit = ev[2] != 0; | |
| 6372 | |||
| 6373 | ✗ | if(nullhit) {ev.clear(); return true;} | |
| 6374 | |||
| 6375 | //Args: 'damage (post-ring)','hitdir','nullifyhit','type:npc','npc uid' | ||
| 6376 | ✗ | ev[0] = ringpower(dmg)*10000; | |
| 6377 | |||
| 6378 | ✗ | throwGenScriptEvent(GENSCR_EVENT_HERO_HIT_2); | |
| 6379 | ✗ | dmg = ev[0]/10000; | |
| 6380 | ✗ | int32_t hdir = ev[1]/10000; | |
| 6381 | ✗ | nullhit = ev[2] != 0; | |
| 6382 | ✗ | bool divineprot = ev[3] != 0; | |
| 6383 | ✗ | int32_t iframes = ev[4] / 10000; | |
| 6384 | ✗ | ev.clear(); | |
| 6385 | ✗ | if(nullhit) return true; | |
| 6386 | ✗ | if (Lwpns.spr(indx) != w) | |
| 6387 | { | ||
| 6388 | ✗ | auto hit = Lwpns.find(w); | |
| 6389 | ✗ | if (hit < 0) | |
| 6390 | ✗ | w = nullptr; | |
| 6391 | else | ||
| 6392 | { | ||
| 6393 | ✗ | w = (weapon*)Lwpns.spr(hit); | |
| 6394 | ✗ | indx = hit; | |
| 6395 | } | ||
| 6396 | ✗ | } | |
| 6397 | ✗ | if(!divineprot) | |
| 6398 | { | ||
| 6399 | ✗ | game->set_life(zc_max(game->get_life()-dmg,0)); | |
| 6400 | ✗ | if (!get_qr(qr_BROKENHITBY) && w) | |
| 6401 | { | ||
| 6402 | ✗ | sethitHeroUID(HIT_BY_LWEAPON,(indx+1)); | |
| 6403 | ✗ | sethitHeroUID(HIT_BY_LWEAPON_UID,w->getUID()); | |
| 6404 | ✗ | sethitHeroUID(HIT_BY_LWEAPON_ENGINE_UID,w->getUID()); | |
| 6405 | ✗ | sethitHeroUID(HIT_BY_LWEAPON_TYPE, w->id); | |
| 6406 | ✗ | if (w->parentitem > -1) sethitHeroUID(HIT_BY_LWEAPON_PARENT_ID, w->parentitem); | |
| 6407 | ✗ | else sethitHeroUID(HIT_BY_LWEAPON_PARENT_ID, -1); | |
| 6408 | ✗ | sethitHeroUID(HIT_BY_LWEAPON_PARENT_FAMILY, itemsbuf[w->parentitem].type); | |
| 6409 | ✗ | } | |
| 6410 | ✗ | } | |
| 6411 | |||
| 6412 | ✗ | doHit(hdir, iframes); | |
| 6413 | ✗ | return true; | |
| 6414 | } | ||
| 6415 | 35 | } | |
| 6416 | |||
| 6417 | // check enemy weapons true, 1, -1 | ||
| 6418 | // | ||
| 6419 |
1/2✓ Branch 0 taken 35 times.
✗ Branch 1 not taken.
|
35 | if((itemsbuf[itemid].flags & item_flag6)) |
| 6420 | { | ||
| 6421 | ✗ | if(w->id==wBrang || (w->id==wHookshot&&!pull_hero)) | |
| 6422 | { | ||
| 6423 | ✗ | int32_t itemid = w->parentitem>-1 ? w->parentitem : | |
| 6424 | ✗ | directWpn>-1 ? directWpn : current_item_id(w->id==wHookshot ? (w->family_class == itype_switchhook ? itype_switchhook : itype_hookshot) : itype_brang); | |
| 6425 | ✗ | itemid = vbound(itemid, 0, MAXITEMS-1); | |
| 6426 | |||
| 6427 | ✗ | for(int32_t j=0; j<Ewpns.Count(); j++) | |
| 6428 | { | ||
| 6429 | ✗ | sprite *t = Ewpns.spr(j); | |
| 6430 | |||
| 6431 | ✗ | if(w->hit(t->x+7,t->y+7-t->fakez,t->z,2,2,1)) | |
| 6432 | { | ||
| 6433 | ✗ | bool reflect = false; | |
| 6434 | // sethitHeroUID(HIT_BY_EWEAPON,j); //set that Hero was hit by a specific eweapon index. | ||
| 6435 | ✗ | if(sh_check(itemsbuf[itemid].misc3, itemsbuf[itemid].misc4, t->id, reflect, ((weapon*)t)->level&1, false)) | |
| 6436 | { | ||
| 6437 | ✗ | w->dead=1; | |
| 6438 | ✗ | weapon *ew = ((weapon*)t); | |
| 6439 | ✗ | int32_t oldid = ew->id; | |
| 6440 | ✗ | ew->onhit(true, reflect ? 2 : 1, w->dir); | |
| 6441 | ✗ | } | |
| 6442 | |||
| 6443 | ✗ | break; | |
| 6444 | } | ||
| 6445 | ✗ | } | |
| 6446 | ✗ | } | |
| 6447 | ✗ | } | |
| 6448 | |||
| 6449 |
2/6✓ Branch 0 taken 35 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 35 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
35 | if((itemsbuf[itemid].flags & item_flag2)||(itemid==-1&&get_qr(qr_OUCHBOMBS))) |
| 6450 | { | ||
| 6451 | ✗ | if(((w->id==wBomb)||(w->id==wSBomb)) && !superman && scriptcoldet && !fallclk) | |
| 6452 | { | ||
| 6453 | ✗ | bool didhit = w->hit(this); | |
| 6454 | ✗ | if(didhit) | |
| 6455 | { | ||
| 6456 | ✗ | std::vector<int32_t> &ev = FFCore.eventData; | |
| 6457 | ✗ | ev.clear(); | |
| 6458 | ✗ | ev.push_back(((w->parentitem>-1 ? itemsbuf[w->parentitem].misc3 : w->power) *game->get_hp_per_heart())*10000); | |
| 6459 | ✗ | ev.push_back(w->hitdir(x,y,16,16,dir)*10000); | |
| 6460 | ✗ | ev.push_back(0); | |
| 6461 | ✗ | ev.push_back(DivineProtectionShieldClk>0?10000:0); | |
| 6462 | ✗ | ev.push_back(48*10000); | |
| 6463 | ✗ | ev.push_back(ZSD_LWPN*10000); | |
| 6464 | ✗ | ev.push_back(w->getUID()); | |
| 6465 | ✗ | ev.push_back(ZSD_NONE*10000); | |
| 6466 | ✗ | ev.push_back(0); | |
| 6467 | |||
| 6468 | ✗ | throwGenScriptEvent(GENSCR_EVENT_HERO_HIT_1); | |
| 6469 | ✗ | int32_t dmg = ev[0]/10000; | |
| 6470 | ✗ | bool nullhit = ev[2] != 0; | |
| 6471 | |||
| 6472 | ✗ | if(nullhit) {ev.clear(); return true;} | |
| 6473 | |||
| 6474 | //Args: 'damage (post-ring)','hitdir','nullifyhit','type:npc','npc uid' | ||
| 6475 | ✗ | ev[0] = ringpower(dmg)*10000; | |
| 6476 | |||
| 6477 | ✗ | throwGenScriptEvent(GENSCR_EVENT_HERO_HIT_2); | |
| 6478 | ✗ | dmg = ev[0]/10000; | |
| 6479 | ✗ | int32_t hdir = ev[1]/10000; | |
| 6480 | ✗ | nullhit = ev[2] != 0; | |
| 6481 | ✗ | bool divineprot = ev[3] != 0; | |
| 6482 | ✗ | int32_t iframes = ev[4] / 10000; | |
| 6483 | ✗ | ev.clear(); | |
| 6484 | ✗ | if(nullhit) return true; | |
| 6485 | ✗ | if (Lwpns.spr(indx) != w) | |
| 6486 | { | ||
| 6487 | ✗ | auto hit = Lwpns.find(w); | |
| 6488 | ✗ | if (hit < 0) | |
| 6489 | ✗ | w = nullptr; | |
| 6490 | else | ||
| 6491 | { | ||
| 6492 | ✗ | w = (weapon*)Lwpns.spr(hit); | |
| 6493 | ✗ | indx = hit; | |
| 6494 | } | ||
| 6495 | ✗ | } | |
| 6496 | ✗ | if(!divineprot) | |
| 6497 | { | ||
| 6498 | ✗ | game->set_life(zc_min(game->get_maxlife(), zc_max(game->get_life()-dmg,0))); | |
| 6499 | ✗ | if (!get_qr(qr_BROKENHITBY) && w) | |
| 6500 | { | ||
| 6501 | ✗ | sethitHeroUID(HIT_BY_LWEAPON,(indx+1)); | |
| 6502 | ✗ | sethitHeroUID(HIT_BY_LWEAPON_UID,w->getUID()); | |
| 6503 | ✗ | sethitHeroUID(HIT_BY_LWEAPON_ENGINE_UID,w->getUID()); | |
| 6504 | ✗ | sethitHeroUID(HIT_BY_LWEAPON_TYPE, w->id); | |
| 6505 | ✗ | if (w->parentitem > -1) sethitHeroUID(HIT_BY_LWEAPON_PARENT_ID, w->parentitem); | |
| 6506 | ✗ | else sethitHeroUID(HIT_BY_LWEAPON_PARENT_ID, -1); | |
| 6507 | ✗ | sethitHeroUID(HIT_BY_LWEAPON_PARENT_FAMILY, itemsbuf[w->parentitem].type); | |
| 6508 | ✗ | } | |
| 6509 | ✗ | } | |
| 6510 | |||
| 6511 | ✗ | doHit(hdir, iframes); | |
| 6512 | ✗ | return true; | |
| 6513 | } | ||
| 6514 | ✗ | } | |
| 6515 | ✗ | } | |
| 6516 | |||
| 6517 |
4/8✓ Branch 0 taken 34 times.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 34 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 35 times.
|
35 | if(hclk==0 && w->id==wWind && w->hit(x+7,y+7-fakez,z,2,2,1) && !fairyclk) |
| 6518 | { | ||
| 6519 | ✗ | std::vector<int32_t> &ev = FFCore.eventData; | |
| 6520 | ✗ | ev.clear(); | |
| 6521 | ✗ | ev.push_back(0); | |
| 6522 | ✗ | ev.push_back(w->dir*10000); | |
| 6523 | ✗ | ev.push_back(0); | |
| 6524 | ✗ | ev.push_back(0); | |
| 6525 | ✗ | ev.push_back(ZSD_LWPN*10000); | |
| 6526 | ✗ | ev.push_back(w->getUID()); | |
| 6527 | ✗ | ev.push_back(ZSD_NONE*10000); | |
| 6528 | ✗ | ev.push_back(0); | |
| 6529 | |||
| 6530 | ✗ | throwGenScriptEvent(GENSCR_EVENT_HERO_HIT_1); | |
| 6531 | ✗ | bool nullhit = ev[2] != 0; | |
| 6532 | ✗ | if(nullhit) {ev.clear(); return true;} | |
| 6533 | |||
| 6534 | ✗ | throwGenScriptEvent(GENSCR_EVENT_HERO_HIT_2); | |
| 6535 | ✗ | int32_t hdir = ev[1]/10000; | |
| 6536 | ✗ | nullhit = ev[2] != 0; | |
| 6537 | ✗ | ev.clear(); | |
| 6538 | ✗ | if(nullhit) return true; | |
| 6539 | ✗ | if (Lwpns.spr(indx) != w) | |
| 6540 | { | ||
| 6541 | ✗ | auto hit = Lwpns.find(w); | |
| 6542 | ✗ | if (hit < 0) | |
| 6543 | ✗ | w = nullptr; | |
| 6544 | else | ||
| 6545 | { | ||
| 6546 | ✗ | w = (weapon*)Lwpns.spr(hit); | |
| 6547 | ✗ | indx = hit; | |
| 6548 | } | ||
| 6549 | ✗ | } | |
| 6550 | |||
| 6551 | ✗ | reset_hookshot(); | |
| 6552 | ✗ | xofs=1000; | |
| 6553 | ✗ | action=inwind; FFCore.setHeroAction(inwind); | |
| 6554 | ✗ | dir = hdir; | |
| 6555 | ✗ | if(w) w->dir = hdir; | |
| 6556 | ✗ | spins = charging = attackclk = 0; | |
| 6557 | |||
| 6558 | // In case Hero used two whistles in a row, summoning two whirlwinds, | ||
| 6559 | // check which whistle's whirlwind picked him up so the correct | ||
| 6560 | // warp ring will be used | ||
| 6561 | ✗ | int32_t whistle = w ? w->parentitem : -1; | |
| 6562 | |||
| 6563 | ✗ | if(whistle>-1 && itemsbuf[whistle].type==itype_whistle) | |
| 6564 | ✗ | whistleitem=whistle; | |
| 6565 | |||
| 6566 | ✗ | return true; | |
| 6567 | } | ||
| 6568 | 35 | return false; | |
| 6569 | 35 | } | |
| 6570 | |||
| 6571 | ✗ | bool HeroClass::try_ewpn_hit(weapon* w, bool force) | |
| 6572 | { | ||
| 6573 | ✗ | if(!force) | |
| 6574 | { | ||
| 6575 | ✗ | if(!check_ewpn_collide(w)) | |
| 6576 | ✗ | return false; | |
| 6577 | ✗ | if(w->ignoreHero || w->fallclk|| w->drownclk) | |
| 6578 | ✗ | return false; | |
| 6579 | ✗ | } | |
| 6580 | ✗ | auto indx = Ewpns.find(w); | |
| 6581 | ✗ | std::vector<int32_t> &ev = FFCore.eventData; | |
| 6582 | ✗ | ev.clear(); | |
| 6583 | ✗ | ev.push_back((ewpn_dp(indx)*10000)); | |
| 6584 | ✗ | ev.push_back(w->hitdir(x,y,16,16,dir)*10000); | |
| 6585 | ✗ | ev.push_back(0); | |
| 6586 | ✗ | ev.push_back(DivineProtectionShieldClk>0?10000:0); | |
| 6587 | ✗ | ev.push_back(48*10000); | |
| 6588 | ✗ | ev.push_back(ZSD_EWPN*10000); | |
| 6589 | ✗ | ev.push_back(w->getUID()); | |
| 6590 | ✗ | ev.push_back(ZSD_NONE*10000); | |
| 6591 | ✗ | ev.push_back(0); | |
| 6592 | |||
| 6593 | ✗ | throwGenScriptEvent(GENSCR_EVENT_HERO_HIT_1); | |
| 6594 | ✗ | int32_t dmg = ev[0]/10000; | |
| 6595 | ✗ | bool nullhit = ev[2] != 0; | |
| 6596 | |||
| 6597 | ✗ | if(nullhit) {ev.clear(); return false;} | |
| 6598 | |||
| 6599 | //Args: 'damage (post-ring)','hitdir','nullifyhit','type:npc','npc uid' | ||
| 6600 | ✗ | ev[0] = ringpower(dmg)*10000; | |
| 6601 | |||
| 6602 | ✗ | throwGenScriptEvent(GENSCR_EVENT_HERO_HIT_2); | |
| 6603 | ✗ | dmg = ev[0]/10000; | |
| 6604 | ✗ | int32_t hdir = ev[1]/10000; | |
| 6605 | ✗ | nullhit = ev[2] != 0; | |
| 6606 | ✗ | bool divineprot = ev[3] != 0; | |
| 6607 | ✗ | int32_t iframes = ev[4] / 10000; | |
| 6608 | ✗ | ev.clear(); | |
| 6609 | ✗ | if (nullhit) return false; | |
| 6610 | ✗ | if (Ewpns.spr(indx) != w) | |
| 6611 | { | ||
| 6612 | ✗ | indx = Ewpns.find(w); | |
| 6613 | ✗ | if (indx < 0) | |
| 6614 | ✗ | w = nullptr; | |
| 6615 | ✗ | else w = (weapon*)Ewpns.spr(indx); | |
| 6616 | ✗ | } | |
| 6617 | ✗ | if (!divineprot) | |
| 6618 | { | ||
| 6619 | ✗ | game->set_life(zc_max(game->get_life() - dmg, 0)); | |
| 6620 | ✗ | if (w) | |
| 6621 | { | ||
| 6622 | ✗ | sethitHeroUID(HIT_BY_EWEAPON, (indx + 1)); | |
| 6623 | ✗ | sethitHeroUID(HIT_BY_EWEAPON_UID, w->getUID()); | |
| 6624 | ✗ | sethitHeroUID(HIT_BY_EWEAPON_ENGINE_UID, w->getUID()); | |
| 6625 | ✗ | sethitHeroUID(HIT_BY_EWEAPON_TYPE, w->id); | |
| 6626 | ✗ | } | |
| 6627 | ✗ | } | |
| 6628 | |||
| 6629 | ✗ | if(w) | |
| 6630 | ✗ | w->hit_pierce(); | |
| 6631 | |||
| 6632 | ✗ | doHit(hdir, iframes); | |
| 6633 | ✗ | return true; | |
| 6634 | ✗ | } | |
| 6635 | |||
| 6636 | 21618792 | void HeroClass::checkhit() | |
| 6637 | { | ||
| 6638 |
2/2✓ Branch 0 taken 20881399 times.
✓ Branch 1 taken 737393 times.
|
21618792 | if(hclk>0) |
| 6639 | { | ||
| 6640 | 737393 | --hclk; | |
| 6641 | 737393 | } | |
| 6642 | |||
| 6643 |
1/2✓ Branch 0 taken 21618792 times.
✗ Branch 1 not taken.
|
21618792 | if(DivineProtectionShieldClk>0) |
| 6644 | { | ||
| 6645 | ✗ | --DivineProtectionShieldClk; | |
| 6646 | |||
| 6647 | ✗ | if(DivineProtectionShieldClk == 0 && div_prot_item != -1) | |
| 6648 | { | ||
| 6649 | ✗ | stop_sfx(itemsbuf[div_prot_item].usesound); | |
| 6650 | ✗ | stop_sfx(itemsbuf[div_prot_item].usesound+1); | |
| 6651 | ✗ | div_prot_item = -1; | |
| 6652 | ✗ | } | |
| 6653 | ✗ | else if(get_qr(qr_MORESOUNDS) && !(DivineProtectionShieldClk&0xF00) && div_prot_item != -1) | |
| 6654 | { | ||
| 6655 | ✗ | stop_sfx(itemsbuf[div_prot_item].usesound); | |
| 6656 | ✗ | cont_sfx(itemsbuf[div_prot_item].usesound+1); | |
| 6657 | ✗ | } | |
| 6658 | ✗ | } | |
| 6659 | |||
| 6660 |
4/4✓ Branch 0 taken 14696058 times.
✓ Branch 1 taken 6922734 times.
✓ Branch 2 taken 14687956 times.
✓ Branch 3 taken 8102 times.
|
21618792 | if(hclk<39 && action==gothit) |
| 6661 | { | ||
| 6662 | 8102 | action=none; FFCore.setHeroAction(none); | |
| 6663 | 8102 | } | |
| 6664 | |||
| 6665 |
5/6✓ Branch 0 taken 14696058 times.
✓ Branch 1 taken 6922734 times.
✓ Branch 2 taken 14695933 times.
✓ Branch 3 taken 125 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 14695933 times.
|
21618792 | if(hclk<39 && (action==swimhit || action == sideswimhit)) |
| 6666 | { | ||
| 6667 | 125 | SetSwim(); | |
| 6668 | 125 | } | |
| 6669 | |||
| 6670 |
4/4✓ Branch 0 taken 125459 times.
✓ Branch 1 taken 21493333 times.
✓ Branch 2 taken 36090 times.
✓ Branch 3 taken 89369 times.
|
21618792 | if(hclk>=40 && action==gothit) |
| 6671 | { | ||
| 6672 | 89369 | int val = check_pitslide(); | |
| 6673 |
4/4✓ Branch 0 taken 466 times.
✓ Branch 1 taken 88903 times.
✓ Branch 2 taken 89545 times.
✓ Branch 3 taken 89079 times.
|
89369 | if(((ladderx+laddery) && ((hitdir&2)==ladderdir))||(!(ladderx+laddery))) |
| 6674 | { | ||
| 6675 |
2/2✓ Branch 0 taken 358180 times.
✓ Branch 1 taken 89545 times.
|
447725 | for(int32_t i=0; i<4; i++) |
| 6676 | { | ||
| 6677 |
5/5✓ Branch 0 taken 4448 times.
✓ Branch 1 taken 77020 times.
✓ Branch 2 taken 86960 times.
✓ Branch 3 taken 92876 times.
✓ Branch 4 taken 96876 times.
|
358180 | switch(hitdir) |
| 6678 | { | ||
| 6679 | case up: | ||
| 6680 |
6/6✓ Branch 0 taken 5546 times.
✓ Branch 1 taken 71474 times.
✓ Branch 2 taken 13956 times.
✓ Branch 3 taken 57518 times.
✓ Branch 4 taken 5709 times.
✓ Branch 5 taken 71311 times.
|
77020 | if(hit_walkflag(x,y+(bigHitbox?-1:7),2)||(x.getInt()&7?hit_walkflag(x+16,y+(bigHitbox?-1:7),1):0)) |
| 6681 | { | ||
| 6682 | 5709 | action=none; FFCore.setHeroAction(none); | |
| 6683 | 5709 | } | |
| 6684 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 71287 times.
|
71311 | else if (val == -1) --y; |
| 6685 | |||
| 6686 | 77020 | break; | |
| 6687 | |||
| 6688 | case down: | ||
| 6689 |
6/6✓ Branch 0 taken 7218 times.
✓ Branch 1 taken 79742 times.
✓ Branch 2 taken 63958 times.
✓ Branch 3 taken 15784 times.
✓ Branch 4 taken 7393 times.
✓ Branch 5 taken 79567 times.
|
86960 | if(hit_walkflag(x,y+16,2)||(x.getInt()&7?hit_walkflag(x+16,y+16,1):0)) |
| 6690 | { | ||
| 6691 | 7393 | action=none; FFCore.setHeroAction(none); | |
| 6692 | 7393 | } | |
| 6693 |
2/2✓ Branch 0 taken 79551 times.
✓ Branch 1 taken 16 times.
|
79567 | else if (val == -1) ++y; |
| 6694 | |||
| 6695 | 86960 | break; | |
| 6696 | |||
| 6697 | case left: | ||
| 6698 |
7/8✓ Branch 0 taken 89424 times.
✓ Branch 1 taken 3452 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 89424 times.
✓ Branch 4 taken 12636 times.
✓ Branch 5 taken 76788 times.
✓ Branch 6 taken 3620 times.
✓ Branch 7 taken 89256 times.
|
92876 | if(hit_walkflag(x-1,y+(bigHitbox?0:8),1)||hit_walkflag(x-1,y+8,1)||(y.getInt()&7?hit_walkflag(x-1,y+16,1):0)) |
| 6699 | { | ||
| 6700 | 3620 | action=none; FFCore.setHeroAction(none); | |
| 6701 | 3620 | } | |
| 6702 |
2/2✓ Branch 0 taken 36 times.
✓ Branch 1 taken 89220 times.
|
89256 | else if (val == -1) --x; |
| 6703 | |||
| 6704 | 92876 | break; | |
| 6705 | |||
| 6706 | case right: | ||
| 6707 |
8/8✓ Branch 0 taken 92718 times.
✓ Branch 1 taken 4158 times.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 92714 times.
✓ Branch 4 taken 11635 times.
✓ Branch 5 taken 81079 times.
✓ Branch 6 taken 4270 times.
✓ Branch 7 taken 92606 times.
|
96876 | if(hit_walkflag(x+16,y+(bigHitbox?0:8),1)||hit_walkflag(x+16,y+8,1)||(y.getInt()&7?hit_walkflag(x+16,y+16,1):0)) |
| 6708 | { | ||
| 6709 | 4270 | action=none; FFCore.setHeroAction(none); | |
| 6710 | 4270 | } | |
| 6711 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 92606 times.
|
92606 | else if (val == -1) ++x; |
| 6712 | |||
| 6713 | 96876 | break; | |
| 6714 | } | ||
| 6715 | 358180 | } | |
| 6716 | 89545 | } | |
| 6717 | 89721 | } | |
| 6718 | |||
| 6719 |
20/22✓ Branch 0 taken 14114666 times.
✓ Branch 1 taken 7504478 times.
✓ Branch 2 taken 14113326 times.
✓ Branch 3 taken 1340 times.
✓ Branch 4 taken 14113326 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 14094972 times.
✓ Branch 7 taken 18354 times.
✓ Branch 8 taken 14089305 times.
✓ Branch 9 taken 5667 times.
✓ Branch 10 taken 14088966 times.
✓ Branch 11 taken 339 times.
✓ Branch 12 taken 14088966 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 14088060 times.
✓ Branch 15 taken 906 times.
✓ Branch 16 taken 14077929 times.
✓ Branch 17 taken 10131 times.
✓ Branch 18 taken 11373 times.
✓ Branch 19 taken 14066556 times.
✓ Branch 20 taken 8238123 times.
✓ Branch 21 taken 8249496 times.
|
21619144 | if(hclk>0 || inlikelike == 1 || is_autowalking() || action==inwind || action==drowning || action==lavadrowning || action==sidedrowning || inwallm || isDiving() || (action==hopping && hopclk<255)) |
| 6720 | { | ||
| 6721 | 15779338 | return; | |
| 6722 | } | ||
| 6723 | |||
| 6724 |
2/2✓ Branch 0 taken 14323320 times.
✓ Branch 1 taken 14066486 times.
|
28389806 | for(int32_t i=0; i<Lwpns.Count(); i++) |
| 6725 | { | ||
| 6726 | 14323320 | sprite *s = Lwpns.spr(i); | |
| 6727 | 14323320 | int32_t itemid = ((weapon*)(Lwpns.spr(i)))->parentitem; | |
| 6728 | //if ( itemdbuf[parentitem].flags&item_flags3 ) //can damage Hero | ||
| 6729 | //if ( itemsbuf[parentitem].misc1 > 0 ) //damages Hero by this amount. | ||
| 6730 |
12/12✓ Branch 0 taken 1990725 times.
✓ Branch 1 taken 12332595 times.
✓ Branch 2 taken 4083255 times.
✓ Branch 3 taken 8249340 times.
✓ Branch 4 taken 2980173 times.
✓ Branch 5 taken 5269167 times.
✓ Branch 6 taken 5265068 times.
✓ Branch 7 taken 4099 times.
✓ Branch 8 taken 91255 times.
✓ Branch 9 taken 5173813 times.
✓ Branch 10 taken 39032 times.
✓ Branch 11 taken 52223 times.
|
14323320 | if((!(itemid==-1&&get_qr(qr_FIREPROOFHERO)||((itemid>-1&&itemsbuf[itemid].type==itype_candle||itemsbuf[itemid].type==itype_book)&&(itemsbuf[itemid].flags & item_flag3)))) && scriptcoldet && !fallclk && (!superman || !get_qr(qr_FIREPROOFHERO2))) |
| 6731 | { | ||
| 6732 |
11/14✓ Branch 0 taken 5056500 times.
✓ Branch 1 taken 169536 times.
✓ Branch 2 taken 443 times.
✓ Branch 3 taken 169093 times.
✓ Branch 4 taken 443 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 443 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 443 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 3549 times.
✓ Branch 11 taken 165544 times.
✓ Branch 12 taken 5225307 times.
✓ Branch 13 taken 61 times.
|
5229360 | if(s->id==wFire && (superman ? ((diagonalMovement||NO_GRIDLOCK)?s->hit(x+4,y+4-fakez,z,7,7,1):s->hit(x+7,y+7-fakez,z,2,2,1)) : s->hit(this))&& |
| 6733 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3324 times.
|
3992 | (itemid < 0 || itemsbuf[itemid].type!=itype_divinefire)) |
| 6734 | { | ||
| 6735 | 61 | std::vector<int32_t> &ev = FFCore.eventData; | |
| 6736 | 61 | ev.clear(); | |
| 6737 | 61 | ev.push_back(lwpn_dp(i)*10000); | |
| 6738 | 61 | ev.push_back(s->hitdir(x,y,16,16,dir)*10000); | |
| 6739 | 61 | ev.push_back(0); | |
| 6740 | 61 | ev.push_back(DivineProtectionShieldClk>0?10000:0); | |
| 6741 | 61 | ev.push_back(48*10000); | |
| 6742 | 61 | ev.push_back(ZSD_LWPN*10000); | |
| 6743 | 61 | ev.push_back(s->getUID()); | |
| 6744 | 61 | ev.push_back(ZSD_NONE*10000); | |
| 6745 | 61 | ev.push_back(0); | |
| 6746 | |||
| 6747 | 61 | throwGenScriptEvent(GENSCR_EVENT_HERO_HIT_1); | |
| 6748 | 61 | int32_t dmg = ev[0]/10000; | |
| 6749 | 61 | bool nullhit = ev[2] != 0; | |
| 6750 | |||
| 6751 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 61 times.
|
61 | if(nullhit) {ev.clear(); return;} |
| 6752 | |||
| 6753 | //Args: 'damage (post-ring)','hitdir','nullifyhit','type:npc','npc uid' | ||
| 6754 | 61 | ev[0] = ringpower(dmg)*10000; | |
| 6755 | |||
| 6756 | 61 | throwGenScriptEvent(GENSCR_EVENT_HERO_HIT_2); | |
| 6757 | 61 | dmg = ev[0]/10000; | |
| 6758 | 61 | int32_t hdir = ev[1]/10000; | |
| 6759 | 61 | nullhit = ev[2] != 0; | |
| 6760 | 61 | bool divineprot = ev[3] != 0; | |
| 6761 | 61 | int32_t iframes = ev[4] / 10000; | |
| 6762 | 61 | ev.clear(); | |
| 6763 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 61 times.
|
61 | if(nullhit) return; |
| 6764 |
1/2✓ Branch 0 taken 61 times.
✗ Branch 1 not taken.
|
61 | if (Lwpns.spr(i) != s) |
| 6765 | { | ||
| 6766 | ✗ | auto hit = Lwpns.find(s); | |
| 6767 | ✗ | if (hit < 0) | |
| 6768 | ✗ | s = nullptr; | |
| 6769 | else | ||
| 6770 | { | ||
| 6771 | ✗ | s = Lwpns.spr(hit); | |
| 6772 | ✗ | i = hit; | |
| 6773 | } | ||
| 6774 | ✗ | } | |
| 6775 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 61 times.
|
61 | if(!divineprot) |
| 6776 | { | ||
| 6777 |
1/2✓ Branch 0 taken 61 times.
✗ Branch 1 not taken.
|
61 | game->set_life(zc_max(game->get_life()-dmg,0)); |
| 6778 | 61 | weapon* w = (weapon*)s; | |
| 6779 |
3/4✓ Branch 0 taken 28 times.
✓ Branch 1 taken 33 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 28 times.
|
61 | if (!get_qr(qr_BROKENHITBY) && w) |
| 6780 | { | ||
| 6781 | 28 | sethitHeroUID(HIT_BY_LWEAPON,(i+1)); | |
| 6782 | 28 | sethitHeroUID(HIT_BY_LWEAPON_UID,w->getUID()); | |
| 6783 | 28 | sethitHeroUID(HIT_BY_LWEAPON_ENGINE_UID,w->getUID()); | |
| 6784 | 28 | sethitHeroUID(HIT_BY_LWEAPON_TYPE, w->id); | |
| 6785 |
1/2✓ Branch 0 taken 28 times.
✗ Branch 1 not taken.
|
28 | if (w->parentitem > -1) sethitHeroUID(HIT_BY_LWEAPON_PARENT_ID, w->parentitem); |
| 6786 | ✗ | else sethitHeroUID(HIT_BY_LWEAPON_PARENT_ID, -1); | |
| 6787 | 28 | sethitHeroUID(HIT_BY_LWEAPON_PARENT_FAMILY, itemsbuf[w->parentitem].type); | |
| 6788 | 28 | } | |
| 6789 | 61 | } | |
| 6790 | |||
| 6791 | 61 | doHit(hdir, iframes); | |
| 6792 | 61 | return; | |
| 6793 | } | ||
| 6794 | 5225307 | } | |
| 6795 | |||
| 6796 | // check enemy weapons true, 1, -1 | ||
| 6797 | // | ||
| 6798 |
2/2✓ Branch 0 taken 502319 times.
✓ Branch 1 taken 5571600 times.
|
8454981 | if((itemsbuf[itemid].flags & item_flag6)) |
| 6799 | { | ||
| 6800 |
6/6✓ Branch 0 taken 381100 times.
✓ Branch 1 taken 121219 times.
✓ Branch 2 taken 34571 times.
✓ Branch 3 taken 346529 times.
✓ Branch 4 taken 7349 times.
✓ Branch 5 taken 27222 times.
|
502319 | if(s->id==wBrang || (s->id==wHookshot&&!pull_hero)) |
| 6801 | { | ||
| 6802 |
1/2✓ Branch 0 taken 148441 times.
✗ Branch 1 not taken.
|
148441 | int32_t itemid = ((weapon*)s)->parentitem>-1 ? ((weapon*)s)->parentitem : |
| 6803 | ✗ | directWpn>-1 ? directWpn : current_item_id(s->id==wHookshot ? (((weapon*)s)->family_class == itype_switchhook ? itype_switchhook : itype_hookshot) : itype_brang); | |
| 6804 | 148441 | itemid = vbound(itemid, 0, MAXITEMS-1); | |
| 6805 | |||
| 6806 |
2/2✓ Branch 0 taken 147949 times.
✓ Branch 1 taken 68153 times.
|
216102 | for(int32_t j=0; j<Ewpns.Count(); j++) |
| 6807 | { | ||
| 6808 | 68153 | sprite *t = Ewpns.spr(j); | |
| 6809 | |||
| 6810 |
2/2✓ Branch 0 taken 67661 times.
✓ Branch 1 taken 492 times.
|
68153 | if(s->hit(t->x+7,t->y+7-t->fakez,t->z,2,2,1)) |
| 6811 | { | ||
| 6812 | 492 | bool reflect = false; | |
| 6813 | // sethitHeroUID(HIT_BY_EWEAPON,j); //set that Hero was hit by a specific eweapon index. | ||
| 6814 | |||
| 6815 |
2/2✓ Branch 0 taken 369 times.
✓ Branch 1 taken 123 times.
|
492 | if(sh_check(itemsbuf[itemid].misc3, itemsbuf[itemid].misc4, t->id, reflect, ((weapon*)t)->level&1, false)) |
| 6816 | { | ||
| 6817 | 123 | ((weapon*)s)->dead=1; | |
| 6818 | 123 | weapon *ew = ((weapon*)t); | |
| 6819 | 123 | int32_t oldid = ew->id; | |
| 6820 | 123 | ew->onhit(true, reflect ? 2 : 1, s->dir); | |
| 6821 | 123 | } | |
| 6822 | 492 | break; | |
| 6823 | } | ||
| 6824 | 67661 | } | |
| 6825 | 148441 | } | |
| 6826 | 502319 | } | |
| 6827 | |||
| 6828 |
6/6✓ Branch 0 taken 4365285 times.
✓ Branch 1 taken 1708634 times.
✓ Branch 2 taken 1990725 times.
✓ Branch 3 taken 2374560 times.
✓ Branch 4 taken 106519 times.
✓ Branch 5 taken 1884206 times.
|
6073919 | if((itemsbuf[itemid].flags & item_flag2)||(itemid==-1&&get_qr(qr_OUCHBOMBS))) |
| 6829 | { | ||
| 6830 |
7/8✓ Branch 0 taken 1766978 times.
✓ Branch 1 taken 48175 times.
✓ Branch 2 taken 48723 times.
✓ Branch 3 taken 1766430 times.
✓ Branch 4 taken 48723 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 29 times.
✓ Branch 7 taken 48694 times.
|
1815153 | if(((s->id==wBomb)||(s->id==wSBomb)) && !superman && scriptcoldet && !fallclk) |
| 6831 | { | ||
| 6832 | 48694 | weapon* w = (weapon*)s; | |
| 6833 | 48694 | bool didhit = s->hit(this); | |
| 6834 |
2/2✓ Branch 0 taken 48655 times.
✓ Branch 1 taken 39 times.
|
48694 | if(didhit) |
| 6835 | { | ||
| 6836 | 39 | std::vector<int32_t> &ev = FFCore.eventData; | |
| 6837 | 39 | ev.clear(); | |
| 6838 |
2/2✓ Branch 0 taken 37 times.
✓ Branch 1 taken 2 times.
|
39 | ev.push_back(((w->parentitem>-1 ? itemsbuf[w->parentitem].misc3 : w->power) *game->get_hp_per_heart())*10000); |
| 6839 | 39 | ev.push_back(w->hitdir(x,y,16,16,dir)*10000); | |
| 6840 | 39 | ev.push_back(0); | |
| 6841 | 39 | ev.push_back(DivineProtectionShieldClk>0?10000:0); | |
| 6842 | 39 | ev.push_back(48*10000); | |
| 6843 | 39 | ev.push_back(ZSD_LWPN*10000); | |
| 6844 | 39 | ev.push_back(w->getUID()); | |
| 6845 | 39 | ev.push_back(ZSD_NONE*10000); | |
| 6846 | 39 | ev.push_back(0); | |
| 6847 | |||
| 6848 | 39 | throwGenScriptEvent(GENSCR_EVENT_HERO_HIT_1); | |
| 6849 | 39 | int32_t dmg = ev[0]/10000; | |
| 6850 | 39 | bool nullhit = ev[2] != 0; | |
| 6851 | |||
| 6852 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 39 times.
|
39 | if(nullhit) {ev.clear(); return;} |
| 6853 | |||
| 6854 | //Args: 'damage (post-ring)','hitdir','nullifyhit','type:npc','npc uid' | ||
| 6855 | 39 | ev[0] = ringpower(dmg)*10000; | |
| 6856 | |||
| 6857 | 39 | throwGenScriptEvent(GENSCR_EVENT_HERO_HIT_2); | |
| 6858 | 39 | dmg = ev[0]/10000; | |
| 6859 | 39 | int32_t hdir = ev[1]/10000; | |
| 6860 | 39 | nullhit = ev[2] != 0; | |
| 6861 | 39 | bool divineprot = ev[3] != 0; | |
| 6862 | 39 | int32_t iframes = ev[4] / 10000; | |
| 6863 | 39 | ev.clear(); | |
| 6864 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 39 times.
|
39 | if(nullhit) return; |
| 6865 |
1/2✓ Branch 0 taken 39 times.
✗ Branch 1 not taken.
|
39 | if (Lwpns.spr(i) != w) |
| 6866 | { | ||
| 6867 | ✗ | auto hit = Lwpns.find(w); | |
| 6868 | ✗ | if (hit < 0) | |
| 6869 | ✗ | s = nullptr; | |
| 6870 | else | ||
| 6871 | { | ||
| 6872 | ✗ | s = Lwpns.spr(hit); | |
| 6873 | ✗ | i = hit; | |
| 6874 | } | ||
| 6875 | ✗ | w = (weapon*)s; | |
| 6876 | ✗ | } | |
| 6877 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 39 times.
|
39 | if(!divineprot) |
| 6878 | { | ||
| 6879 |
5/6✓ Branch 0 taken 38 times.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 39 times.
✓ Branch 4 taken 38 times.
✓ Branch 5 taken 1 times.
|
39 | game->set_life(zc_min(game->get_maxlife(), zc_max(game->get_life()-dmg,0))); |
| 6880 |
3/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 34 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5 times.
|
39 | if (!get_qr(qr_BROKENHITBY) && w) |
| 6881 | { | ||
| 6882 | 5 | sethitHeroUID(HIT_BY_LWEAPON,(i+1)); | |
| 6883 | 5 | sethitHeroUID(HIT_BY_LWEAPON_UID,w->getUID()); | |
| 6884 | 5 | sethitHeroUID(HIT_BY_LWEAPON_ENGINE_UID,w->getUID()); | |
| 6885 | 5 | sethitHeroUID(HIT_BY_LWEAPON_TYPE, w->id); | |
| 6886 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
|
5 | if (w->parentitem > -1) sethitHeroUID(HIT_BY_LWEAPON_PARENT_ID, w->parentitem); |
| 6887 | ✗ | else sethitHeroUID(HIT_BY_LWEAPON_PARENT_ID, -1); | |
| 6888 | 5 | sethitHeroUID(HIT_BY_LWEAPON_PARENT_FAMILY, itemsbuf[w->parentitem].type); | |
| 6889 | 5 | } | |
| 6890 | 39 | } | |
| 6891 | |||
| 6892 | 39 | doHit(hdir, iframes); | |
| 6893 | 39 | return; | |
| 6894 | } | ||
| 6895 | 48655 | } | |
| 6896 | 1815114 | } | |
| 6897 | |||
| 6898 |
7/8✓ Branch 0 taken 6073880 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 10046 times.
✓ Branch 3 taken 6063834 times.
✓ Branch 4 taken 9920 times.
✓ Branch 5 taken 126 times.
✓ Branch 6 taken 6073754 times.
✓ Branch 7 taken 126 times.
|
6073880 | if(hclk==0 && s->id==wWind && s->hit(x+7,y+7-fakez,z,2,2,1) && !fairyclk) |
| 6899 | { | ||
| 6900 | 126 | std::vector<int32_t> &ev = FFCore.eventData; | |
| 6901 | 126 | ev.clear(); | |
| 6902 | 126 | ev.push_back(0); | |
| 6903 | 126 | ev.push_back(s->dir*10000); | |
| 6904 | 126 | ev.push_back(0); | |
| 6905 | 126 | ev.push_back(0); | |
| 6906 | 126 | ev.push_back(ZSD_LWPN*10000); | |
| 6907 | 126 | ev.push_back(s->getUID()); | |
| 6908 | 126 | ev.push_back(ZSD_NONE*10000); | |
| 6909 | 126 | ev.push_back(0); | |
| 6910 | |||
| 6911 | 126 | throwGenScriptEvent(GENSCR_EVENT_HERO_HIT_1); | |
| 6912 | 126 | bool nullhit = ev[2] != 0; | |
| 6913 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 126 times.
|
126 | if(nullhit) {ev.clear(); return;} |
| 6914 | |||
| 6915 | 126 | throwGenScriptEvent(GENSCR_EVENT_HERO_HIT_2); | |
| 6916 | 126 | int32_t hdir = ev[1]/10000; | |
| 6917 | 126 | nullhit = ev[2] != 0; | |
| 6918 | 126 | ev.clear(); | |
| 6919 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 126 times.
|
126 | if(nullhit) return; |
| 6920 |
1/2✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
|
126 | if (Lwpns.spr(i) != s) |
| 6921 | { | ||
| 6922 | ✗ | auto hit = Lwpns.find(s); | |
| 6923 | ✗ | if (hit < 0) | |
| 6924 | ✗ | s = nullptr; | |
| 6925 | else | ||
| 6926 | { | ||
| 6927 | ✗ | s = Lwpns.spr(hit); | |
| 6928 | ✗ | i = hit; | |
| 6929 | } | ||
| 6930 | ✗ | } | |
| 6931 | |||
| 6932 | 126 | reset_hookshot(); | |
| 6933 | 126 | xofs=1000; | |
| 6934 | 126 | action=inwind; FFCore.setHeroAction(inwind); | |
| 6935 | 126 | dir = hdir; | |
| 6936 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 126 times.
|
126 | if(s) s->dir = hdir; |
| 6937 | 126 | spins = charging = attackclk = 0; | |
| 6938 | |||
| 6939 | // In case Hero used two whistles in a row, summoning two whirlwinds, | ||
| 6940 | // check which whistle's whirlwind picked him up so the correct | ||
| 6941 | // warp ring will be used | ||
| 6942 |
1/2✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
|
126 | int32_t whistle=s ? ((weapon*)s)->parentitem : -1; |
| 6943 | |||
| 6944 |
2/4✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 126 times.
|
126 | if(whistle>-1 && itemsbuf[whistle].type==itype_whistle) |
| 6945 | 126 | whistleitem=whistle; | |
| 6946 | |||
| 6947 | 126 | return; | |
| 6948 | } | ||
| 6949 | 6073754 | } | |
| 6950 | |||
| 6951 |
6/8✓ Branch 0 taken 13953104 times.
✓ Branch 1 taken 113382 times.
✓ Branch 2 taken 13642865 times.
✓ Branch 3 taken 310239 times.
✓ Branch 4 taken 13642865 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 13638998 times.
|
27705484 | if(action==rafting || action==freeze || action==sideswimfreeze || |
| 6952 |
5/8✓ Branch 0 taken 13638998 times.
✓ Branch 1 taken 3867 times.
✓ Branch 2 taken 13638998 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 13638998 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 13638998 times.
✗ Branch 7 not taken.
|
13642865 | action==casting || action==sideswimcasting || action==drowning || action==lavadrowning || action==sidedrowning) |
| 6953 | 427488 | return; | |
| 6954 | |||
| 6955 | 13638998 | int32_t hit2 = -1; | |
| 6956 | 13638998 | do | |
| 6957 | { | ||
| 6958 |
4/6✓ Branch 0 taken 8850935 times.
✓ Branch 1 taken 4804674 times.
✓ Branch 2 taken 8850935 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 8850935 times.
|
13655609 | hit2 = (diagonalMovement||NO_GRIDLOCK) ? GuyHitFrom(hit2+1,x+4,y+4-fakez,z,8,8,hzsz) |
| 6959 | 8850935 | : GuyHitFrom(hit2+1,x+7,y+7-fakez,z,2,2,hzsz); | |
| 6960 | |||
| 6961 |
2/2✓ Branch 0 taken 13624161 times.
✓ Branch 1 taken 31448 times.
|
13655609 | if(hit2!=-1) |
| 6962 | { | ||
| 6963 |
2/2✓ Branch 0 taken 16611 times.
✓ Branch 1 taken 14837 times.
|
31448 | if (hithero(hit2) == 0) return; |
| 6964 | 16611 | } | |
| 6965 |
2/2✓ Branch 0 taken 16611 times.
✓ Branch 1 taken 13624161 times.
|
13640772 | } while (hit2 != -1); |
| 6966 |
6/6✓ Branch 0 taken 13452834 times.
✓ Branch 1 taken 171327 times.
✓ Branch 2 taken 13442391 times.
✓ Branch 3 taken 10443 times.
✓ Branch 4 taken 5221 times.
✓ Branch 5 taken 13437170 times.
|
13624161 | if (superman || !scriptcoldet || fallclk) return; |
| 6967 | 13437170 | hit2 = LwpnHit(); | |
| 6968 | |||
| 6969 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 13437160 times.
|
13437170 | if(hit2!=-1) |
| 6970 | { | ||
| 6971 | 10 | weapon* lwpnspr = (weapon*)Lwpns.spr(hit2); | |
| 6972 | 10 | std::vector<int32_t> &ev = FFCore.eventData; | |
| 6973 | 10 | ev.clear(); | |
| 6974 | 10 | ev.push_back((lwpn_dp(hit2)*10000)); | |
| 6975 | 10 | ev.push_back(lwpnspr->hitdir(x,y,16,16,dir)*10000); | |
| 6976 | 10 | ev.push_back(0); | |
| 6977 | 10 | ev.push_back(DivineProtectionShieldClk>0?10000:0); | |
| 6978 | 10 | ev.push_back(48*10000); | |
| 6979 | 10 | ev.push_back(ZSD_LWPN*10000); | |
| 6980 | 10 | ev.push_back(lwpnspr->getUID()); | |
| 6981 | 10 | ev.push_back(ZSD_NONE*10000); | |
| 6982 | 10 | ev.push_back(0); | |
| 6983 | |||
| 6984 | 10 | throwGenScriptEvent(GENSCR_EVENT_HERO_HIT_1); | |
| 6985 | 10 | int32_t dmg = ev[0]/10000; | |
| 6986 | 10 | bool nullhit = ev[2] != 0; | |
| 6987 | |||
| 6988 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
|
10 | if(nullhit) {ev.clear(); return;} |
| 6989 | |||
| 6990 | //Args: 'damage (post-ring)','hitdir','nullifyhit','type:npc','npc uid' | ||
| 6991 | 10 | ev[0] = ringpower(dmg)*10000; | |
| 6992 | |||
| 6993 | 10 | throwGenScriptEvent(GENSCR_EVENT_HERO_HIT_2); | |
| 6994 | 10 | dmg = ev[0]/10000; | |
| 6995 | 10 | int32_t hdir = ev[1]/10000; | |
| 6996 | 10 | nullhit = ev[2] != 0; | |
| 6997 | 10 | bool divineprot = ev[3] != 0; | |
| 6998 | 10 | int32_t iframes = ev[4] / 10000; | |
| 6999 | 10 | ev.clear(); | |
| 7000 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
|
10 | if(nullhit) return; |
| 7001 |
1/2✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
|
10 | if (Lwpns.spr(hit2) != lwpnspr) |
| 7002 | { | ||
| 7003 | ✗ | hit2 = Lwpns.find(lwpnspr); | |
| 7004 | ✗ | if (hit2 < 0) | |
| 7005 | ✗ | lwpnspr = nullptr; | |
| 7006 | ✗ | else lwpnspr = (weapon*)Lwpns.spr(hit2); | |
| 7007 | ✗ | } | |
| 7008 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
|
10 | if (!divineprot) |
| 7009 | { | ||
| 7010 |
1/2✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
|
10 | game->set_life(zc_max(game->get_life() - dmg, 0)); |
| 7011 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
|
10 | if (lwpnspr) |
| 7012 | { | ||
| 7013 | 10 | sethitHeroUID(HIT_BY_LWEAPON, (hit2 + 1)); | |
| 7014 | 10 | sethitHeroUID(HIT_BY_LWEAPON_UID, lwpnspr->getUID()); | |
| 7015 | 10 | sethitHeroUID(HIT_BY_LWEAPON_ENGINE_UID, lwpnspr->getUID()); | |
| 7016 | 10 | sethitHeroUID(HIT_BY_LWEAPON_TYPE, lwpnspr->id); | |
| 7017 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 8 times.
|
10 | if (lwpnspr->parentitem > -1) sethitHeroUID(HIT_BY_LWEAPON_PARENT_ID, lwpnspr->parentitem); |
| 7018 | 8 | else sethitHeroUID(HIT_BY_LWEAPON_PARENT_ID, -1); | |
| 7019 | 10 | sethitHeroUID(HIT_BY_LWEAPON_PARENT_FAMILY, itemsbuf[lwpnspr->parentitem].type); | |
| 7020 | 10 | } | |
| 7021 | 10 | } | |
| 7022 | |||
| 7023 |
1/2✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
|
10 | if(lwpnspr) |
| 7024 | 10 | lwpnspr->hit_pierce(); | |
| 7025 | |||
| 7026 | 10 | doHit(hdir, iframes); | |
| 7027 | 10 | return; | |
| 7028 | } | ||
| 7029 | |||
| 7030 | //else { sethitHeroUID(HIT_BY_LWEAPON,(0)); //fails to clear | ||
| 7031 | |||
| 7032 | 13437160 | hit2 = EwpnHit(); | |
| 7033 | |||
| 7034 |
2/2✓ Branch 0 taken 5650 times.
✓ Branch 1 taken 13431510 times.
|
13437160 | if(hit2!=-1) |
| 7035 | { | ||
| 7036 | 5650 | weapon* ewpnspr = (weapon*)Ewpns.spr(hit2); | |
| 7037 | 5650 | std::vector<int32_t> &ev = FFCore.eventData; | |
| 7038 | 5650 | ev.clear(); | |
| 7039 | 5650 | ev.push_back((ewpn_dp(hit2)*10000)); | |
| 7040 | 5650 | ev.push_back(ewpnspr->hitdir(x,y,16,16,dir)*10000); | |
| 7041 | 5650 | ev.push_back(0); | |
| 7042 | 5650 | ev.push_back(DivineProtectionShieldClk>0?10000:0); | |
| 7043 | 5650 | ev.push_back(48*10000); | |
| 7044 | 5650 | ev.push_back(ZSD_EWPN*10000); | |
| 7045 | 5650 | ev.push_back(ewpnspr->getUID()); | |
| 7046 | 5650 | ev.push_back(ZSD_NONE*10000); | |
| 7047 | 5650 | ev.push_back(0); | |
| 7048 | |||
| 7049 | 5650 | throwGenScriptEvent(GENSCR_EVENT_HERO_HIT_1); | |
| 7050 | 5650 | int32_t dmg = ev[0]/10000; | |
| 7051 | 5650 | bool nullhit = ev[2] != 0; | |
| 7052 | |||
| 7053 |
2/2✓ Branch 0 taken 63 times.
✓ Branch 1 taken 5587 times.
|
5650 | if(nullhit) {ev.clear(); return;} |
| 7054 | |||
| 7055 | //Args: 'damage (post-ring)','hitdir','nullifyhit','type:npc','npc uid' | ||
| 7056 | 5587 | ev[0] = ringpower(dmg)*10000; | |
| 7057 | |||
| 7058 | 5587 | throwGenScriptEvent(GENSCR_EVENT_HERO_HIT_2); | |
| 7059 | 5587 | dmg = ev[0]/10000; | |
| 7060 | 5587 | int32_t hdir = ev[1]/10000; | |
| 7061 | 5587 | nullhit = ev[2] != 0; | |
| 7062 | 5587 | bool divineprot = ev[3] != 0; | |
| 7063 | 5587 | int32_t iframes = ev[4] / 10000; | |
| 7064 | 5587 | ev.clear(); | |
| 7065 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5587 times.
|
5587 | if (nullhit) return; |
| 7066 |
1/2✓ Branch 0 taken 5587 times.
✗ Branch 1 not taken.
|
5587 | if (Ewpns.spr(hit2) != ewpnspr) |
| 7067 | { | ||
| 7068 | ✗ | hit2 = Ewpns.find(ewpnspr); | |
| 7069 | ✗ | if (hit2 < 0) | |
| 7070 | ✗ | ewpnspr = nullptr; | |
| 7071 | ✗ | else ewpnspr = (weapon*)Ewpns.spr(hit2); | |
| 7072 | ✗ | } | |
| 7073 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5587 times.
|
5587 | if (!divineprot) |
| 7074 | { | ||
| 7075 |
2/2✓ Branch 0 taken 5535 times.
✓ Branch 1 taken 52 times.
|
5587 | game->set_life(zc_max(game->get_life() - dmg, 0)); |
| 7076 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5587 times.
|
5587 | if (ewpnspr) |
| 7077 | { | ||
| 7078 | 5587 | sethitHeroUID(HIT_BY_EWEAPON, (hit2 + 1)); | |
| 7079 | 5587 | sethitHeroUID(HIT_BY_EWEAPON_UID, ewpnspr->getUID()); | |
| 7080 | 5587 | sethitHeroUID(HIT_BY_EWEAPON_ENGINE_UID, ewpnspr->getUID()); | |
| 7081 | 5587 | sethitHeroUID(HIT_BY_EWEAPON_TYPE, ewpnspr->id); | |
| 7082 | 5587 | } | |
| 7083 | 5587 | } | |
| 7084 | |||
| 7085 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5587 times.
|
5587 | if(ewpnspr) |
| 7086 | 5587 | ewpnspr->hit_pierce(); | |
| 7087 | |||
| 7088 | 5587 | doHit(hdir, iframes); | |
| 7089 | 5587 | return; | |
| 7090 | } | ||
| 7091 | |||
| 7092 | // The rest of this method deals with damage combos, which can be jumped over. | ||
| 7093 |
4/4✓ Branch 0 taken 13412492 times.
✓ Branch 1 taken 19018 times.
✓ Branch 2 taken 13412745 times.
✓ Branch 3 taken 18765 times.
|
13431510 | if((z>0 || fakez>0) && !(hero_scr->flags2&fAIRCOMBOS)) return; |
| 7094 | |||
| 7095 | 13412745 | int32_t dx1 = (int32_t)x+8-(hero_scr->csensitive); | |
| 7096 | 13412745 | int32_t dx2 = (int32_t)x+8+(hero_scr->csensitive-1); | |
| 7097 |
2/2✓ Branch 0 taken 284213 times.
✓ Branch 1 taken 13128532 times.
|
13412745 | int32_t dy1 = (int32_t)y+(bigHitbox?8:12)-(bigHitbox?hero_scr->csensitive:(hero_scr->csensitive+1)/2); |
| 7098 |
2/2✓ Branch 0 taken 284213 times.
✓ Branch 1 taken 13128532 times.
|
13412745 | int32_t dy2 = (int32_t)y+(bigHitbox?8:12)+(bigHitbox?hero_scr->csensitive-1:((hero_scr->csensitive+1)/2)-1); |
| 7099 | |||
| 7100 |
2/2✓ Branch 0 taken 25497345 times.
✓ Branch 1 taken 13412745 times.
|
38910090 | for(int32_t i=get_qr(qr_DMGCOMBOLAYERFIX) ? 1 : -1; i>=-1; i--) // Layers 0, 1 and 2!! |
| 7101 | 25497345 | checkdamagecombos(dx1,dx2,dy1,dy2,i); | |
| 7102 | 14837094 | } | |
| 7103 | |||
| 7104 | 23400 | bool HeroClass::checkdamagecombos(int32_t dx, int32_t dy) | |
| 7105 | { | ||
| 7106 | 23400 | return checkdamagecombos(dx,dx,dy,dy); | |
| 7107 | } | ||
| 7108 | |||
| 7109 | 6242 | void HeroClass::doHit(int32_t hdir, int iframes) | |
| 7110 | { | ||
| 7111 | 6242 | hitdir = hdir; | |
| 7112 | |||
| 7113 |
3/6✓ Branch 0 taken 6242 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6242 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 6242 times.
|
6242 | if (action != rafting && action != freeze && action != sideswimfreeze) |
| 7114 | { | ||
| 7115 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6242 times.
|
6242 | if (IsSideSwim()) |
| 7116 | { | ||
| 7117 | ✗ | action=sideswimhit; FFCore.setHeroAction(sideswimhit); | |
| 7118 | ✗ | } | |
| 7119 |
3/4✓ Branch 0 taken 6174 times.
✓ Branch 1 taken 68 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6174 times.
|
6242 | else if (action == swimming || hopclk == 0xFF) |
| 7120 | { | ||
| 7121 | 68 | action=swimhit; FFCore.setHeroAction(swimhit); | |
| 7122 | 68 | } | |
| 7123 | else | ||
| 7124 | { | ||
| 7125 | 6174 | action=gothit; FFCore.setHeroAction(gothit); | |
| 7126 | } | ||
| 7127 | 6242 | } | |
| 7128 | |||
| 7129 | 6242 | hclk = iframes; | |
| 7130 | 6242 | check_on_hit(); | |
| 7131 | |||
| 7132 |
8/8✓ Branch 0 taken 6206 times.
✓ Branch 1 taken 36 times.
✓ Branch 2 taken 6204 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 2470 times.
✓ Branch 5 taken 3734 times.
✓ Branch 6 taken 162 times.
✓ Branch 7 taken 2308 times.
|
6242 | if(charging > 0 || spins > 0 || attack == wSword || attack == wHammer) |
| 7133 | { | ||
| 7134 | 3934 | spins = charging = attackclk = 0; | |
| 7135 | 3934 | attack=none; | |
| 7136 | 3934 | tapping = false; | |
| 7137 | 3934 | } | |
| 7138 | |||
| 7139 | 6242 | sfx(getHurtSFX(),pan(x)); | |
| 7140 | 6242 | } | |
| 7141 | |||
| 7142 | 26003310 | bool HeroClass::checkdamagecombos(int32_t dx1, int32_t dx2, int32_t dy1, int32_t dy2, int32_t layer, bool solid, bool do_health_check) //layer = -1, solid = false, do_health_check = true | |
| 7143 | { | ||
| 7144 |
5/6✓ Branch 0 taken 26003037 times.
✓ Branch 1 taken 273 times.
✓ Branch 2 taken 26000846 times.
✓ Branch 3 taken 2191 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 26000846 times.
|
26003310 | if(hclk || superman || fallclk) |
| 7145 | 2464 | return false; | |
| 7146 | |||
| 7147 | 26000846 | int32_t hp_mod[4] = {0}; | |
| 7148 | int32_t cid[8]; | ||
| 7149 | 26000846 | byte hasKB = 0; | |
| 7150 | |||
| 7151 | { | ||
| 7152 |
2/2✓ Branch 0 taken 12404681 times.
✓ Branch 1 taken 13596165 times.
|
26000846 | cid[0] = layer>-1?MAPCOMBO2(layer,dx1,dy1):MAPCOMBO(dx1,dy1); |
| 7153 | 26000846 | newcombo& cmb = combobuf[cid[0]]; | |
| 7154 |
4/4✓ Branch 0 taken 26000843 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 25999010 times.
✓ Branch 3 taken 1833 times.
|
26000846 | if ( !(cmb.only_gentrig) && combo_class_buf[cmb.type].modify_hp_amount) |
| 7155 | { | ||
| 7156 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 1823 times.
|
1833 | if(cmb.usrflags&cflag1) |
| 7157 | 10 | hp_mod[0] = cmb.attributes[0] / -10000L; | |
| 7158 | else | ||
| 7159 | 1823 | hp_mod[0]=combo_class_buf[cmb.type].modify_hp_amount; | |
| 7160 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1833 times.
|
1833 | if(!(cmb.usrflags&cflag2)) |
| 7161 | 1833 | hasKB |= 1<<0; | |
| 7162 | 1833 | } | |
| 7163 | } | ||
| 7164 | { | ||
| 7165 |
2/2✓ Branch 0 taken 12404681 times.
✓ Branch 1 taken 13596165 times.
|
26000846 | cid[1] = layer>-1?MAPCOMBO2(layer,dx1,dy2):MAPCOMBO(dx1,dy2); |
| 7166 | 26000846 | newcombo& cmb = combobuf[cid[1]]; | |
| 7167 |
4/4✓ Branch 0 taken 26000843 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 25998966 times.
✓ Branch 3 taken 1877 times.
|
26000846 | if ( !(cmb.only_gentrig) && combo_class_buf[cmb.type].modify_hp_amount) |
| 7168 | { | ||
| 7169 |
2/2✓ Branch 0 taken 9 times.
✓ Branch 1 taken 1868 times.
|
1877 | if(cmb.usrflags&cflag1) |
| 7170 | 9 | hp_mod[1] = cmb.attributes[0] / -10000L; | |
| 7171 | else | ||
| 7172 | 1868 | hp_mod[1]=combo_class_buf[cmb.type].modify_hp_amount; | |
| 7173 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1877 times.
|
1877 | if(!(cmb.usrflags&cflag2)) |
| 7174 | 1877 | hasKB |= 1<<1; | |
| 7175 | 1877 | } | |
| 7176 | } | ||
| 7177 | { | ||
| 7178 |
2/2✓ Branch 0 taken 12404681 times.
✓ Branch 1 taken 13596165 times.
|
26000846 | cid[2] = layer>-1?MAPCOMBO2(layer,dx2,dy1):MAPCOMBO(dx2,dy1); |
| 7179 | 26000846 | newcombo& cmb = combobuf[cid[2]]; | |
| 7180 |
4/4✓ Branch 0 taken 26000843 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 25999007 times.
✓ Branch 3 taken 1836 times.
|
26000846 | if ( !(cmb.only_gentrig) && combo_class_buf[cmb.type].modify_hp_amount) |
| 7181 | { | ||
| 7182 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 1830 times.
|
1836 | if(cmb.usrflags&cflag1) |
| 7183 | 6 | hp_mod[2] = cmb.attributes[0] / -10000L; | |
| 7184 | else | ||
| 7185 | 1830 | hp_mod[2]=combo_class_buf[cmb.type].modify_hp_amount; | |
| 7186 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1836 times.
|
1836 | if(!(cmb.usrflags&cflag2)) |
| 7187 | 1836 | hasKB |= 1<<2; | |
| 7188 | 1836 | } | |
| 7189 | } | ||
| 7190 | { | ||
| 7191 |
2/2✓ Branch 0 taken 12404681 times.
✓ Branch 1 taken 13596165 times.
|
26000846 | cid[3] = layer>-1?MAPCOMBO2(layer,dx2,dy2):MAPCOMBO(dx2,dy2); |
| 7192 | 26000846 | newcombo& cmb = combobuf[cid[3]]; | |
| 7193 |
4/4✓ Branch 0 taken 26000843 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 25998952 times.
✓ Branch 3 taken 1891 times.
|
26000846 | if ( !(cmb.only_gentrig) && combo_class_buf[cmb.type].modify_hp_amount) |
| 7194 | { | ||
| 7195 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 1886 times.
|
1891 | if(cmb.usrflags&cflag1) |
| 7196 | 5 | hp_mod[3] = cmb.attributes[0] / -10000L; | |
| 7197 | else | ||
| 7198 | 1886 | hp_mod[3]=combo_class_buf[cmb.type].modify_hp_amount; | |
| 7199 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1891 times.
|
1891 | if(!(cmb.usrflags&cflag2)) |
| 7200 | 1891 | hasKB |= 1<<3; | |
| 7201 | 1891 | } | |
| 7202 | } | ||
| 7203 | |||
| 7204 | 26000846 | int32_t bestcid=0; | |
| 7205 | 26000846 | rpos_t best_rpos = rpos_t::None; | |
| 7206 | 26000846 | int32_t hp_modtotal=0; | |
| 7207 | 26000846 | rpos_t rposes[] = {COMBOPOS_REGION_B(dx1,dy1),COMBOPOS_REGION_B(dx1,dy2),COMBOPOS_REGION_B(dx2,dy1),COMBOPOS_REGION_B(dx2,dy2)}; | |
| 7208 |
2/2✓ Branch 0 taken 25867819 times.
✓ Branch 1 taken 133027 times.
|
26000846 | if (!_effectflag(dx1,dy1,1, layer)) {hp_mod[0] = 0; hasKB &= ~(1<<0);} |
| 7209 |
2/2✓ Branch 0 taken 25857860 times.
✓ Branch 1 taken 142986 times.
|
26000846 | if (!_effectflag(dx1,dy2,1, layer)) {hp_mod[1] = 0; hasKB &= ~(1<<1);} |
| 7210 |
2/2✓ Branch 0 taken 25867858 times.
✓ Branch 1 taken 132988 times.
|
26000846 | if (!_effectflag(dx2,dy1,1, layer)) {hp_mod[2] = 0; hasKB &= ~(1<<2);} |
| 7211 |
2/2✓ Branch 0 taken 25857895 times.
✓ Branch 1 taken 142951 times.
|
26000846 | if (!_effectflag(dx2,dy2,1, layer)) {hp_mod[3] = 0; hasKB &= ~(1<<3);} |
| 7212 | |||
| 7213 |
2/2✓ Branch 0 taken 52001692 times.
✓ Branch 1 taken 26000846 times.
|
78002538 | for (int32_t i = 0; i <= 1; ++i) |
| 7214 | { | ||
| 7215 |
2/2✓ Branch 0 taken 44132314 times.
✓ Branch 1 taken 7869378 times.
|
52001692 | if (get_qr(qr_OLD_BRIDGE_COMBOS)) |
| 7216 | { | ||
| 7217 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 44132314 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
44132314 | if (combobuf[MAPCOMBO2(i,dx1,dy1)].type == cBRIDGE && !_walkflag_layer(dx1,dy1,i)) {hp_mod[0] = 0; hasKB &= ~(1<<0);} |
| 7218 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 44132314 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
44132314 | if (combobuf[MAPCOMBO2(i,dx1,dy2)].type == cBRIDGE && !_walkflag_layer(dx1,dy2,i)) {hp_mod[1] = 0; hasKB &= ~(1<<1);} |
| 7219 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 44132314 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
44132314 | if (combobuf[MAPCOMBO2(i,dx2,dy1)].type == cBRIDGE && !_walkflag_layer(dx2,dy1,i)) {hp_mod[2] = 0; hasKB &= ~(1<<2);} |
| 7220 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 44132314 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
44132314 | if (combobuf[MAPCOMBO2(i,dx2,dy2)].type == cBRIDGE && !_walkflag_layer(dx2,dy2,i)) {hp_mod[3] = 0; hasKB &= ~(1<<3);} |
| 7221 | 44132314 | } | |
| 7222 | else | ||
| 7223 | { | ||
| 7224 |
4/4✓ Branch 0 taken 16473 times.
✓ Branch 1 taken 7852905 times.
✓ Branch 2 taken 2538 times.
✓ Branch 3 taken 13935 times.
|
7869378 | if (combobuf[MAPCOMBO2(i,dx1,dy1)].type == cBRIDGE && _effectflag_layer(dx1,dy1,i)) {hp_mod[0] = 0; hasKB &= ~(1<<0);} |
| 7225 |
4/4✓ Branch 0 taken 16506 times.
✓ Branch 1 taken 7852872 times.
✓ Branch 2 taken 2598 times.
✓ Branch 3 taken 13908 times.
|
7869378 | if (combobuf[MAPCOMBO2(i,dx1,dy2)].type == cBRIDGE && _effectflag_layer(dx1,dy2,i)) {hp_mod[1] = 0; hasKB &= ~(1<<1);} |
| 7226 |
4/4✓ Branch 0 taken 16491 times.
✓ Branch 1 taken 7852887 times.
✓ Branch 2 taken 2622 times.
✓ Branch 3 taken 13869 times.
|
7869378 | if (combobuf[MAPCOMBO2(i,dx2,dy1)].type == cBRIDGE && _effectflag_layer(dx2,dy1,i)) {hp_mod[2] = 0; hasKB &= ~(1<<2);} |
| 7227 |
4/4✓ Branch 0 taken 16530 times.
✓ Branch 1 taken 7852848 times.
✓ Branch 2 taken 2685 times.
✓ Branch 3 taken 13845 times.
|
7869378 | if (combobuf[MAPCOMBO2(i,dx2,dy2)].type == cBRIDGE && _effectflag_layer(dx2,dy2,i)) {hp_mod[3] = 0; hasKB &= ~(1<<3);} |
| 7228 | } | ||
| 7229 | 52001692 | } | |
| 7230 | |||
| 7231 |
2/2✓ Branch 0 taken 104003384 times.
✓ Branch 1 taken 26000846 times.
|
130004230 | for(int32_t i=0; i<4; i++) |
| 7232 | { | ||
| 7233 |
2/2✓ Branch 0 taken 104000584 times.
✓ Branch 1 taken 2800 times.
|
104003384 | if (rposes[i] == rpos_t::None) |
| 7234 | 2800 | continue; | |
| 7235 | |||
| 7236 |
2/2✓ Branch 0 taken 37155700 times.
✓ Branch 1 taken 66844884 times.
|
104000584 | if(get_qr(qr_DMGCOMBOPRI)) |
| 7237 | { | ||
| 7238 |
2/2✓ Branch 0 taken 37155314 times.
✓ Branch 1 taken 386 times.
|
37155700 | if(hp_modtotal >= 0) //Okay, if it's over 0, it's healing Hero. |
| 7239 | { | ||
| 7240 |
2/2✓ Branch 0 taken 37155156 times.
✓ Branch 1 taken 158 times.
|
37155314 | if(hp_mod[i] < hp_modtotal) |
| 7241 | { | ||
| 7242 | 158 | hp_modtotal = hp_mod[i]; | |
| 7243 | 158 | bestcid = cid[i]; | |
| 7244 | 158 | best_rpos = rposes[i]; | |
| 7245 | 158 | } | |
| 7246 | 37155314 | } | |
| 7247 |
2/2✓ Branch 0 taken 88 times.
✓ Branch 1 taken 298 times.
|
386 | else if(hp_mod[i] < 0) //If it's under 0, it's hurting Hero. |
| 7248 | { | ||
| 7249 |
1/2✓ Branch 0 taken 298 times.
✗ Branch 1 not taken.
|
298 | if(hp_mod[i] > hp_modtotal) |
| 7250 | { | ||
| 7251 | ✗ | hp_modtotal = hp_mod[i]; | |
| 7252 | ✗ | bestcid = cid[i]; | |
| 7253 | ✗ | best_rpos = rposes[i]; | |
| 7254 | ✗ | } | |
| 7255 | 298 | } | |
| 7256 | 37155700 | } | |
| 7257 |
2/2✓ Branch 0 taken 66842946 times.
✓ Branch 1 taken 1938 times.
|
66844884 | else if(hp_mod[i] < hp_modtotal) |
| 7258 | { | ||
| 7259 | 1938 | hp_modtotal = hp_mod[i]; | |
| 7260 | 1938 | bestcid = cid[i]; | |
| 7261 | 1938 | best_rpos = rposes[i]; | |
| 7262 | 1938 | } | |
| 7263 | 104000584 | } | |
| 7264 | |||
| 7265 | 26000846 | int ffc_ids[] = {-1, -1, -1, -1}; | |
| 7266 | { | ||
| 7267 | 26000846 | auto ffc_handle = getFFCAt(dx1,dy1); | |
| 7268 |
2/2✓ Branch 0 taken 406718 times.
✓ Branch 1 taken 25594128 times.
|
26000846 | ffc_ids[0] = ffc_handle ? ffc_handle->id : -1; |
| 7269 |
2/2✓ Branch 0 taken 406718 times.
✓ Branch 1 taken 25594128 times.
|
26000846 | cid[4] = ffc_handle ? ffc_handle->data() : 0; |
| 7270 | 26000846 | newcombo& cmb = combobuf[cid[4]]; | |
| 7271 |
4/4✓ Branch 0 taken 26000651 times.
✓ Branch 1 taken 195 times.
✓ Branch 2 taken 26000602 times.
✓ Branch 3 taken 49 times.
|
26000846 | if ( !(cmb.only_gentrig) && combo_class_buf[cmb.type].modify_hp_amount) |
| 7272 | { | ||
| 7273 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 48 times.
|
49 | if(cmb.usrflags&cflag1 ) |
| 7274 | 1 | hp_mod[0] = cmb.attributes[0]/-10000L; | |
| 7275 | else | ||
| 7276 | 48 | hp_mod[0]=combo_class_buf[cmb.type].modify_hp_amount; | |
| 7277 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 49 times.
|
49 | if(!(cmb.usrflags&cflag2)) |
| 7278 | 49 | hasKB |= 1<<4; | |
| 7279 | 49 | } | |
| 7280 | } | ||
| 7281 | { | ||
| 7282 | 26000846 | auto ffc_handle = getFFCAt(dx1,dy2); | |
| 7283 |
2/2✓ Branch 0 taken 404097 times.
✓ Branch 1 taken 25596749 times.
|
26000846 | ffc_ids[1] = ffc_handle ? ffc_handle->id : -1; |
| 7284 |
2/2✓ Branch 0 taken 404097 times.
✓ Branch 1 taken 25596749 times.
|
26000846 | cid[5] = ffc_handle ? ffc_handle->data() : 0; |
| 7285 | 26000846 | newcombo& cmb = combobuf[cid[5]]; | |
| 7286 |
4/4✓ Branch 0 taken 26000642 times.
✓ Branch 1 taken 204 times.
✓ Branch 2 taken 26000597 times.
✓ Branch 3 taken 45 times.
|
26000846 | if ( !(cmb.only_gentrig) && combo_class_buf[cmb.type].modify_hp_amount) |
| 7287 | { | ||
| 7288 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 44 times.
|
45 | if(cmb.usrflags&cflag1 ) |
| 7289 | 1 | hp_mod[1] = cmb.attributes[0]/-10000L; | |
| 7290 | else | ||
| 7291 | 44 | hp_mod[1]=combo_class_buf[cmb.type].modify_hp_amount; | |
| 7292 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 45 times.
|
45 | if(!(cmb.usrflags&cflag2)) |
| 7293 | 45 | hasKB |= 1<<5; | |
| 7294 | 45 | } | |
| 7295 | } | ||
| 7296 | { | ||
| 7297 | 26000846 | auto ffc_handle = getFFCAt(dx2,dy1); | |
| 7298 |
2/2✓ Branch 0 taken 410802 times.
✓ Branch 1 taken 25590044 times.
|
26000846 | ffc_ids[2] = ffc_handle ? ffc_handle->id : -1; |
| 7299 |
2/2✓ Branch 0 taken 410802 times.
✓ Branch 1 taken 25590044 times.
|
26000846 | cid[6] = ffc_handle ? ffc_handle->data() : 0; |
| 7300 | 26000846 | newcombo& cmb = combobuf[cid[6]]; | |
| 7301 |
4/4✓ Branch 0 taken 26000654 times.
✓ Branch 1 taken 192 times.
✓ Branch 2 taken 26000606 times.
✓ Branch 3 taken 48 times.
|
26000846 | if ( !(cmb.only_gentrig) && combo_class_buf[cmb.type].modify_hp_amount) |
| 7302 | { | ||
| 7303 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 47 times.
|
48 | if(cmb.usrflags&cflag1 ) |
| 7304 | 1 | hp_mod[2] = cmb.attributes[0]/-10000L; | |
| 7305 | else | ||
| 7306 | 47 | hp_mod[2]=combo_class_buf[cmb.type].modify_hp_amount; | |
| 7307 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 48 times.
|
48 | if(!(cmb.usrflags&cflag2)) |
| 7308 | 48 | hasKB |= 1<<6; | |
| 7309 | 48 | } | |
| 7310 | } | ||
| 7311 | { | ||
| 7312 | 26000846 | auto ffc_handle = getFFCAt(dx2,dy2); | |
| 7313 |
2/2✓ Branch 0 taken 408139 times.
✓ Branch 1 taken 25592707 times.
|
26000846 | ffc_ids[3] = ffc_handle ? ffc_handle->id : -1; |
| 7314 |
2/2✓ Branch 0 taken 408139 times.
✓ Branch 1 taken 25592707 times.
|
26000846 | cid[7] = ffc_handle ? ffc_handle->data() : 0; |
| 7315 | 26000846 | newcombo& cmb = combobuf[cid[7]]; | |
| 7316 |
4/4✓ Branch 0 taken 26000645 times.
✓ Branch 1 taken 201 times.
✓ Branch 2 taken 26000599 times.
✓ Branch 3 taken 46 times.
|
26000846 | if ( !(cmb.only_gentrig) && combo_class_buf[cmb.type].modify_hp_amount) |
| 7317 | { | ||
| 7318 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 45 times.
|
46 | if(cmb.usrflags&cflag1 ) |
| 7319 | 1 | hp_mod[3] = cmb.attributes[0]/-10000L; | |
| 7320 | else | ||
| 7321 | 45 | hp_mod[3]=combo_class_buf[cmb.type].modify_hp_amount; | |
| 7322 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 46 times.
|
46 | if(!(cmb.usrflags&cflag2)) |
| 7323 | 46 | hasKB |= 1<<7; | |
| 7324 | 46 | } | |
| 7325 | } | ||
| 7326 | |||
| 7327 | 26000846 | int32_t bestffccid = 0; | |
| 7328 | 26000846 | int best_ffcid = -1; | |
| 7329 | 26000846 | int32_t hp_modtotalffc = 0; | |
| 7330 | |||
| 7331 |
2/2✓ Branch 0 taken 52001692 times.
✓ Branch 1 taken 26000846 times.
|
78002538 | for (int32_t i = 0; i <= 1; ++i) |
| 7332 | { | ||
| 7333 |
2/2✓ Branch 0 taken 44132314 times.
✓ Branch 1 taken 7869378 times.
|
52001692 | if (get_qr(qr_OLD_BRIDGE_COMBOS)) |
| 7334 | { | ||
| 7335 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 44132314 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
44132314 | if (combobuf[MAPCOMBO2(i,dx1,dy1)].type == cBRIDGE && !_walkflag_layer(dx1,dy1,i)) {hp_mod[0] = 0; hasKB &= ~(1<<4);} |
| 7336 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 44132314 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
44132314 | if (combobuf[MAPCOMBO2(i,dx1,dy2)].type == cBRIDGE && !_walkflag_layer(dx1,dy2,i)) {hp_mod[1] = 0; hasKB &= ~(1<<5);} |
| 7337 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 44132314 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
44132314 | if (combobuf[MAPCOMBO2(i,dx2,dy1)].type == cBRIDGE && !_walkflag_layer(dx2,dy1,i)) {hp_mod[2] = 0; hasKB &= ~(1<<6);} |
| 7338 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 44132314 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
44132314 | if (combobuf[MAPCOMBO2(i,dx2,dy2)].type == cBRIDGE && !_walkflag_layer(dx2,dy2,i)) {hp_mod[3] = 0; hasKB &= ~(1<<7);} |
| 7339 | 44132314 | } | |
| 7340 | else | ||
| 7341 | { | ||
| 7342 |
4/4✓ Branch 0 taken 16473 times.
✓ Branch 1 taken 7852905 times.
✓ Branch 2 taken 2538 times.
✓ Branch 3 taken 13935 times.
|
7869378 | if (combobuf[MAPCOMBO2(i,dx1,dy1)].type == cBRIDGE && _effectflag_layer(dx1,dy1,i)) {hp_mod[0] = 0; hasKB &= ~(1<<4);} |
| 7343 |
4/4✓ Branch 0 taken 16506 times.
✓ Branch 1 taken 7852872 times.
✓ Branch 2 taken 2598 times.
✓ Branch 3 taken 13908 times.
|
7869378 | if (combobuf[MAPCOMBO2(i,dx1,dy2)].type == cBRIDGE && _effectflag_layer(dx1,dy2,i)) {hp_mod[1] = 0; hasKB &= ~(1<<5);} |
| 7344 |
4/4✓ Branch 0 taken 16491 times.
✓ Branch 1 taken 7852887 times.
✓ Branch 2 taken 2622 times.
✓ Branch 3 taken 13869 times.
|
7869378 | if (combobuf[MAPCOMBO2(i,dx2,dy1)].type == cBRIDGE && _effectflag_layer(dx2,dy1,i)) {hp_mod[2] = 0; hasKB &= ~(1<<6);} |
| 7345 |
4/4✓ Branch 0 taken 16530 times.
✓ Branch 1 taken 7852848 times.
✓ Branch 2 taken 2685 times.
✓ Branch 3 taken 13845 times.
|
7869378 | if (combobuf[MAPCOMBO2(i,dx2,dy2)].type == cBRIDGE && _effectflag_layer(dx2,dy2,i)) {hp_mod[3] = 0; hasKB &= ~(1<<7);} |
| 7346 | } | ||
| 7347 | 52001692 | } | |
| 7348 | |||
| 7349 |
2/2✓ Branch 0 taken 104003384 times.
✓ Branch 1 taken 26000846 times.
|
130004230 | for(int32_t i=0; i<4; i++) |
| 7350 | { | ||
| 7351 |
2/2✓ Branch 0 taken 1629756 times.
✓ Branch 1 taken 102373628 times.
|
104003384 | if (ffc_ids[i] == -1) continue; |
| 7352 | |||
| 7353 |
2/2✓ Branch 0 taken 224165 times.
✓ Branch 1 taken 1405591 times.
|
1629756 | if(get_qr(qr_DMGCOMBOPRI)) |
| 7354 | { | ||
| 7355 |
2/2✓ Branch 0 taken 224049 times.
✓ Branch 1 taken 116 times.
|
224165 | if(hp_modtotalffc >= 0) |
| 7356 | { | ||
| 7357 |
2/2✓ Branch 0 taken 223984 times.
✓ Branch 1 taken 65 times.
|
224049 | if(hp_mod[i] < hp_modtotalffc) |
| 7358 | { | ||
| 7359 | 65 | hp_modtotalffc = hp_mod[i]; | |
| 7360 | 65 | bestffccid = cid[4+i]; | |
| 7361 | 65 | best_ffcid = ffc_ids[i]; | |
| 7362 | 65 | } | |
| 7363 | 224049 | } | |
| 7364 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 112 times.
|
116 | else if(hp_mod[i] < 0) |
| 7365 | { | ||
| 7366 |
1/2✓ Branch 0 taken 112 times.
✗ Branch 1 not taken.
|
112 | if(hp_mod[i] > hp_modtotalffc) |
| 7367 | { | ||
| 7368 | ✗ | hp_modtotalffc = hp_mod[i]; | |
| 7369 | ✗ | bestffccid = cid[4+i]; | |
| 7370 | ✗ | best_ffcid = ffc_ids[i]; | |
| 7371 | ✗ | } | |
| 7372 | 112 | } | |
| 7373 | 224165 | } | |
| 7374 |
2/2✓ Branch 0 taken 1405564 times.
✓ Branch 1 taken 27 times.
|
1405591 | else if(hp_mod[i] < hp_modtotalffc) |
| 7375 | { | ||
| 7376 | 27 | hp_modtotalffc = hp_mod[i]; | |
| 7377 | 27 | bestffccid = cid[4+i]; | |
| 7378 | 27 | best_ffcid = ffc_ids[i]; | |
| 7379 | 27 | } | |
| 7380 | 1629756 | } | |
| 7381 | |||
| 7382 | mapscr* damage_scr; | ||
| 7383 |
2/2✓ Branch 0 taken 2072 times.
✓ Branch 1 taken 25998774 times.
|
26000846 | int32_t hp_modmin = zc_min(hp_modtotal, hp_modtotalffc); |
| 7384 | 26000846 | int best_type = 0; | |
| 7385 |
2/2✓ Branch 0 taken 68 times.
✓ Branch 1 taken 26000778 times.
|
26000846 | if(hp_modtotalffc < hp_modtotal) |
| 7386 | { | ||
| 7387 | 68 | damage_scr = get_ffc_handle(best_ffcid).scr; | |
| 7388 | 68 | bestcid = bestffccid; | |
| 7389 | 68 | best_type = 1; | |
| 7390 | 68 | } | |
| 7391 | else | ||
| 7392 | { | ||
| 7393 | 26000778 | damage_scr = get_scr_for_rpos(best_rpos); | |
| 7394 | } | ||
| 7395 | |||
| 7396 | 26000846 | bool global_defring = ((itemsbuf[current_item_id(itype_ring)].flags & item_flag1)); | |
| 7397 | 26000846 | bool global_perilring = ((itemsbuf[current_item_id(itype_perilring)].flags & item_flag1)); | |
| 7398 | |||
| 7399 | 26000846 | bool current_ring = ((hero_scr->flags6&fTOGGLERINGDAMAGE) != 0); | |
| 7400 |
1/2✓ Branch 0 taken 26000846 times.
✗ Branch 1 not taken.
|
26000846 | if(current_ring) |
| 7401 | { | ||
| 7402 | ✗ | global_defring = !global_defring; | |
| 7403 | ✗ | global_perilring = !global_perilring; | |
| 7404 | ✗ | } | |
| 7405 | 26000846 | int32_t itemid = current_item_id(itype_boots); | |
| 7406 | |||
| 7407 |
2/2✓ Branch 0 taken 25018030 times.
✓ Branch 1 taken 982816 times.
|
26000846 | bool bootsnosolid = itemid >= 0 && 0 != (itemsbuf[itemid].flags & item_flag1); |
| 7408 |
2/2✓ Branch 0 taken 25018030 times.
✓ Branch 1 taken 982816 times.
|
26000846 | bool ignoreBoots = itemid >= 0 && (itemsbuf[itemid].flags & item_flag3); |
| 7409 | |||
| 7410 |
2/2✓ Branch 0 taken 25998692 times.
✓ Branch 1 taken 2154 times.
|
26000846 | if(hp_modmin<0) |
| 7411 | { | ||
| 7412 |
10/14✓ Branch 0 taken 1614 times.
✓ Branch 1 taken 540 times.
✓ Branch 2 taken 1614 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1614 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1614 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 5 times.
✓ Branch 9 taken 1609 times.
✓ Branch 10 taken 1614 times.
✓ Branch 11 taken 5 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 1614 times.
|
2154 | if((itemid<0) || ignoreBoots || (damage_scr->flags5&fDAMAGEWITHBOOTS) || (4<<current_item_power(itype_boots)<(abs(hp_modmin))) || (solid && bootsnosolid) || !(checkbunny(itemid) && checkmagiccost(itemid))) |
| 7413 | { | ||
| 7414 |
2/2✓ Branch 0 taken 544 times.
✓ Branch 1 taken 6 times.
|
550 | if (!do_health_check) return true; |
| 7415 | 544 | std::vector<int32_t> &ev = FFCore.eventData; | |
| 7416 | 544 | ev.clear(); | |
| 7417 | 544 | ev.push_back(-hp_modmin*10000); | |
| 7418 |
1/2✓ Branch 0 taken 544 times.
✗ Branch 1 not taken.
|
544 | ev.push_back((hasKB ? dir^1 : -1)*10000); |
| 7419 | 544 | ev.push_back(0); | |
| 7420 | 544 | ev.push_back(DivineProtectionShieldClk>0?10000:0); | |
| 7421 | 544 | ev.push_back(48*10000); | |
| 7422 | 544 | ev.push_back(ZSD_COMBODATA*10000); | |
| 7423 | 544 | ev.push_back(bestcid); | |
| 7424 | 544 | ev.push_back((best_type ? ZSD_FFC : ZSD_COMBOPOS)*10000); | |
| 7425 |
2/2✓ Branch 0 taken 68 times.
✓ Branch 1 taken 476 times.
|
544 | ev.push_back((best_type ? best_ffcid : (int)best_rpos)*10000); |
| 7426 | |||
| 7427 | 544 | throwGenScriptEvent(GENSCR_EVENT_HERO_HIT_1); | |
| 7428 | 544 | int32_t dmg = ev[0]/10000; | |
| 7429 | 544 | bool nullhit = ev[2] != 0; | |
| 7430 | |||
| 7431 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 544 times.
|
544 | if(nullhit) {ev.clear(); return false;} |
| 7432 | |||
| 7433 | //Args: 'damage (post-ring)','hitdir','nullifyhit','type:npc','npc uid' | ||
| 7434 | 544 | ev[0] = ringpower(dmg, !global_perilring, !global_defring)*10000; | |
| 7435 | |||
| 7436 | 544 | throwGenScriptEvent(GENSCR_EVENT_HERO_HIT_2); | |
| 7437 | 544 | dmg = ev[0]/10000; | |
| 7438 | 544 | int32_t hdir = ev[1]/10000; | |
| 7439 | 544 | nullhit = ev[2] != 0; | |
| 7440 | 544 | bool divineprot = ev[3] != 0; | |
| 7441 | 544 | int32_t iframes = ev[4] / 10000; | |
| 7442 | 544 | ev.clear(); | |
| 7443 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 544 times.
|
544 | if(nullhit) return false; |
| 7444 | |||
| 7445 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 544 times.
|
544 | if(!divineprot) |
| 7446 | { | ||
| 7447 |
2/2✓ Branch 0 taken 525 times.
✓ Branch 1 taken 19 times.
|
544 | game->set_life(zc_max(game->get_life()-dmg,0)); |
| 7448 | 544 | } | |
| 7449 | |||
| 7450 | 544 | hitdir = hdir; | |
| 7451 | 544 | doHit(hitdir, iframes); | |
| 7452 | 544 | return true; | |
| 7453 | } | ||
| 7454 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1614 times.
|
1614 | else if (do_health_check) paymagiccost(itemid); // Boots are successful |
| 7455 | 1614 | } | |
| 7456 | |||
| 7457 | 26000306 | return false; | |
| 7458 | 26003320 | } | |
| 7459 | |||
| 7460 | 31605 | int32_t HeroClass::hithero(int32_t hit2, int32_t force_hdir) | |
| 7461 | { | ||
| 7462 |
1/2✓ Branch 0 taken 31605 times.
✗ Branch 1 not taken.
|
31605 | if(force_hdir > 3) force_hdir = -1; |
| 7463 | 31605 | enemy* enemyptr = (enemy*)guys.spr(hit2); | |
| 7464 |
1/2✓ Branch 0 taken 31605 times.
✗ Branch 1 not taken.
|
31605 | if(!enemyptr) return 0; |
| 7465 | //printf("Stomp check: %d <= 12, %d < %d\n", int32_t((y+16)-(((enemy*)guys.spr(hit2))->y)), (int32_t)falling_oldy, (int32_t)y); | ||
| 7466 | 31605 | int32_t stompid = current_item_id(itype_stompboots); | |
| 7467 |
5/10✓ Branch 0 taken 17 times.
✓ Branch 1 taken 31588 times.
✓ Branch 2 taken 17 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 17 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 17 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
31605 | if(current_item(itype_stompboots) && checkbunny(stompid) && checkmagiccost(stompid) && (stomping || |
| 7468 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | ((z+fakez) > (enemyptr->z+(enemyptr->fakez))) || |
| 7469 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 17 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
17 | ((isSideViewHero() && (y+16)-(enemyptr->y)<=14) && falling_oldy<y))) |
| 7470 | { | ||
| 7471 | ✗ | paymagiccost(stompid); | |
| 7472 | ✗ | hit_enemy(hit2,wStomp,itemsbuf[stompid].power*game->get_hero_dmgmult(),x,y,0,stompid); | |
| 7473 | |||
| 7474 | ✗ | if(itemsbuf[stompid].flags & item_flag1) | |
| 7475 | { | ||
| 7476 | ✗ | fall = -(itemsbuf[stompid].misc1); | |
| 7477 | ✗ | } | |
| 7478 | |||
| 7479 | ✗ | if(itemsbuf[stompid].flags & item_downgrade) | |
| 7480 | ✗ | game->set_item(stompid,false); | |
| 7481 | |||
| 7482 | // Stomp Boots script | ||
| 7483 | ✗ | if(itemsbuf[stompid].script != 0 && !(FFCore.doscript(ScriptType::Item, stompid) && get_qr(qr_ITEMSCRIPTSKEEPRUNNING))) | |
| 7484 | { | ||
| 7485 | ✗ | int i = stompid; | |
| 7486 | ✗ | FFCore.reset_script_engine_data(ScriptType::Item, i); | |
| 7487 | ✗ | ZScriptVersion::RunScript(ScriptType::Item, itemsbuf[stompid].script, i); | |
| 7488 | ✗ | FFCore.deallocateAllScriptOwned(ScriptType::Item, i); | |
| 7489 | ✗ | } | |
| 7490 | |||
| 7491 | ✗ | return -1; | |
| 7492 | } | ||
| 7493 |
6/6✓ Branch 0 taken 27127 times.
✓ Branch 1 taken 4478 times.
✓ Branch 2 taken 26339 times.
✓ Branch 3 taken 788 times.
✓ Branch 4 taken 65 times.
✓ Branch 5 taken 26274 times.
|
31605 | else if(superman || !scriptcoldet || fallclk) |
| 7494 | 5331 | return 0; | |
| 7495 | //!TODO SOLIDPUSH Enemy flag to make them not deal contact damage | ||
| 7496 | //!Add a flag check to this if: | ||
| 7497 |
5/6✓ Branch 0 taken 9820 times.
✓ Branch 1 taken 16454 times.
✓ Branch 2 taken 9820 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3054 times.
✓ Branch 5 taken 6766 times.
|
26276 | else if (!(enemyptr->stunclk==0 && enemyptr->frozenclock==0 && (!get_qr(qr_SAFEENEMYFADE) || enemyptr->fading != fade_flicker) |
| 7498 |
4/4✓ Branch 0 taken 2800 times.
✓ Branch 1 taken 254 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 9564 times.
|
9820 | && (enemyptr->d->type != eeGUY || enemyptr->dmisc1))) |
| 7499 | { | ||
| 7500 | 16708 | return -1; | |
| 7501 | } | ||
| 7502 | |||
| 7503 | 9566 | std::vector<int32_t> &ev = FFCore.eventData; | |
| 7504 | 9566 | ev.clear(); | |
| 7505 | //Args: 'damage (pre-ring)','hitdir','nullifyhit','type:npc','npc uid' | ||
| 7506 | 9566 | ev.push_back((enemy_dp(hit2) *10000)); | |
| 7507 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9566 times.
|
9566 | ev.push_back((force_hdir>-1 ? force_hdir : ((sprite*)enemyptr)->hitdir(x,y,16,16,dir))*10000); |
| 7508 | 9566 | ev.push_back(0); | |
| 7509 | 9566 | ev.push_back(DivineProtectionShieldClk>0?10000:0); | |
| 7510 | 9566 | ev.push_back(48*10000); | |
| 7511 | 9566 | ev.push_back(ZSD_NPC*10000); | |
| 7512 | 9566 | ev.push_back(enemyptr->getUID()); | |
| 7513 | 9566 | ev.push_back(ZSD_NONE*10000); | |
| 7514 | 9566 | ev.push_back(0); | |
| 7515 | |||
| 7516 | 9566 | throwGenScriptEvent(GENSCR_EVENT_HERO_HIT_1); | |
| 7517 | 9566 | int32_t dmg = ev[0] / 10000; | |
| 7518 | 9566 | bool nullhit = ev[2] != 0; | |
| 7519 | |||
| 7520 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 9565 times.
|
9566 | if(nullhit) {ev.clear(); return -1;} |
| 7521 | |||
| 7522 | //Args: 'damage (post-ring)','hitdir','nullifyhit','type:npc','npc uid' | ||
| 7523 | 9565 | ev[0] = ((ringpower(dmg)*10000)); | |
| 7524 | |||
| 7525 | 9565 | throwGenScriptEvent(GENSCR_EVENT_HERO_HIT_2); | |
| 7526 | 9565 | dmg = ev[0] / 10000; | |
| 7527 | 9565 | int32_t hdir = ev[1] / 10000; | |
| 7528 | 9565 | nullhit = ev[2] != 0; | |
| 7529 | 9565 | bool divineprot = ev[3] != 0; | |
| 7530 | 9565 | int32_t iframes = ev[4] / 10000; | |
| 7531 | 9565 | ev.clear(); | |
| 7532 | |||
| 7533 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9565 times.
|
9565 | if(nullhit) return -1; |
| 7534 | |||
| 7535 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9565 times.
|
9565 | if(!divineprot) |
| 7536 | { | ||
| 7537 |
2/2✓ Branch 0 taken 9503 times.
✓ Branch 1 taken 62 times.
|
9565 | game->set_life(zc_max(game->get_life()-dmg,0)); |
| 7538 | 9565 | sethitHeroUID(HIT_BY_NPC,(hit2+1)); | |
| 7539 | 9565 | sethitHeroUID(HIT_BY_NPC_UID,enemyptr->getUID()); | |
| 7540 | 9565 | sethitHeroUID(HIT_BY_NPC_UID,enemyptr->getUID()); | |
| 7541 | 9565 | sethitHeroUID(HIT_BY_NPC_ENGINE_UID,enemyptr->getUID()); | |
| 7542 | 9565 | sethitHeroUID(HIT_BY_NPC_ID, enemyptr->id); | |
| 7543 | 9565 | sethitHeroUID(HIT_BY_NPC_TYPE, enemyptr->type); | |
| 7544 | 9565 | } | |
| 7545 | |||
| 7546 | 9565 | hitdir = hdir; | |
| 7547 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9565 times.
|
9565 | if (IsSideSwim()) |
| 7548 | { | ||
| 7549 | ✗ | action=sideswimhit; FFCore.setHeroAction(sideswimhit); | |
| 7550 | ✗ | } | |
| 7551 |
3/4✓ Branch 0 taken 9495 times.
✓ Branch 1 taken 70 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 9495 times.
|
9565 | else if(action==swimming || hopclk==0xFF) |
| 7552 | { | ||
| 7553 | 70 | action=swimhit; FFCore.setHeroAction(swimhit); | |
| 7554 | 70 | } | |
| 7555 | else | ||
| 7556 | { | ||
| 7557 | 9495 | action=gothit; FFCore.setHeroAction(gothit); | |
| 7558 | } | ||
| 7559 | |||
| 7560 | 9565 | hclk=iframes; | |
| 7561 | 9565 | check_on_hit(); | |
| 7562 | 9565 | sfx(getHurtSFX(),pan(x)); | |
| 7563 | |||
| 7564 |
8/8✓ Branch 0 taken 9536 times.
✓ Branch 1 taken 29 times.
✓ Branch 2 taken 9531 times.
✓ Branch 3 taken 5 times.
✓ Branch 4 taken 3894 times.
✓ Branch 5 taken 5637 times.
✓ Branch 6 taken 172 times.
✓ Branch 7 taken 3722 times.
|
9565 | if(charging > 0 || spins > 0 || attack == wSword || attack == wHammer) |
| 7565 | { | ||
| 7566 | 5843 | spins = charging = attackclk = 0; | |
| 7567 | 5843 | attack=none; | |
| 7568 | 5843 | tapping = false; | |
| 7569 | 5843 | } | |
| 7570 | |||
| 7571 | 9565 | enemy_scored(hit2); | |
| 7572 | 9565 | int32_t dm7 = enemyptr->dmisc7; | |
| 7573 | 9565 | int32_t dm8 = enemyptr->dmisc8; | |
| 7574 | |||
| 7575 |
3/3✓ Branch 0 taken 4680 times.
✓ Branch 1 taken 9 times.
✓ Branch 2 taken 4876 times.
|
9565 | switch(enemyptr->type) |
| 7576 | { | ||
| 7577 | case eeWALLM: | ||
| 7578 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
|
9 | if(enemyptr->hp>0) |
| 7579 | { | ||
| 7580 | 9 | GrabHero(hit2); | |
| 7581 | 9 | inwallm=true; | |
| 7582 | 9 | action=none; FFCore.setHeroAction(none); | |
| 7583 | 9 | } | |
| 7584 | 9 | break; | |
| 7585 | |||
| 7586 | //case eBUBBLEST: | ||
| 7587 | //case eeBUBBLE: | ||
| 7588 | case eeWALK: | ||
| 7589 | { | ||
| 7590 | 4876 | int32_t itemid = current_item_id(itype_whispring); | |
| 7591 | //I can only assume these are supposed to be int32_t, not bool ~pkmnfrk | ||
| 7592 |
3/4✓ Branch 0 taken 875 times.
✓ Branch 1 taken 4001 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 875 times.
|
4876 | int32_t sworddivisor = ((itemid>-1 && itemsbuf[itemid].misc1 & 1) ? itemsbuf[itemid].power : 1); |
| 7593 |
3/4✓ Branch 0 taken 875 times.
✓ Branch 1 taken 4001 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 875 times.
|
4876 | int32_t itemdivisor = ((itemid>-1 && itemsbuf[itemid].misc1 & 2) ? itemsbuf[itemid].power : 1); |
| 7594 |
3/4✓ Branch 0 taken 875 times.
✓ Branch 1 taken 4001 times.
✓ Branch 2 taken 875 times.
✗ Branch 3 not taken.
|
4876 | int32_t shielddivisor = ((itemid > -1 && itemsbuf[itemid].misc1 & 4) ? itemsbuf[itemid].power : 1); |
| 7595 |
7/7✓ Branch 0 taken 3989 times.
✓ Branch 1 taken 454 times.
✓ Branch 2 taken 145 times.
✓ Branch 3 taken 256 times.
✓ Branch 4 taken 5 times.
✓ Branch 5 taken 21 times.
✓ Branch 6 taken 6 times.
|
4876 | switch(dm7) |
| 7596 | { | ||
| 7597 | case e7tTEMPJINX: | ||
| 7598 |
2/2✓ Branch 0 taken 48 times.
✓ Branch 1 taken 406 times.
|
454 | if(dm8&e8tSWORD) |
| 7599 |
4/4✓ Branch 0 taken 395 times.
✓ Branch 1 taken 11 times.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 392 times.
|
798 | if(swordclk>=0 && !(sworddivisor==0)) |
| 7600 | 392 | swordclk=int32_t(150/sworddivisor); | |
| 7601 | |||
| 7602 |
2/2✓ Branch 0 taken 398 times.
✓ Branch 1 taken 56 times.
|
454 | if(dm8&e8tITEM) |
| 7603 |
3/4✓ Branch 0 taken 56 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 55 times.
|
111 | if(itemclk>=0 && !(itemdivisor==0)) |
| 7604 | 55 | itemclk=int32_t(150/itemdivisor); | |
| 7605 | |||
| 7606 |
1/2✓ Branch 0 taken 454 times.
✗ Branch 1 not taken.
|
454 | if(dm8&e8tSHIELD) |
| 7607 | ✗ | if (shieldjinxclk >= 0 && !(shielddivisor==0)) | |
| 7608 | ✗ | shieldjinxclk=int32_t(150/shielddivisor); | |
| 7609 | |||
| 7610 | 454 | break; | |
| 7611 | |||
| 7612 | case e7tPERMJINX: | ||
| 7613 |
2/2✓ Branch 0 taken 46 times.
✓ Branch 1 taken 99 times.
|
145 | if (dm8&e8tSWORD) |
| 7614 |
4/6✗ Branch 0 not taken.
✓ Branch 1 taken 99 times.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 93 times.
✓ Branch 4 taken 6 times.
✗ Branch 5 not taken.
|
99 | if(sworddivisor) swordclk=(itemid >-1 && itemsbuf[itemid].flags & item_flag1)? int32_t(150/sworddivisor) : -1; |
| 7615 | |||
| 7616 |
2/2✓ Branch 0 taken 99 times.
✓ Branch 1 taken 46 times.
|
145 | if (dm8&e8tITEM) |
| 7617 |
4/6✗ Branch 0 not taken.
✓ Branch 1 taken 46 times.
✓ Branch 2 taken 10 times.
✓ Branch 3 taken 36 times.
✓ Branch 4 taken 10 times.
✗ Branch 5 not taken.
|
46 | if(itemdivisor) itemclk=(itemid >-1 && itemsbuf[itemid].flags & item_flag1)? int32_t(150/itemdivisor) : -1; |
| 7618 | |||
| 7619 |
1/2✓ Branch 0 taken 145 times.
✗ Branch 1 not taken.
|
145 | if (dm8&e8tSHIELD) |
| 7620 | ✗ | if(shielddivisor) shieldjinxclk=(itemid >-1 && itemsbuf[itemid].flags & item_flag1)? int32_t(150/shielddivisor) : -1; | |
| 7621 | |||
| 7622 | 145 | break; | |
| 7623 | |||
| 7624 | case e7tUNJINX: | ||
| 7625 |
2/2✓ Branch 0 taken 57 times.
✓ Branch 1 taken 199 times.
|
256 | if (dm8&e8tSWORD) |
| 7626 | 199 | swordclk=0; | |
| 7627 | |||
| 7628 |
2/2✓ Branch 0 taken 180 times.
✓ Branch 1 taken 76 times.
|
256 | if (dm8&e8tITEM) |
| 7629 | 76 | itemclk=0; | |
| 7630 | |||
| 7631 |
1/2✓ Branch 0 taken 256 times.
✗ Branch 1 not taken.
|
256 | if (dm8&e8tSHIELD) |
| 7632 | ✗ | shieldjinxclk=0; | |
| 7633 | |||
| 7634 | 256 | break; | |
| 7635 | |||
| 7636 | case e7tTAKEMAGIC: | ||
| 7637 | 5 | game->change_dmagic(-dm8*game->get_magicdrainrate()); | |
| 7638 | 5 | break; | |
| 7639 | |||
| 7640 | case e7tTAKERUPEES: | ||
| 7641 | 21 | game->change_drupy(-dm8); | |
| 7642 | 21 | break; | |
| 7643 | |||
| 7644 | case e7tDRUNK: | ||
| 7645 | 6 | drunkclk += dm8; | |
| 7646 | 6 | break; | |
| 7647 | } | ||
| 7648 | 4876 | verifyAWpn(); | |
| 7649 |
2/2✓ Branch 0 taken 4733 times.
✓ Branch 1 taken 143 times.
|
4876 | if(dm7 >= e7tEATITEMS) |
| 7650 | { | ||
| 7651 | 143 | EatHero(hit2); | |
| 7652 | 143 | inlikelike=(dm7 == e7tEATHURT ? 2:1); | |
| 7653 | 143 | action=none; FFCore.setHeroAction(none); | |
| 7654 | 143 | } | |
| 7655 | } | ||
| 7656 | 4876 | } | |
| 7657 | 9565 | return 0; | |
| 7658 | 31605 | } | |
| 7659 | |||
| 7660 | 538368 | void HeroClass::addsparkle(int32_t wpn) | |
| 7661 | { | ||
| 7662 | //return; | ||
| 7663 | 538368 | weapon *w = (weapon*)Lwpns.spr(wpn); | |
| 7664 | 538368 | int32_t itemid = w->parentitem; | |
| 7665 | |||
| 7666 |
2/2✓ Branch 0 taken 522266 times.
✓ Branch 1 taken 16102 times.
|
538368 | if(itemid<0) |
| 7667 | 16102 | return; | |
| 7668 | |||
| 7669 | 522266 | int32_t itemtype = itemsbuf[itemid].type; | |
| 7670 | |||
| 7671 |
4/4✓ Branch 0 taken 522193 times.
✓ Branch 1 taken 73 times.
✓ Branch 2 taken 130571 times.
✓ Branch 3 taken 391622 times.
|
522266 | if(itemtype!=itype_cbyrna && frame%4) |
| 7672 | 391622 | return; | |
| 7673 | |||
| 7674 |
2/2✓ Branch 0 taken 73 times.
✓ Branch 1 taken 130571 times.
|
130644 | int32_t wpn2 = (itemtype==itype_cbyrna) ? itemsbuf[itemid].wpn4 : itemsbuf[itemid].wpn2; |
| 7675 |
2/2✓ Branch 0 taken 73 times.
✓ Branch 1 taken 130571 times.
|
130644 | int32_t wpn3 = (itemtype==itype_cbyrna) ? itemsbuf[itemid].wpn5 : itemsbuf[itemid].wpn3; |
| 7676 | // Either one (wpn2) or the other (wpn3). If both are present, randomise. | ||
| 7677 |
5/8✓ Branch 0 taken 37818 times.
✓ Branch 1 taken 92826 times.
✓ Branch 2 taken 72536 times.
✓ Branch 3 taken 20290 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 37818 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
130644 | int32_t sparkle_type = (!wpn2 ? (!wpn3 ? 0 : wpn3) : (!wpn3 ? wpn2 : (zc_oldrand()&1 ? wpn2 : wpn3))); |
| 7678 | 130644 | int32_t direction=w->dir; | |
| 7679 | |||
| 7680 |
2/2✓ Branch 0 taken 72536 times.
✓ Branch 1 taken 58108 times.
|
130644 | if(sparkle_type) |
| 7681 | { | ||
| 7682 | 58108 | int32_t h=0; | |
| 7683 | 58108 | int32_t v=0; | |
| 7684 | |||
| 7685 |
6/6✓ Branch 0 taken 45868 times.
✓ Branch 1 taken 12240 times.
✓ Branch 2 taken 40776 times.
✓ Branch 3 taken 5092 times.
✓ Branch 4 taken 7701 times.
✓ Branch 5 taken 33075 times.
|
58108 | if(w->dir==right||w->dir==r_up||w->dir==r_down) |
| 7686 | { | ||
| 7687 | 25033 | h=-1; | |
| 7688 | 25033 | } | |
| 7689 | |||
| 7690 |
6/6✓ Branch 0 taken 46277 times.
✓ Branch 1 taken 11831 times.
✓ Branch 2 taken 39583 times.
✓ Branch 3 taken 6694 times.
✓ Branch 4 taken 5719 times.
✓ Branch 5 taken 33864 times.
|
58108 | if(w->dir==left||w->dir==l_up||w->dir==l_down) |
| 7691 | { | ||
| 7692 | 24244 | h=1; | |
| 7693 | 24244 | } | |
| 7694 | |||
| 7695 |
6/6✓ Branch 0 taken 54209 times.
✓ Branch 1 taken 3899 times.
✓ Branch 2 taken 48490 times.
✓ Branch 3 taken 5719 times.
✓ Branch 4 taken 7701 times.
✓ Branch 5 taken 40789 times.
|
58108 | if(w->dir==down||w->dir==l_down||w->dir==r_down) |
| 7696 | { | ||
| 7697 | 17319 | v=-1; | |
| 7698 | 17319 | } | |
| 7699 | |||
| 7700 |
6/6✓ Branch 0 taken 53176 times.
✓ Branch 1 taken 4932 times.
✓ Branch 2 taken 46482 times.
✓ Branch 3 taken 6694 times.
✓ Branch 4 taken 5092 times.
✓ Branch 5 taken 41390 times.
|
58108 | if(w->dir==up||w->dir==l_up||w->dir==r_up) |
| 7701 | { | ||
| 7702 | 16718 | v=1; | |
| 7703 | 16718 | } | |
| 7704 | |||
| 7705 | // Damaging boomerang sparkle? | ||
| 7706 |
3/4✓ Branch 0 taken 20290 times.
✓ Branch 1 taken 37818 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 20290 times.
|
58108 | if(wpn3 && itemtype==itype_brang) |
| 7707 | { | ||
| 7708 | // If the boomerang just bounced, flip the sparkle direction so it doesn't hit | ||
| 7709 | // whatever it just bounced off of if it's shielded from that direction. | ||
| 7710 |
6/6✓ Branch 0 taken 13240 times.
✓ Branch 1 taken 7050 times.
✓ Branch 2 taken 12389 times.
✓ Branch 3 taken 851 times.
✓ Branch 4 taken 5382 times.
✓ Branch 5 taken 7007 times.
|
20290 | if(w->misc==1 && w->clk2>256 && w->clk2<272) |
| 7711 | 7007 | direction=oppositeDir[direction]; | |
| 7712 | 20290 | } | |
| 7713 |
4/4✓ Branch 0 taken 53757 times.
✓ Branch 1 taken 4351 times.
✓ Branch 2 taken 24015 times.
✓ Branch 3 taken 29742 times.
|
58108 | if(itemtype==itype_brang && get_qr(qr_WRONG_BRANG_TRAIL_DIR)) direction = 0; |
| 7714 |
2/2✓ Branch 0 taken 73 times.
✓ Branch 1 taken 58035 times.
|
58108 | zfix x = w->x+(itemtype==itype_cbyrna ? 2 : zc_oldrand()%4)+(h*4); |
| 7715 |
2/2✓ Branch 0 taken 73 times.
✓ Branch 1 taken 58035 times.
|
58108 | zfix y = w->y+(itemtype==itype_cbyrna ? 2 : zc_oldrand()%4)+(v*4)-w->fakez; |
| 7716 |
5/10✓ Branch 0 taken 58108 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 58108 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 58108 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 58108 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 58108 times.
✗ Branch 9 not taken.
|
58108 | Lwpns.add(new weapon(x, y, w->z, sparkle_type==wpn3 ? wFSparkle : wSSparkle,sparkle_type,0,direction,itemid,getUID(),false,false,true, 0, sparkle_type)); |
| 7717 | 58108 | weapon *w = (weapon*)(Lwpns.spr(Lwpns.Count()-1)); | |
| 7718 | 58108 | } | |
| 7719 | 538368 | } | |
| 7720 | |||
| 7721 | // For wPhantoms | ||
| 7722 | 7410 | void HeroClass::addsparkle2(int32_t type1, int32_t type2) | |
| 7723 | { | ||
| 7724 |
2/2✓ Branch 0 taken 5586 times.
✓ Branch 1 taken 1824 times.
|
7410 | if(frame%4) return; |
| 7725 | |||
| 7726 | 1824 | int32_t arrow = -1; | |
| 7727 | |||
| 7728 |
2/2✓ Branch 0 taken 1520 times.
✓ Branch 1 taken 10041 times.
|
11561 | for(int32_t i=0; i<Lwpns.Count(); i++) |
| 7729 | { | ||
| 7730 | 10041 | weapon *w = (weapon*)Lwpns.spr(i); | |
| 7731 | |||
| 7732 |
4/4✓ Branch 0 taken 6249 times.
✓ Branch 1 taken 3792 times.
✓ Branch 2 taken 5945 times.
✓ Branch 3 taken 304 times.
|
10041 | if(w->id == wPhantom && w->level == type1) |
| 7733 | { | ||
| 7734 | 304 | arrow = i; | |
| 7735 | 304 | break; | |
| 7736 | } | ||
| 7737 | 9737 | } | |
| 7738 | |||
| 7739 |
2/2✓ Branch 0 taken 304 times.
✓ Branch 1 taken 1520 times.
|
1824 | if(arrow==-1) |
| 7740 | { | ||
| 7741 | 1520 | return; | |
| 7742 | } | ||
| 7743 | |||
| 7744 | 304 | zfix x = (Lwpns.spr(arrow)->x-3)+(zc_oldrand()%7); | |
| 7745 | 304 | zfix y = (Lwpns.spr(arrow)->y-3)+(zc_oldrand()%7)-Lwpns.spr(arrow)->fakez; | |
| 7746 |
6/12✓ Branch 0 taken 304 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 304 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 304 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 304 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 304 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 304 times.
✗ Branch 11 not taken.
|
304 | Lwpns.add(new weapon(x, y, Lwpns.spr(arrow)->z, wPhantom, type2,0,0,((weapon*)Lwpns.spr(arrow))->parentitem,-1)); |
| 7747 | 7410 | } | |
| 7748 | |||
| 7749 | //cleans up decorations that exit the bounds of the screen for a int32_t time, to prevebt them wrapping around. | ||
| 7750 | 14835443 | void HeroClass::PhantomsCleanup() | |
| 7751 | { | ||
| 7752 |
2/2✓ Branch 0 taken 6626385 times.
✓ Branch 1 taken 14835443 times.
|
21461828 | for(int32_t i=0; i<Lwpns.Count(); i++) |
| 7753 | { | ||
| 7754 | 6626385 | weapon *w = ((weapon *)Lwpns.spr(i)); | |
| 7755 |
3/4✓ Branch 0 taken 4869 times.
✓ Branch 1 taken 6621516 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4869 times.
|
6626385 | if ( w->id == wPhantom && !w->isScriptGenerated() ) |
| 7756 | { | ||
| 7757 |
4/8✓ Branch 0 taken 4869 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4869 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 4869 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 4869 times.
|
4869 | if ( w->x < -10000 || w->y > 10000 || w->x < -10000 || w->y > 10000 ) |
| 7758 | { | ||
| 7759 | ✗ | Lwpns.remove(w); | |
| 7760 | ✗ | } | |
| 7761 | 4869 | } | |
| 7762 | 6626385 | } | |
| 7763 | 14835443 | } | |
| 7764 | |||
| 7765 | //Waitframe handler for refilling operations | ||
| 7766 | 6288 | static void do_refill_waitframe() | |
| 7767 | { | ||
| 7768 | 6288 | put_passive_subscr(framebuf,0,0,game->should_show_time(),sspUP); | |
| 7769 |
1/2✓ Branch 0 taken 6288 times.
✗ Branch 1 not taken.
|
6288 | if(get_qr(qr_PASSIVE_SUBSCRIPT_RUNS_WHEN_GAME_IS_FROZEN)) |
| 7770 | { | ||
| 7771 | ✗ | script_drawing_commands.Clear(); | |
| 7772 | ✗ | if(DMaps[cur_dmap].passive_sub_script != 0) | |
| 7773 | ✗ | ZScriptVersion::RunScript(ScriptType::ScriptedPassiveSubscreen, DMaps[cur_dmap].passive_sub_script, cur_dmap); | |
| 7774 | |||
| 7775 | ✗ | if (FFCore.waitdraw(ScriptType::ScriptedPassiveSubscreen) && DMaps[cur_dmap].passive_sub_script != 0 && FFCore.doscript(ScriptType::ScriptedPassiveSubscreen)) | |
| 7776 | { | ||
| 7777 | ✗ | ZScriptVersion::RunScript(ScriptType::ScriptedPassiveSubscreen, DMaps[cur_dmap].passive_sub_script, cur_dmap); | |
| 7778 | ✗ | FFCore.waitdraw(ScriptType::ScriptedPassiveSubscreen) = false; | |
| 7779 | ✗ | } | |
| 7780 | ✗ | do_script_draws(framebuf, origin_scr, 0, playing_field_offset); | |
| 7781 | ✗ | } | |
| 7782 | 6288 | advanceframe(true); | |
| 7783 | 6288 | } | |
| 7784 | //Special handler if it's a "fairy revive" | ||
| 7785 | ✗ | static void do_death_refill_waitframe() | |
| 7786 | { | ||
| 7787 | //!TODO Run a new script slot each frame here, before calling do_refill_waitframe() | ||
| 7788 | //This script should be able to draw a 'fairy saving the player' animation -Em | ||
| 7789 | ✗ | do_refill_waitframe(); | |
| 7790 | ✗ | } | |
| 7791 | |||
| 7792 | 1 | static size_t find_bottle_for_slot(size_t slot, bool unowned=false) | |
| 7793 | { | ||
| 7794 | 1 | int32_t found_unowned = -1; | |
| 7795 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 153 times.
|
153 | for(int q = 0; q < MAXITEMS; ++q) |
| 7796 | { | ||
| 7797 |
3/4✓ Branch 0 taken 1 times.
✓ Branch 1 taken 152 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
|
153 | if(itemsbuf[q].type == itype_bottle && itemsbuf[q].misc1 == slot) |
| 7798 | { | ||
| 7799 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | if(game->get_item(q)) |
| 7800 | 1 | return q; | |
| 7801 | ✗ | if(unowned) | |
| 7802 | ✗ | found_unowned = q; | |
| 7803 | ✗ | } | |
| 7804 | 152 | } | |
| 7805 | ✗ | return found_unowned; | |
| 7806 | 1 | } | |
| 7807 | |||
| 7808 | ✗ | int32_t getPushDir(int32_t flag) | |
| 7809 | { | ||
| 7810 | ✗ | switch(flag) | |
| 7811 | { | ||
| 7812 | case mfPUSHUD: case mfPUSH4: case mfPUSHU: case mfPUSHUDNS: | ||
| 7813 | case mfPUSH4NS: case mfPUSHUNS: case mfPUSHUDINS: case mfPUSH4INS: | ||
| 7814 | case mfPUSHUINS: | ||
| 7815 | ✗ | return up; | |
| 7816 | case mfPUSHD: case mfPUSHDNS: case mfPUSHDINS: | ||
| 7817 | ✗ | return down; | |
| 7818 | case mfPUSHLR: case mfPUSHL: case mfPUSHLRNS: case mfPUSHLNS: | ||
| 7819 | case mfPUSHLRINS: case mfPUSHLINS: | ||
| 7820 | ✗ | return left; | |
| 7821 | case mfPUSHR: case mfPUSHRNS: case mfPUSHRINS: | ||
| 7822 | ✗ | return right; | |
| 7823 | } | ||
| 7824 | ✗ | return -1; | |
| 7825 | ✗ | } | |
| 7826 | |||
| 7827 | void post_item_collect(); | ||
| 7828 | |||
| 7829 | 14837096 | bool HeroClass::handle_portal_collide(portal* p) | |
| 7830 | { | ||
| 7831 |
1/2✓ Branch 0 taken 14837096 times.
✗ Branch 1 not taken.
|
14837096 | if(!p) return false; |
| 7832 | 14837096 | p->animate(0); | |
| 7833 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 14837096 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
14837096 | if(p->destdmap < 0 || p->destdmap >= MAXDMAPS) |
| 7834 | 14837096 | return false; | |
| 7835 | ✗ | if(abs(x - p->x) < 12 | |
| 7836 | ✗ | && abs(y - p->y) < 12) | |
| 7837 | { | ||
| 7838 | ✗ | if(p->prox_active) | |
| 7839 | { | ||
| 7840 | //Store some values to restore if 'warp fails' | ||
| 7841 | ✗ | int32_t tLastEntrance = lastentrance, | |
| 7842 | ✗ | tLastEntranceDMap = lastentrance_dmap, | |
| 7843 | ✗ | tContScr = game->get_continue_scrn(), | |
| 7844 | ✗ | tContDMap = game->get_continue_dmap(); | |
| 7845 | ✗ | int32_t sourcescr = cur_screen, sourcedmap = cur_dmap; | |
| 7846 | ✗ | zfix tx = x, ty = y, tz = z; | |
| 7847 | ✗ | x = p->x; | |
| 7848 | ✗ | y = p->y; | |
| 7849 | |||
| 7850 | ✗ | int32_t weff = p->weffect, | |
| 7851 | ✗ | wsfx = p->wsfx; | |
| 7852 | |||
| 7853 | ✗ | int32_t savep = p->saved_data; | |
| 7854 | //After this line, 'p' becomes INVALID! | ||
| 7855 | ✗ | FFCore.warp_player(wtIWARP, p->destdmap, p->destscr, | |
| 7856 | ✗ | -1, -1, weff, wsfx, 0, -1); | |
| 7857 | |||
| 7858 | ✗ | if(mirrorBonk()) //Invalid landing, warp back! | |
| 7859 | { | ||
| 7860 | ✗ | action = none; FFCore.setHeroAction(none); | |
| 7861 | ✗ | lastentrance = tLastEntrance; | |
| 7862 | ✗ | lastentrance_dmap = tLastEntranceDMap; | |
| 7863 | ✗ | game->set_continue_scrn(tContScr); | |
| 7864 | ✗ | game->set_continue_dmap(tContDMap); | |
| 7865 | ✗ | x = tx; | |
| 7866 | ✗ | y = ty; | |
| 7867 | ✗ | z = tz; | |
| 7868 | ✗ | FFCore.warp_player(wtIWARP, sourcedmap, sourcescr, -1, -1, weff, | |
| 7869 | ✗ | wsfx, 0, -1); | |
| 7870 | ✗ | handle_portal_prox(&mirror_portal); | |
| 7871 | ✗ | portals.forEach([&](sprite& p) | |
| 7872 | { | ||
| 7873 | ✗ | handle_portal_prox((portal*)&p); | |
| 7874 | ✗ | return false; | |
| 7875 | }); | ||
| 7876 | ✗ | } | |
| 7877 | ✗ | else game->clear_portal(savep); //Remove portal once used | |
| 7878 | ✗ | return true; | |
| 7879 | } | ||
| 7880 | ✗ | } | |
| 7881 | ✗ | else p->prox_active = true; | |
| 7882 | ✗ | return false; | |
| 7883 | 14837096 | } | |
| 7884 | 181 | void HeroClass::handle_portal_prox(portal* p) | |
| 7885 | { | ||
| 7886 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 181 times.
|
181 | if(!p) return; |
| 7887 |
2/2✓ Branch 0 taken 156 times.
✓ Branch 1 taken 25 times.
|
181 | p->prox_active = !(abs(x - p->x) < 12 && abs(y - p->y) < 12); |
| 7888 | 181 | } | |
| 7889 | // returns true when game over | ||
| 7890 | 14875822 | bool HeroClass::animate(int32_t) | |
| 7891 | { | ||
| 7892 | 14875822 | update_current_screen(); | |
| 7893 | |||
| 7894 | 14875822 | int32_t lsave=0; | |
| 7895 |
1/2✓ Branch 0 taken 14875822 times.
✗ Branch 1 not taken.
|
14875822 | if(immortal > 0) |
| 7896 | ✗ | --immortal; | |
| 7897 | 14875822 | prompt_combo = 0; | |
| 7898 |
2/2✓ Branch 0 taken 39349 times.
✓ Branch 1 taken 14836473 times.
|
14875822 | if (onpassivedmg) |
| 7899 | { | ||
| 7900 | 39349 | onpassivedmg=false; | |
| 7901 | 39349 | } | |
| 7902 |
2/2✓ Branch 0 taken 14836468 times.
✓ Branch 1 taken 5 times.
|
14836473 | else if (damageovertimeclk) |
| 7903 | { | ||
| 7904 | 5 | damageovertimeclk = 0; | |
| 7905 | 5 | } | |
| 7906 | |||
| 7907 |
2/2✓ Branch 0 taken 14865416 times.
✓ Branch 1 taken 10406 times.
|
14875822 | if(lift_wpn) |
| 7908 | { | ||
| 7909 | 10406 | auto oldid = lift_wpn->id; | |
| 7910 |
2/2✓ Branch 0 taken 923 times.
✓ Branch 1 taken 9483 times.
|
10406 | switch(lift_wpn->id) |
| 7911 | { | ||
| 7912 | case wLitBomb: | ||
| 7913 | case wBomb: | ||
| 7914 | case wLitSBomb: | ||
| 7915 | case wSBomb: | ||
| 7916 |
2/4✓ Branch 0 taken 923 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 923 times.
|
923 | if(lift_wpn->misc && get_qr(qr_HELD_BOMBS_EXPLODE)) //timed fuse |
| 7917 | { | ||
| 7918 | 923 | lift_wpn->limited_animate(); | |
| 7919 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 923 times.
|
923 | if(lift_wpn->id != oldid) |
| 7920 | { | ||
| 7921 | ✗ | lift_wpn->moveflags &= ~move_obeys_grav; | |
| 7922 | ✗ | drop_liftwpn(); | |
| 7923 | ✗ | goto heroanimate_skip_liftwpn; | |
| 7924 | } | ||
| 7925 | 923 | ++lift_wpn->clk; | |
| 7926 | 923 | } | |
| 7927 | 923 | break; | |
| 7928 | } | ||
| 7929 |
1/2✓ Branch 0 taken 10406 times.
✗ Branch 1 not taken.
|
10406 | if(lift_wpn->dead>0) |
| 7930 | ✗ | --lift_wpn->dead; | |
| 7931 | |||
| 7932 |
1/2✓ Branch 0 taken 10406 times.
✗ Branch 1 not taken.
|
10406 | if(get_qr(qr_LIFTED_WEAPONS_RUN_SCRIPTS)) |
| 7933 | ✗ | lift_wpn->run_script(MODE_NORMAL); | |
| 7934 | |||
| 7935 |
1/2✓ Branch 0 taken 10406 times.
✗ Branch 1 not taken.
|
10406 | if(lift_wpn->dead==0) |
| 7936 | { | ||
| 7937 | ✗ | if(lift_wpn->death_spawnitem > -1) | |
| 7938 | { | ||
| 7939 | ✗ | item* itm = (new item(lift_wpn->x, lift_wpn->y, lift_wpn->z, lift_wpn->death_spawnitem, lift_wpn->death_item_pflags, 0)); | |
| 7940 | ✗ | itm->fakez = lift_wpn->fakez; | |
| 7941 | ✗ | items.add(itm); | |
| 7942 | ✗ | } | |
| 7943 | ✗ | if(lift_wpn->death_spawndropset > -1) | |
| 7944 | { | ||
| 7945 | ✗ | auto itid = select_dropitem(lift_wpn->death_spawndropset); | |
| 7946 | ✗ | if(itid > -1) | |
| 7947 | { | ||
| 7948 | ✗ | item* itm = (new item(lift_wpn->x, lift_wpn->y, lift_wpn->z, itid, lift_wpn->death_item_pflags, 0)); | |
| 7949 | ✗ | itm->fakez = lift_wpn->fakez; | |
| 7950 | ✗ | itm->from_dropset = lift_wpn->death_spawndropset; | |
| 7951 | ✗ | items.add(itm); | |
| 7952 | ✗ | } | |
| 7953 | ✗ | } | |
| 7954 | ✗ | switch(lift_wpn->death_sprite) | |
| 7955 | { | ||
| 7956 | ✗ | case -2: decorations.add(new dBushLeaves(lift_wpn->x, lift_wpn->y-(lift_wpn->z+lift_wpn->fakez), dBUSHLEAVES, 0, 0)); break; | |
| 7957 | ✗ | case -3: decorations.add(new dFlowerClippings(lift_wpn->x, lift_wpn->y-(lift_wpn->z+lift_wpn->fakez), dFLOWERCLIPPINGS, 0, 0)); break; | |
| 7958 | ✗ | case -4: decorations.add(new dGrassClippings(lift_wpn->x, lift_wpn->y-(lift_wpn->z+lift_wpn->fakez), dGRASSCLIPPINGS, 0, 0)); break; | |
| 7959 | default: | ||
| 7960 | ✗ | if(lift_wpn->death_sprite < 0) break; | |
| 7961 | ✗ | decorations.add(new comboSprite(lift_wpn->x, lift_wpn->y-(lift_wpn->z+lift_wpn->fakez), dCOMBOSPRITE, 0, lift_wpn->death_sprite)); | |
| 7962 | ✗ | } | |
| 7963 | ✗ | if(lift_wpn->death_sfx > 0) | |
| 7964 | ✗ | sfx(lift_wpn->death_sfx, pan(int32_t(lift_wpn->x))); | |
| 7965 | ✗ | delete lift_wpn; | |
| 7966 | ✗ | lift_wpn = nullptr; | |
| 7967 | ✗ | } | |
| 7968 | heroanimate_skip_liftwpn:; | ||
| 7969 | 10406 | } | |
| 7970 | |||
| 7971 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14875822 times.
|
14875822 | if(cheats_execute_goto) |
| 7972 | { | ||
| 7973 | ✗ | setpit(); | |
| 7974 | ✗ | dowarp(hero_scr, 3, 0); | |
| 7975 | ✗ | cheats_execute_goto=false; | |
| 7976 | ✗ | solid_update(false); | |
| 7977 | ✗ | return false; | |
| 7978 | } | ||
| 7979 | |||
| 7980 |
1/2✓ Branch 0 taken 14875822 times.
✗ Branch 1 not taken.
|
14875822 | if(cheats_execute_light) |
| 7981 | { | ||
| 7982 | ✗ | toggle_lights(pal_litOVERRIDE); //Forcibly set permLit, overriding its current setting | |
| 7983 | ✗ | cheats_execute_light = false; | |
| 7984 | ✗ | } | |
| 7985 | |||
| 7986 |
3/4✓ Branch 0 taken 14837096 times.
✓ Branch 1 taken 38726 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 14837096 times.
|
14875822 | if(action!=climbcovertop&&action!=climbcoverbottom) |
| 7987 | { | ||
| 7988 | 14837096 | climb_cover_x=-1000; | |
| 7989 | 14837096 | climb_cover_y=-1000; | |
| 7990 | 14837096 | } | |
| 7991 | |||
| 7992 | 14875822 | handle_portal_collide(&mirror_portal); | |
| 7993 |
1/2✓ Branch 0 taken 14875822 times.
✗ Branch 1 not taken.
|
14875822 | portals.forEach([&](sprite& p) |
| 7994 | { | ||
| 7995 | ✗ | return handle_portal_collide((portal*)&p); | |
| 7996 | }); | ||
| 7997 | |||
| 7998 |
3/4✓ Branch 0 taken 14819782 times.
✓ Branch 1 taken 56040 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 14819782 times.
|
14875822 | if(z<=8&&fakez<=8) //Tall Grass |
| 7999 | { | ||
| 8000 | 14819782 | int maxlyr = get_qr(qr_BUSHESONLAYERS1AND2) ? 2 : 0; | |
| 8001 |
2/2✓ Branch 0 taken 634672 times.
✓ Branch 1 taken 14185110 times.
|
14819782 | if (get_qr(qr_GRASS_SENSITIVE)) |
| 8002 | { | ||
| 8003 | 634672 | bool g1 = false, g2 = false, g3 = false, g4 = false; | |
| 8004 |
2/2✓ Branch 0 taken 1820954 times.
✓ Branch 1 taken 634672 times.
|
2455626 | for(int q = maxlyr; q >= 0; --q) |
| 8005 | { | ||
| 8006 |
2/2✓ Branch 0 taken 2282 times.
✓ Branch 1 taken 1818672 times.
|
1820954 | g1 = g1 || isGrassType(combobuf[MAPCOMBO2(q-1,x+4,y+15)].type); |
| 8007 |
2/2✓ Branch 0 taken 2251 times.
✓ Branch 1 taken 1818703 times.
|
1820954 | g2 = g2 || isGrassType(combobuf[MAPCOMBO2(q-1,x+11,y+15)].type); |
| 8008 |
2/2✓ Branch 0 taken 2323 times.
✓ Branch 1 taken 1818631 times.
|
1820954 | g3 = g3 || isGrassType(combobuf[MAPCOMBO2(q-1,x+4,y+9)].type); |
| 8009 |
2/2✓ Branch 0 taken 2350 times.
✓ Branch 1 taken 1818604 times.
|
1820954 | g4 = g4 || isGrassType(combobuf[MAPCOMBO2(q-1,x+11,y+9)].type); |
| 8010 | 1820954 | } | |
| 8011 |
8/8✓ Branch 0 taken 8260 times.
✓ Branch 1 taken 626412 times.
✓ Branch 2 taken 7135 times.
✓ Branch 3 taken 1125 times.
✓ Branch 4 taken 6227 times.
✓ Branch 5 taken 908 times.
✓ Branch 6 taken 62 times.
✓ Branch 7 taken 6165 times.
|
634672 | if(g1 && g2 && g3 && g4) |
| 8012 | { | ||
| 8013 | 6165 | int grasscid = 0; | |
| 8014 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16508 times.
|
16508 | for(int q = maxlyr; q >= 0; --q) |
| 8015 | { | ||
| 8016 | 16508 | int cid = MAPCOMBO2(q-1,x+8,y+12); | |
| 8017 |
4/4✓ Branch 0 taken 7637 times.
✓ Branch 1 taken 8871 times.
✓ Branch 2 taken 1472 times.
✓ Branch 3 taken 6165 times.
|
16508 | if(cid > 0 && isGrassType(combobuf[cid].type)) |
| 8018 | { | ||
| 8019 | 6165 | grasscid = cid; | |
| 8020 | 6165 | break; | |
| 8021 | } | ||
| 8022 | 10343 | } | |
| 8023 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6165 times.
|
6165 | if(grasscid) |
| 8024 | { | ||
| 8025 | 6165 | newcombo const& cmb = combobuf[grasscid]; | |
| 8026 |
2/2✓ Branch 0 taken 5003 times.
✓ Branch 1 taken 1162 times.
|
6165 | if(decorations.idCount(dTALLGRASS)==0) |
| 8027 | { | ||
| 8028 |
3/6✓ Branch 0 taken 1162 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1162 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1162 times.
✗ Branch 5 not taken.
|
1162 | decorations.add(new dTallGrass(x, y, dTALLGRASS, 0, cmb.attribytes[6])); |
| 8029 | 1162 | } | |
| 8030 | 6165 | int32_t thesfx = cmb.attribytes[3]; | |
| 8031 |
2/2✓ Branch 0 taken 2035 times.
✓ Branch 1 taken 4130 times.
|
6165 | if (action==walking) |
| 8032 | 4130 | sfx_no_repeat(thesfx,pan((int32_t)x)); | |
| 8033 | 6165 | } | |
| 8034 | 6165 | } | |
| 8035 | 634672 | } | |
| 8036 | else | ||
| 8037 | { | ||
| 8038 | 14185110 | bool g1 = false, g2 = false; | |
| 8039 |
2/2✓ Branch 0 taken 15636352 times.
✓ Branch 1 taken 14185110 times.
|
29821462 | for(int q = maxlyr; q >= 0; --q) |
| 8040 | { | ||
| 8041 |
2/2✓ Branch 0 taken 25338 times.
✓ Branch 1 taken 15611014 times.
|
15636352 | g1 = g1 || isGrassType(combobuf[MAPCOMBO2(q-1,x,y+15)].type); |
| 8042 |
2/2✓ Branch 0 taken 23574 times.
✓ Branch 1 taken 15612778 times.
|
15636352 | g2 = g2 || isGrassType(combobuf[MAPCOMBO2(q-1,x+15,y+15)].type); |
| 8043 | 15636352 | } | |
| 8044 |
4/4✓ Branch 0 taken 160962 times.
✓ Branch 1 taken 14024148 times.
✓ Branch 2 taken 36143 times.
✓ Branch 3 taken 124819 times.
|
14185110 | if(g1 && g2) |
| 8045 | { | ||
| 8046 | 124819 | int grasscid = 0; | |
| 8047 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 149507 times.
|
149507 | for(int q = maxlyr; q >= 0; --q) |
| 8048 | { | ||
| 8049 | 149507 | int cid = MAPCOMBO2(q-1,x+8,y+15); | |
| 8050 |
4/4✓ Branch 0 taken 125394 times.
✓ Branch 1 taken 24113 times.
✓ Branch 2 taken 575 times.
✓ Branch 3 taken 124819 times.
|
149507 | if(cid > 0 && isGrassType(combobuf[cid].type)) |
| 8051 | { | ||
| 8052 | 124819 | grasscid = cid; | |
| 8053 | 124819 | break; | |
| 8054 | } | ||
| 8055 | 24688 | } | |
| 8056 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 124819 times.
|
124819 | if(grasscid) |
| 8057 | { | ||
| 8058 | 124819 | newcombo const& cmb = combobuf[grasscid]; | |
| 8059 |
2/2✓ Branch 0 taken 121796 times.
✓ Branch 1 taken 3023 times.
|
124819 | if(decorations.idCount(dTALLGRASS)==0) |
| 8060 | { | ||
| 8061 |
3/6✓ Branch 0 taken 3023 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3023 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3023 times.
✗ Branch 5 not taken.
|
3023 | decorations.add(new dTallGrass(x, y, dTALLGRASS, 0, cmb.attribytes[6])); |
| 8062 | 3023 | } | |
| 8063 | 124819 | int32_t thesfx = cmb.attribytes[3]; | |
| 8064 |
2/2✓ Branch 0 taken 44475 times.
✓ Branch 1 taken 80344 times.
|
124819 | if (action==walking ) |
| 8065 | 80344 | sfx_no_repeat(thesfx,pan((int32_t)x)); | |
| 8066 | 124819 | } | |
| 8067 | 124819 | } | |
| 8068 | } | ||
| 8069 | 14819782 | } | |
| 8070 |
3/4✓ Branch 0 taken 14817333 times.
✓ Branch 1 taken 58489 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 14817333 times.
|
14875822 | if(z==0 && fakez==0) //Shallow Water / Custom Walk SFX |
| 8071 | { | ||
| 8072 |
2/2✓ Branch 0 taken 1704719 times.
✓ Branch 1 taken 13112614 times.
|
14817333 | if (get_qr(qr_SHALLOW_SENSITIVE)) |
| 8073 | { | ||
| 8074 |
19/22✓ Branch 0 taken 1696664 times.
✓ Branch 1 taken 8055 times.
✓ Branch 2 taken 1696664 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1691064 times.
✓ Branch 5 taken 5600 times.
✓ Branch 6 taken 1690552 times.
✓ Branch 7 taken 512 times.
✓ Branch 8 taken 1690552 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 1690032 times.
✓ Branch 11 taken 520 times.
✓ Branch 12 taken 1684152 times.
✓ Branch 13 taken 5880 times.
✓ Branch 14 taken 1684152 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 1673621 times.
✓ Branch 17 taken 10531 times.
✓ Branch 18 taken 1663092 times.
✓ Branch 19 taken 10529 times.
✓ Branch 20 taken 1587 times.
✓ Branch 21 taken 1661505 times.
|
1704719 | if (action != swimming && action != isdiving && action != drowning && action!=lavadrowning && action!=sidedrowning && action!=rafting && action != falling && !IsSideSwim() && !(ladderx+laddery) && !pull_hero && !walk_through_walls) |
| 8075 | { | ||
| 8076 | 1661505 | bool b1 = iswaterex_z3(FFORCOMBO(x+11,y+15), -1, x+11, y+15, false, false, true, true); | |
| 8077 | 1661505 | bool b2 = iswaterex_z3(FFORCOMBO(x+4,y+15), -1, x+4, y+15, false, false, true, true); | |
| 8078 | 1661505 | bool b3 = iswaterex_z3(FFORCOMBO(x+11,y+9), -1, x+11, y+9, false, false, true, true); | |
| 8079 | 1661505 | bool b4 = iswaterex_z3(FFORCOMBO(x+4,y+9), -1, x+4, y+9, false, false, true, true); | |
| 8080 | |||
| 8081 |
8/8✓ Branch 0 taken 99215 times.
✓ Branch 1 taken 1562290 times.
✓ Branch 2 taken 92566 times.
✓ Branch 3 taken 6649 times.
✓ Branch 4 taken 86922 times.
✓ Branch 5 taken 5644 times.
✓ Branch 6 taken 210 times.
✓ Branch 7 taken 86712 times.
|
1661505 | if (b1 && b2 && b3 && b4) |
| 8082 | { | ||
| 8083 | 86712 | int watercheck_x = x.getInt()+7.5, watercheck_y = y.getInt()+12; | |
| 8084 | 86712 | auto combined_handle = get_combined_handle_for_world_xy(watercheck_x, watercheck_y, 0); | |
| 8085 | 86712 | int waterid = combined_handle.data(); | |
| 8086 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 86712 times.
|
86712 | if(waterid) |
| 8087 | 86712 | waterid = iswaterex_z3(waterid, -1, watercheck_x,watercheck_y, false, false, true, true); | |
| 8088 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 86712 times.
|
86712 | if(waterid) |
| 8089 | { | ||
| 8090 | 86712 | newcombo const& watercmb = combobuf[waterid]; | |
| 8091 | 86712 | auto ripplesprite = watercmb.attribytes[6]; | |
| 8092 |
2/2✓ Branch 0 taken 85860 times.
✓ Branch 1 taken 852 times.
|
86712 | if(decorations.idCount(dRIPPLES)==0) |
| 8093 |
3/6✓ Branch 0 taken 852 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 852 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 852 times.
✗ Branch 5 not taken.
|
852 | decorations.add(new dRipples(x, y, dRIPPLES, 0, ripplesprite)); |
| 8094 |
2/2✓ Branch 0 taken 672 times.
✓ Branch 1 taken 86040 times.
|
86712 | if (watercmb.usrflags&cflag2) |
| 8095 | { | ||
| 8096 |
3/4✓ Branch 0 taken 49 times.
✓ Branch 1 taken 623 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 49 times.
|
672 | if (!(current_item(watercmb.attribytes[2]) > 0 && current_item(watercmb.attribytes[2]) >= watercmb.attribytes[3])) |
| 8097 | { | ||
| 8098 | 623 | onpassivedmg = true; | |
| 8099 |
2/2✓ Branch 0 taken 309 times.
✓ Branch 1 taken 314 times.
|
623 | if (!damageovertimeclk) |
| 8100 | { | ||
| 8101 | 314 | int32_t curhp = game->get_life(); | |
| 8102 | 314 | auto dmg = watercmb.attributes[1]/10000L; | |
| 8103 | 314 | auto hitsfx = watercmb.attributes[2]/10000L; | |
| 8104 |
1/2✓ Branch 0 taken 314 times.
✗ Branch 1 not taken.
|
314 | bool hitstun = dmg < 0 && (watercmb.usrflags&cflag7); |
| 8105 | |||
| 8106 |
2/4✓ Branch 0 taken 314 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 314 times.
|
314 | if(game->get_life() == curhp && (watercmb.usrflags&cflag6)) |
| 8107 | 314 | hitsfx = 0; | |
| 8108 | |||
| 8109 | 314 | std::vector<int32_t> &ev = FFCore.eventData; | |
| 8110 | 314 | ev.clear(); | |
| 8111 | 314 | ev.push_back(-dmg*10000); | |
| 8112 | 314 | ev.push_back(-1*10000); | |
| 8113 | 314 | ev.push_back(0); | |
| 8114 | 314 | ev.push_back(0); | |
| 8115 | 314 | ev.push_back(48*10000); | |
| 8116 | 314 | ev.push_back(ZSD_COMBODATA*10000); | |
| 8117 | 314 | ev.push_back(waterid); | |
| 8118 | 314 | ev.push_back((combined_handle.is_ffc() ? ZSD_FFC : ZSD_COMBOPOS)*10000); | |
| 8119 | 314 | ev.push_back(combined_handle.id()*10000); | |
| 8120 | |||
| 8121 | 314 | throwGenScriptEvent(GENSCR_EVENT_HERO_HIT_1); | |
| 8122 | |||
| 8123 |
1/2✓ Branch 0 taken 314 times.
✗ Branch 1 not taken.
|
314 | if(watercmb.usrflags & cflag5) |
| 8124 | ✗ | ev[0] = ringpower(ev[0]/10000) * 10000; | |
| 8125 | |||
| 8126 | 314 | throwGenScriptEvent(GENSCR_EVENT_HERO_HIT_2); | |
| 8127 | 314 | dmg = -ev[0]/10000; | |
| 8128 | |||
| 8129 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 314 times.
|
314 | if(!ev[2]) //nullify |
| 8130 | { | ||
| 8131 | 314 | game->set_life(vbound(game->get_life()+dmg, 0, game->get_maxlife())); | |
| 8132 |
1/2✓ Branch 0 taken 314 times.
✗ Branch 1 not taken.
|
314 | if (hitsfx) |
| 8133 | ✗ | sfx(hitsfx); | |
| 8134 |
1/2✓ Branch 0 taken 314 times.
✗ Branch 1 not taken.
|
314 | if (hitstun) |
| 8135 | { | ||
| 8136 | ✗ | hclk = ev[4]/10000; | |
| 8137 | ✗ | hitdir = ev[1]/10000; | |
| 8138 | ✗ | action = gothit; FFCore.setHeroAction(gothit); | |
| 8139 | ✗ | check_on_hit(); | |
| 8140 | ✗ | } | |
| 8141 | 314 | } | |
| 8142 | 314 | } | |
| 8143 |
1/2✓ Branch 0 taken 623 times.
✗ Branch 1 not taken.
|
623 | if (watercmb.attribytes[1] > 0) |
| 8144 | { | ||
| 8145 |
3/4✓ Branch 0 taken 309 times.
✓ Branch 1 taken 314 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 309 times.
|
623 | if (!damageovertimeclk || damageovertimeclk > watercmb.attribytes[1]) damageovertimeclk = watercmb.attribytes[1]; |
| 8146 | 309 | else --damageovertimeclk; | |
| 8147 | 623 | } | |
| 8148 | ✗ | else damageovertimeclk = 0; | |
| 8149 | 623 | } | |
| 8150 | 49 | else damageovertimeclk = 0; | |
| 8151 | 672 | } | |
| 8152 | 86040 | else damageovertimeclk = 0; | |
| 8153 | 86712 | int32_t thesfx = watercmb.attribytes[0]; | |
| 8154 |
4/4✓ Branch 0 taken 85684 times.
✓ Branch 1 taken 1028 times.
✓ Branch 2 taken 46233 times.
✓ Branch 3 taken 39451 times.
|
86712 | if (watercmb.type != cSHALLOWWATER || !get_qr(qr_OLD_SHALLOW_SFX)) |
| 8155 | { | ||
| 8156 | 40479 | thesfx = watercmb.attribytes[5]; | |
| 8157 | 40479 | } | |
| 8158 |
2/2✓ Branch 0 taken 40910 times.
✓ Branch 1 taken 45802 times.
|
86712 | if (action==walking) |
| 8159 | 45802 | sfx_no_repeat(thesfx,pan((int32_t)x)); | |
| 8160 | 86712 | } | |
| 8161 | 86712 | } | |
| 8162 | 1661505 | } | |
| 8163 | 1704719 | } | |
| 8164 | else | ||
| 8165 | { | ||
| 8166 |
4/4✓ Branch 0 taken 12956578 times.
✓ Branch 1 taken 156036 times.
✓ Branch 2 taken 12969911 times.
✓ Branch 3 taken 142703 times.
|
13112614 | if((COMBOTYPE(x,y+15)==cSHALLOWWATER)&&(COMBOTYPE(x+15,y+15)==cSHALLOWWATER)) |
| 8167 | { | ||
| 8168 | 142703 | int32_t watercheck = FFORCOMBO(x+7.5,y.getInt()+15); | |
| 8169 | 142703 | auto ripplesprite = combobuf[watercheck].attribytes[6]; | |
| 8170 |
2/2✓ Branch 0 taken 141287 times.
✓ Branch 1 taken 1416 times.
|
142703 | if(decorations.idCount(dRIPPLES)==0) |
| 8171 | { | ||
| 8172 |
3/6✓ Branch 0 taken 1416 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1416 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1416 times.
✗ Branch 5 not taken.
|
1416 | decorations.add(new dRipples(x, y, dRIPPLES, 0, ripplesprite)); |
| 8173 | 1416 | } | |
| 8174 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 142703 times.
|
142703 | if (combobuf[watercheck].usrflags&cflag2) |
| 8175 | { | ||
| 8176 | ✗ | if (!(current_item(combobuf[watercheck].attribytes[2]) > 0 && current_item(combobuf[watercheck].attribytes[2]) >= combobuf[watercheck].attribytes[3])) | |
| 8177 | { | ||
| 8178 | ✗ | onpassivedmg = true; | |
| 8179 | ✗ | if (!damageovertimeclk) | |
| 8180 | { | ||
| 8181 | ✗ | int32_t curhp = game->get_life(); | |
| 8182 | ✗ | if (combobuf[watercheck].usrflags&cflag5) game->set_life(vbound(game->get_life()+ringpower(combobuf[watercheck].attributes[1]/10000L), 0, game->get_maxlife())); //Affected by rings | |
| 8183 | ✗ | else game->set_life(vbound(game->get_life()+(combobuf[watercheck].attributes[1]/10000L), 0, game->get_maxlife())); | |
| 8184 | ✗ | if ((combobuf[watercheck].attributes[2]/10000L) && (game->get_life() != curhp || !(combobuf[watercheck].usrflags&cflag6))) sfx(combobuf[watercheck].attributes[2]/10000L); | |
| 8185 | ✗ | } | |
| 8186 | ✗ | if (combobuf[watercheck].attribytes[1] > 0) | |
| 8187 | { | ||
| 8188 | ✗ | if (!damageovertimeclk || damageovertimeclk > combobuf[watercheck].attribytes[1]) damageovertimeclk = combobuf[watercheck].attribytes[1]; | |
| 8189 | ✗ | else --damageovertimeclk; | |
| 8190 | ✗ | } | |
| 8191 | ✗ | else damageovertimeclk = 0; | |
| 8192 | ✗ | } | |
| 8193 | ✗ | else damageovertimeclk = 0; | |
| 8194 | ✗ | } | |
| 8195 | 142703 | else damageovertimeclk = 0; | |
| 8196 | 142703 | int32_t thesfx = combobuf[watercheck].attribytes[0]; | |
| 8197 |
2/2✓ Branch 0 taken 53531 times.
✓ Branch 1 taken 89172 times.
|
142703 | if (action==walking ) |
| 8198 | 89172 | sfx_no_repeat(thesfx,pan((int32_t)x)); | |
| 8199 | 142703 | } | |
| 8200 | } | ||
| 8201 | |||
| 8202 |
1/2✓ Branch 0 taken 14817333 times.
✗ Branch 1 not taken.
|
118530586 | for_each_rpos_stood_on([&](const rpos_handle_t& handle) |
| 8203 | { | ||
| 8204 | 103713253 | auto& cmb = handle.combo(); | |
| 8205 |
2/2✓ Branch 0 taken 55364561 times.
✓ Branch 1 taken 48348692 times.
|
103713253 | byte csfx = action == walking ? cmb.sfx_walking : cmb.sfx_standing; |
| 8206 |
2/2✓ Branch 0 taken 55364561 times.
✓ Branch 1 taken 48348692 times.
|
103713253 | byte cspr = action == walking ? cmb.spr_walking : cmb.spr_standing; |
| 8207 |
2/2✓ Branch 0 taken 103703629 times.
✓ Branch 1 taken 9624 times.
|
103713253 | if(csfx) |
| 8208 | 9624 | sfx_no_repeat(csfx, pan(x)); | |
| 8209 | 103713253 | auto indx = decorations.idFirst(dCUSTOMWALK); | |
| 8210 |
1/2✓ Branch 0 taken 103713253 times.
✗ Branch 1 not taken.
|
103713253 | if(cspr) |
| 8211 | { | ||
| 8212 | ✗ | if(indx < 0) | |
| 8213 | { | ||
| 8214 | ✗ | if(decorations.add(new customWalkSprite(x, y, dCUSTOMWALK, 0, -1))) | |
| 8215 | ✗ | indx = decorations.Count()-1; | |
| 8216 | ✗ | } | |
| 8217 | ✗ | if(indx > -1) | |
| 8218 | { | ||
| 8219 | ✗ | if(customWalkSprite* spr = dynamic_cast<customWalkSprite*>(decorations.spr(indx))) | |
| 8220 | ✗ | spr->run_sprite(cspr); | |
| 8221 | ✗ | } | |
| 8222 | ✗ | } | |
| 8223 | 103713253 | }); | |
| 8224 | 14817333 | } | |
| 8225 | |||
| 8226 |
2/2✓ Branch 0 taken 14875381 times.
✓ Branch 1 taken 441 times.
|
14875822 | if(stomping) |
| 8227 | 441 | stomping = false; | |
| 8228 | |||
| 8229 |
2/2✓ Branch 0 taken 14875511 times.
✓ Branch 1 taken 311 times.
|
14875822 | if(getOnSideviewLadder()) |
| 8230 | { | ||
| 8231 |
4/8✓ Branch 0 taken 311 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 311 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 311 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 311 times.
✗ Branch 7 not taken.
|
311 | if(!canSideviewLadder() || jumping<0 || fall!=0 || fakefall!=0) |
| 8232 | { | ||
| 8233 | ✗ | setOnSideviewLadder(false); | |
| 8234 | ✗ | } | |
| 8235 |
2/8✓ Branch 0 taken 311 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 311 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
311 | else if(CANFORCEFACEUP) |
| 8236 | { | ||
| 8237 | ✗ | setDir(up); | |
| 8238 | ✗ | } | |
| 8239 | 311 | } | |
| 8240 | |||
| 8241 |
8/10✓ Branch 0 taken 14818742 times.
✓ Branch 1 taken 57080 times.
✓ Branch 2 taken 14811286 times.
✓ Branch 3 taken 7456 times.
✓ Branch 4 taken 14810774 times.
✓ Branch 5 taken 512 times.
✓ Branch 6 taken 14810774 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 14810774 times.
|
14875822 | if(action!=inwind && action!=drowning && action!=lavadrowning && action!= sidedrowning && !is_autowalking()) |
| 8242 | { | ||
| 8243 |
2/2✓ Branch 0 taken 13233995 times.
✓ Branch 1 taken 1576779 times.
|
14810774 | if(!get_qr(qr_OLD_CHEST_COLLISION)) |
| 8244 | { | ||
| 8245 | 1576779 | checkchest(cCHEST); | |
| 8246 | 1576779 | checkchest(cLOCKEDCHEST); | |
| 8247 | 1576779 | checkchest(cBOSSCHEST); | |
| 8248 | 1576779 | } | |
| 8249 |
2/2✓ Branch 0 taken 13719908 times.
✓ Branch 1 taken 1090866 times.
|
14810774 | if(!get_qr(qr_OLD_LOCKBLOCK_COLLISION)) |
| 8250 | { | ||
| 8251 | 1090866 | checkchest(cLOCKBLOCK); | |
| 8252 | 1090866 | checkchest(cBOSSLOCKBLOCK); | |
| 8253 | 1090866 | } | |
| 8254 | 14810774 | checksigns(); | |
| 8255 | 14810774 | checkgenpush(); | |
| 8256 | 14810774 | } | |
| 8257 | |||
| 8258 |
4/4✓ Branch 0 taken 14035239 times.
✓ Branch 1 taken 840583 times.
✓ Branch 2 taken 3131 times.
✓ Branch 3 taken 14032108 times.
|
14875822 | if(isStanding(true) && fall == 0) |
| 8259 | { | ||
| 8260 |
1/2✓ Branch 0 taken 14032108 times.
✗ Branch 1 not taken.
|
14032108 | if(extra_jump_count > 0) |
| 8261 | ✗ | extra_jump_count = 0; | |
| 8262 | 14032108 | coyotetime = 0; | |
| 8263 | 14032108 | } | |
| 8264 |
2/2✓ Branch 0 taken 53782 times.
✓ Branch 1 taken 789932 times.
|
843714 | else if(coyotetime < 65535) |
| 8265 | { | ||
| 8266 | 789932 | ++coyotetime; | |
| 8267 | 789932 | } | |
| 8268 |
2/2✓ Branch 0 taken 14816415 times.
✓ Branch 1 taken 59407 times.
|
14875822 | if(can_use_item(itype_hoverboots,i_hoverboots)) |
| 8269 | { | ||
| 8270 | 59407 | int32_t hoverid = current_item_id(itype_hoverboots); | |
| 8271 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 59407 times.
|
59407 | if(!(itemsbuf[hoverid].flags & item_flag1)) |
| 8272 | { | ||
| 8273 |
1/2✓ Branch 0 taken 59407 times.
✗ Branch 1 not taken.
|
59407 | if(hoverclk < 0) hoverclk = 0; |
| 8274 | 59407 | hoverflags &= ~HOV_OUT; | |
| 8275 | 59407 | } | |
| 8276 | 59407 | } | |
| 8277 | 14875822 | bool platformfell2 = false; | |
| 8278 | 14875822 | last_rocs_id = getRocsPressed(); // reset the cached roc's feather ID | |
| 8279 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 14875822 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
14875822 | if (current_rocs_jump_id > -1 && current_rocs_jump_id != last_rocs_id) |
| 8280 | ✗ | released_jump_button = true; | |
| 8281 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 14875822 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
14875822 | if (current_rocs_jump_id > -1 && released_jump_button) |
| 8282 | { | ||
| 8283 | ✗ | itemdata const& last_rocs = itemsbuf[current_rocs_jump_id]; | |
| 8284 | ✗ | if (fall < 0) | |
| 8285 | { | ||
| 8286 | ✗ | if (last_rocs.flags & item_flag6) | |
| 8287 | { | ||
| 8288 | ✗ | int32_t jump_loss = last_rocs.misc6 / 100; | |
| 8289 | ✗ | fall = zc_min(0_zf, fall + jump_loss); | |
| 8290 | ✗ | } | |
| 8291 | ✗ | if (fall >= 0) | |
| 8292 | ✗ | try_hover(); | |
| 8293 | ✗ | } | |
| 8294 | ✗ | if (fall >= 0) | |
| 8295 | { | ||
| 8296 | ✗ | current_rocs_jump_id = -1; | |
| 8297 | ✗ | released_jump_button = false; | |
| 8298 | ✗ | } | |
| 8299 | ✗ | } | |
| 8300 | 14875822 | last_grav_boots_id = -1; // clear grav boots, so that they are re-checked in get_gravity()/get_terminalv() if needed | |
| 8301 | 14875822 | int32_t gravity3 = get_grav_fall(); | |
| 8302 | 14875822 | int32_t termv = get_terminalv_fall(); | |
| 8303 | 14875822 | bool used_grav_or_termv = false; | |
| 8304 | |||
| 8305 |
2/2✓ Branch 0 taken 38728 times.
✓ Branch 1 taken 14837094 times.
|
14875822 | if (handle_termv()) |
| 8306 | 38728 | used_grav_or_termv = true; | |
| 8307 |
3/4✓ Branch 0 taken 14826708 times.
✓ Branch 1 taken 10386 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 14826708 times.
|
14837094 | else if (fall > termv || fakefall > termv) |
| 8308 | { | ||
| 8309 |
2/4✓ Branch 0 taken 10386 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
|
10390 | if ((last_grav_boots_id != -1) || |
| 8310 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 10382 times.
|
10386 | (last_rocs_id != -1 && (itemsbuf[last_rocs_id].flags & item_flag5))) |
| 8311 | { | ||
| 8312 | ✗ | if (fall > termv) | |
| 8313 | ✗ | fall = termv; | |
| 8314 | ✗ | if (fakefall > termv) | |
| 8315 | ✗ | fakefall = termv; | |
| 8316 | ✗ | used_grav_or_termv = true; | |
| 8317 | ✗ | } | |
| 8318 | 10386 | } | |
| 8319 |
2/2✓ Branch 0 taken 14556778 times.
✓ Branch 1 taken 319044 times.
|
14875822 | bool nograv = (sideview_mode() && is_autowalking()); |
| 8320 |
2/2✓ Branch 0 taken 38728 times.
✓ Branch 1 taken 14837094 times.
|
14875822 | if(nograv) |
| 8321 | ; | ||
| 8322 |
2/2✓ Branch 0 taken 319044 times.
✓ Branch 1 taken 14518050 times.
|
14837094 | else if(sideview_mode()) // Sideview gravity |
| 8323 | { | ||
| 8324 | //Handle falling through a platform | ||
| 8325 | 319044 | bool platformfell = false; | |
| 8326 |
3/4✓ Branch 0 taken 161041 times.
✓ Branch 1 taken 158003 times.
✓ Branch 2 taken 161041 times.
✗ Branch 3 not taken.
|
319044 | if (on_sideview_solid_oldpos(this,true,3) && !on_sideview_solid_oldpos(this,false,3)) |
| 8327 | { | ||
| 8328 | ✗ | if (!(!on_sideview_slope(Hero.x, Hero.y, Hero.old_x, Hero.old_y) && (on_sideview_slope(Hero.x, Hero.y + 1, Hero.old_x, Hero.old_y) || on_sideview_slope(Hero.x, Hero.y + 2, Hero.old_x, Hero.old_y)) && getInput(btnDown, INPUT_HERO_ACTION))) platformfell = true; | |
| 8329 | ✗ | y+=1; //Fall down a pixel instantly, through the platform. | |
| 8330 | ✗ | if(fall < 0) fall = 0; | |
| 8331 | ✗ | if(jumping < 0) jumping = 0; | |
| 8332 | ✗ | platformfell2 = true; | |
| 8333 | ✗ | } | |
| 8334 | //Unless using old collision, run this check BEFORE moving Hero, to prevent clipping into the ceiling. | ||
| 8335 |
2/2✓ Branch 0 taken 313554 times.
✓ Branch 1 taken 5490 times.
|
319044 | if(!get_qr(qr_OLD_SIDEVIEW_CEILING_COLLISON)) |
| 8336 | { | ||
| 8337 |
10/14✓ Branch 0 taken 4180 times.
✓ Branch 1 taken 1310 times.
✓ Branch 2 taken 1310 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1310 times.
✓ Branch 6 taken 8 times.
✓ Branch 7 taken 1302 times.
✓ Branch 8 taken 1302 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 1302 times.
✓ Branch 12 taken 5482 times.
✓ Branch 13 taken 8 times.
|
6800 | if(fall < 0 && (_walkflag(x+4,y+((bigHitbox||!diagonalMovement)?(fall/100):(fall/100)+8),1,get_standing_z_state()) || _walkflag(x+12,y+((bigHitbox||!diagonalMovement)?(fall/100):(fall/100)+8),1,get_standing_z_state()) |
| 8338 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 1302 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1302 times.
|
1302 | || ((y+(fall/100)<=0) && |
| 8339 | // Extra checks if Smart Screen Scrolling is enabled | ||
| 8340 | ✗ | (nextcombo_wf(up) || ((get_qr(qr_SMARTSCREENSCROLL)&&(!(hero_scr->flags&fMAZE)) && | |
| 8341 | ✗ | !(hero_scr->flags2&wfUP)) && (nextcombo_solid(up))))))) | |
| 8342 | { | ||
| 8343 | 8 | fall = jumping = 0; // Bumped his head | |
| 8344 |
1/2✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
|
8 | if(get_qr(qr_OLD_SIDEVIEW_LANDING_CODE)) |
| 8345 | ✗ | y -= y.getInt()%8; //fix coords | |
| 8346 | // ... maybe on spikes //this is the change from 2.50.1RC3 that Saffith made, that breaks some old quests. -Z | ||
| 8347 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
|
8 | if ( !get_qr(qr_OLDSIDEVIEWSPIKES) ) //fix for older sideview quests -Z |
| 8348 | { | ||
| 8349 | 8 | checkdamagecombos(x+4, x+12, y-1, y-1); | |
| 8350 | 8 | } | |
| 8351 | 8 | } | |
| 8352 | 5490 | } | |
| 8353 | // Fall, unless on a ladder, sideview ladder, rafting, using the hookshot, drowning, sideswimming or cheating. | ||
| 8354 |
8/14✗ Branch 0 not taken.
✓ Branch 1 taken 319044 times.
✓ Branch 2 taken 319044 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 319044 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 319044 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 319044 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 319044 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 311 times.
✓ Branch 13 taken 318733 times.
|
319044 | if (!(walk_through_walls && getInput(btnUp, INPUT_HERO_ACTION)) && !drownclk && action != rafting && !IsSideSwim() && !pull_hero && !((ladderx || laddery) && fall > 0) && !getOnSideviewLadder()) |
| 8355 | { | ||
| 8356 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 318733 times.
|
318733 | int32_t ydiff = fall/(spins && fall<0 ? 200:100); |
| 8357 | 318733 | falling_oldy = y; // Stomp Boots-related variable | |
| 8358 | |||
| 8359 |
5/8✓ Branch 0 taken 60726 times.
✓ Branch 1 taken 258007 times.
✓ Branch 2 taken 60726 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 60726 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 318733 times.
✗ Branch 7 not taken.
|
318733 | if(fall > 0 && (checkSVLadderPlatform(x+4,y+ydiff+15)||checkSVLadderPlatform(x+12,y+ydiff+15)) && (TRUNCATE_TILE(y.getInt()+ydiff+15) != TRUNCATE_TILE(y.getInt()+15)) && !platform_fallthrough()) |
| 8360 | { | ||
| 8361 | ✗ | ydiff -= (y.getInt()+ydiff)%16; | |
| 8362 | ✗ | } | |
| 8363 |
4/4✓ Branch 0 taken 87354 times.
✓ Branch 1 taken 231379 times.
✓ Branch 2 taken 84656 times.
✓ Branch 3 taken 2698 times.
|
318733 | if(ydiff && !get_qr(qr_OLD_SIDEVIEW_LANDING_CODE)) |
| 8364 | { | ||
| 8365 |
2/2✓ Branch 0 taken 1552 times.
✓ Branch 1 taken 1146 times.
|
2698 | if(ydiff > 0) |
| 8366 | { | ||
| 8367 |
2/2✓ Branch 0 taken 1511 times.
✓ Branch 1 taken 3277 times.
|
4788 | for(auto q = 0; q < ydiff; ++q) |
| 8368 | { | ||
| 8369 |
2/2✓ Branch 0 taken 3236 times.
✓ Branch 1 taken 41 times.
|
3277 | if(on_sideview_solid_oldpos(this, false, 0, 0, q)) |
| 8370 | { | ||
| 8371 | 41 | ydiff = q; | |
| 8372 | 41 | break; | |
| 8373 | } | ||
| 8374 | 3236 | } | |
| 8375 | 1552 | } | |
| 8376 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1146 times.
|
1146 | else if(ydiff < 0) |
| 8377 | { | ||
| 8378 |
2/2✓ Branch 0 taken 1146 times.
✓ Branch 1 taken 2639 times.
|
3785 | for(auto q = 0; q > ydiff; --q) |
| 8379 | { | ||
| 8380 |
1/2✓ Branch 0 taken 2639 times.
✗ Branch 1 not taken.
|
2639 | if(_walkflag(x+4,y+(bigHitbox?0:8)+q-1,1) |
| 8381 |
1/2✓ Branch 0 taken 2639 times.
✗ Branch 1 not taken.
|
2639 | || _walkflag(x+12,y+(bigHitbox?0:8)+q,1)) |
| 8382 | { | ||
| 8383 | ✗ | ydiff = q; | |
| 8384 | ✗ | break; | |
| 8385 | } | ||
| 8386 | 2639 | } | |
| 8387 | 1146 | } | |
| 8388 | 2698 | } | |
| 8389 | 318733 | y+=ydiff; | |
| 8390 | 318733 | hs_starty+=ydiff; | |
| 8391 | |||
| 8392 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 318733 times.
|
318733 | for(int32_t j=0; j<chainlinks.Count(); j++) |
| 8393 | { | ||
| 8394 | ✗ | chainlinks.spr(j)->y+=ydiff; | |
| 8395 | ✗ | } | |
| 8396 | |||
| 8397 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 318733 times.
|
318733 | if(Lwpns.idFirst(wHookshot)>-1) |
| 8398 | { | ||
| 8399 | ✗ | Lwpns.spr(Lwpns.idFirst(wHookshot))->y+=ydiff; | |
| 8400 | ✗ | } | |
| 8401 | |||
| 8402 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 318733 times.
|
318733 | if(Lwpns.idFirst(wHSHandle)>-1) |
| 8403 | { | ||
| 8404 | ✗ | Lwpns.spr(Lwpns.idFirst(wHSHandle))->y+=ydiff; | |
| 8405 | ✗ | } | |
| 8406 | 318733 | } | |
| 8407 |
1/10✗ Branch 0 not taken.
✓ Branch 1 taken 311 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
311 | else if(IsSideSwim() && action != sidewaterhold1 && action != sidewaterhold2 && action != sideswimcasting && action != sideswimfreeze) |
| 8408 | { | ||
| 8409 | ✗ | fall = hoverclk = jumping = 0; | |
| 8410 | ✗ | inair = false; | |
| 8411 | ✗ | hoverflags = 0; | |
| 8412 | ✗ | if (!getInput(btnUp, INPUT_DRUNK | INPUT_HERO_ACTION) && !getInput(btnDown, INPUT_DRUNK | INPUT_HERO_ACTION) && !getInput(btnLeft, INPUT_DRUNK | INPUT_HERO_ACTION) && !getInput(btnRight, INPUT_DRUNK | INPUT_HERO_ACTION) && !autostep) | |
| 8413 | { | ||
| 8414 | ✗ | WalkflagInfo info; | |
| 8415 | ✗ | if (game->get_watergrav()<0) | |
| 8416 | { | ||
| 8417 | ✗ | info = walkflag(x,y+8-(bigHitbox*8)-2,2,up); | |
| 8418 | ✗ | execute(info); | |
| 8419 | ✗ | } | |
| 8420 | else | ||
| 8421 | { | ||
| 8422 | ✗ | info = walkflag(x,y+15+2,2,down); | |
| 8423 | ✗ | execute(info); | |
| 8424 | } | ||
| 8425 | |||
| 8426 | ✗ | if(!info.isUnwalkable() && (game->get_watergrav() > 0 || iswaterex_z3(MAPCOMBO(x,y+8-(bigHitbox*8)-2), -1, x, y+8-(bigHitbox*8)-2, true, false))) | |
| 8427 | { | ||
| 8428 | ✗ | y += (game->get_watergrav()/10000.0); | |
| 8429 | ✗ | } | |
| 8430 | ✗ | } | |
| 8431 | ✗ | } | |
| 8432 | // Stop hovering/falling if you land on something. | ||
| 8433 | 319044 | bool needFall = false; | |
| 8434 |
6/8✓ Branch 0 taken 157365 times.
✓ Branch 1 taken 161679 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 319044 times.
✓ Branch 4 taken 161990 times.
✓ Branch 5 taken 157054 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 161990 times.
|
319044 | if((on_sideview_solid_oldpos(this) || getOnSideviewLadder()) && !(pull_hero && dir==down) && action!=rafting && !platformfell2) |
| 8435 | { | ||
| 8436 | 161990 | stop_item_sfx(itype_hoverboots); | |
| 8437 | 161990 | auto oldfall = fall; | |
| 8438 | 161990 | fall = hoverclk = jumping = 0; | |
| 8439 |
2/2✓ Branch 0 taken 159688 times.
✓ Branch 1 taken 2302 times.
|
161990 | if(get_qr(qr_OLD_SIDEVIEW_LANDING_CODE)) |
| 8440 | { | ||
| 8441 |
4/6✓ Branch 0 taken 159688 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 156423 times.
✓ Branch 3 taken 3265 times.
✓ Branch 4 taken 156423 times.
✗ Branch 5 not taken.
|
159688 | if(!getOnSideviewLadder() && (oldfall > 0 || get_qr(qr_OLD_SIDEVIEW_CEILING_COLLISON))) |
| 8442 | { | ||
| 8443 | 159688 | y.doFloor(); | |
| 8444 | 159688 | y-=(int32_t)y%8; //fix position | |
| 8445 | 159688 | } | |
| 8446 |
2/2✓ Branch 0 taken 156423 times.
✓ Branch 1 taken 3265 times.
|
159688 | if(oldfall > 0) |
| 8447 | 3265 | land_on_ground(); | |
| 8448 | 159688 | } | |
| 8449 | else | ||
| 8450 | { | ||
| 8451 | 2302 | snap_platform(); | |
| 8452 |
2/2✓ Branch 0 taken 2227 times.
✓ Branch 1 taken 75 times.
|
2302 | if(oldfall > 0) |
| 8453 | 75 | land_on_ground(); | |
| 8454 | } | ||
| 8455 | 161990 | inair = false; | |
| 8456 | 161990 | hoverflags = 0; | |
| 8457 | |||
| 8458 |
4/6✓ Branch 0 taken 14 times.
✓ Branch 1 taken 161976 times.
✓ Branch 2 taken 14 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 14 times.
|
161990 | if(y>=world_h-16 && cur_screen>=0x70 && !(get_scr_for_world_xy(x, y)->flags2&wfDOWN)) // Landed on the bottommost screen. |
| 8459 | 14 | y = world_h-16; | |
| 8460 | 161990 | } | |
| 8461 | // Stop hovering if you press down. | ||
| 8462 |
3/6✓ Branch 0 taken 157054 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 157054 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 157054 times.
✗ Branch 5 not taken.
|
157054 | else if ((hoverclk > 0 || ladderx || laddery) && getInput(btnDown, INPUT_DRUNK | INPUT_HERO_ACTION)) |
| 8463 | { | ||
| 8464 | ✗ | stop_item_sfx(itype_hoverboots); | |
| 8465 | ✗ | hoverclk = -hoverclk; | |
| 8466 | ✗ | reset_ladder(); | |
| 8467 | ✗ | fall = gravity3; | |
| 8468 | ✗ | used_grav_or_termv = true; | |
| 8469 | ✗ | inair = false; | |
| 8470 | ✗ | } | |
| 8471 |
8/10✓ Branch 0 taken 157054 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3579 times.
✓ Branch 3 taken 153475 times.
✓ Branch 4 taken 1340 times.
✓ Branch 5 taken 2239 times.
✓ Branch 6 taken 1340 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 344 times.
✓ Branch 9 taken 996 times.
|
157054 | else if (hoverclk < 1 && !inair && fall == 0 && !IsSideSwim() && justmoved <= 0) |
| 8472 | { | ||
| 8473 | 996 | needFall = true; | |
| 8474 |
2/2✓ Branch 0 taken 867 times.
✓ Branch 1 taken 129 times.
|
996 | if (replay_version_check(0, 23)) |
| 8475 | { | ||
| 8476 | 867 | zfix my = y + 4; | |
| 8477 |
2/2✓ Branch 0 taken 741 times.
✓ Branch 1 taken 2388 times.
|
3129 | for (zfix ty = y + 1; ty < my; ++ty) |
| 8478 | { | ||
| 8479 |
2/2✓ Branch 0 taken 2262 times.
✓ Branch 1 taken 126 times.
|
2388 | if (on_sideview_solid_oldpos(this, false, 0, 0, ty-y)) |
| 8480 | { | ||
| 8481 | 126 | y = ty; | |
| 8482 |
1/2✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
|
126 | if (check_new_slope(x, ty + 1, 16, 16, old_x, old_y, false) < 0) |
| 8483 | { | ||
| 8484 | ✗ | if (!slopeid) | |
| 8485 | ✗ | slopeid = get_new_slope(x, ty + 1, 16, 16, old_x, old_y).get_info().slope(); | |
| 8486 | ✗ | onplatid = 1; | |
| 8487 | ✗ | } | |
| 8488 | 126 | needFall = false; | |
| 8489 | 126 | break; | |
| 8490 | } | ||
| 8491 | 2262 | } | |
| 8492 | 867 | } | |
| 8493 | else | ||
| 8494 | { | ||
| 8495 | 129 | zfix dy = 0; | |
| 8496 | 129 | bool landed = false; | |
| 8497 |
3/6✓ Branch 0 taken 129 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 129 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 129 times.
✗ Branch 5 not taken.
|
2322 | dy = binary_search_zfix(0, 4, [&](zfix val, zfix& retval) |
| 8498 | { | ||
| 8499 |
2/2✓ Branch 0 taken 116 times.
✓ Branch 1 taken 2077 times.
|
2193 | if (on_sideview_solid_oldpos(this, false, 0, 0, val)) |
| 8500 | { | ||
| 8501 | 116 | retval = val; | |
| 8502 | 116 | landed = true; | |
| 8503 | 116 | return BSEARCH_CONTINUE_TOWARD0; | |
| 8504 | } | ||
| 8505 | 2077 | else return BSEARCH_CONTINUE_AWAY0; | |
| 8506 | 2193 | }); | |
| 8507 |
2/2✓ Branch 0 taken 17 times.
✓ Branch 1 taken 112 times.
|
129 | if (dy) |
| 8508 | { | ||
| 8509 | 112 | push_move(0, dy); | |
| 8510 | 112 | } | |
| 8511 |
2/2✓ Branch 0 taken 17 times.
✓ Branch 1 taken 112 times.
|
129 | if (landed) |
| 8512 | { | ||
| 8513 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 96 times.
|
112 | if (check_new_slope(x, y + 0.0001_zf, 16, 16, old_x, old_y, false, true) < 0) |
| 8514 | { | ||
| 8515 |
2/2✓ Branch 0 taken 80 times.
✓ Branch 1 taken 16 times.
|
96 | if (!slopeid) |
| 8516 | 16 | slopeid = get_new_slope(x, y + 0.0001_zf, 16, 16, old_x, old_y).get_info().slope(); | |
| 8517 | 96 | onplatid = 1; | |
| 8518 | 96 | } | |
| 8519 | 112 | needFall = false; | |
| 8520 | 112 | } | |
| 8521 | } | ||
| 8522 | 996 | } | |
| 8523 | else | ||
| 8524 | { | ||
| 8525 | 156058 | needFall = true; | |
| 8526 | } | ||
| 8527 | // Continue falling. | ||
| 8528 | |||
| 8529 |
4/4✓ Branch 0 taken 309693 times.
✓ Branch 1 taken 9351 times.
✓ Branch 2 taken 162228 times.
✓ Branch 3 taken 147465 times.
|
319044 | if(fall <= termv && needFall) |
| 8530 | { | ||
| 8531 | 147465 | inair = true; | |
| 8532 |
3/4✓ Branch 0 taken 56360 times.
✓ Branch 1 taken 91105 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 56360 times.
|
147465 | if (fall != 0 || hoverclk > 0) |
| 8533 | 91105 | jumping++; | |
| 8534 | |||
| 8535 | // Bump head if: hit a solid combo from beneath, or hit a solid combo in the screen above this one. | ||
| 8536 |
2/2✓ Branch 0 taken 144750 times.
✓ Branch 1 taken 2715 times.
|
147465 | if(get_qr(qr_OLD_SIDEVIEW_CEILING_COLLISON)) |
| 8537 | { | ||
| 8538 |
2/2✓ Branch 0 taken 144026 times.
✓ Branch 1 taken 724 times.
|
289500 | if((_walkflag(x+4,y-(bigHitbox?9:1),0,get_standing_z_state()) |
| 8539 |
4/4✓ Branch 0 taken 138377 times.
✓ Branch 1 taken 6373 times.
✓ Branch 2 taken 1123 times.
✓ Branch 3 taken 137254 times.
|
144750 | || (y<=(bigHitbox?9:1) && |
| 8540 | // Extra checks if Smart Screen Scrolling is enabled | ||
| 8541 |
2/6✓ Branch 0 taken 1123 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1123 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1123 | (nextcombo_wf(up) || ((get_qr(qr_SMARTSCREENSCROLL)&&(!(hero_scr->flags&fMAZE)) && |
| 8542 | ✗ | !(hero_scr->flags2&wfUP)) && (nextcombo_solid(up)))))) | |
| 8543 |
0/2✗ Branch 0 not taken.
✗ Branch 1 not taken.
|
6373 | && fall < 0) |
| 8544 | { | ||
| 8545 | 724 | fall = jumping = 0; // Bumped his head | |
| 8546 | |||
| 8547 | // ... maybe on spikes //this is the change from 2.50.1RC3 that Saffith made, that breaks some old quests. -Z | ||
| 8548 |
2/2✓ Branch 0 taken 614 times.
✓ Branch 1 taken 110 times.
|
724 | if ( !get_qr(qr_OLDSIDEVIEWSPIKES) ) //fix for older sideview quests -Z |
| 8549 | { | ||
| 8550 | 110 | checkdamagecombos(x+4, x+12, y-1, y-1); | |
| 8551 | 110 | } | |
| 8552 | 724 | } | |
| 8553 | 144750 | } | |
| 8554 | else | ||
| 8555 | { | ||
| 8556 |
6/8✗ Branch 0 not taken.
✓ Branch 1 taken 2715 times.
✓ Branch 2 taken 2705 times.
✓ Branch 3 taken 10 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2705 times.
✓ Branch 6 taken 2713 times.
✓ Branch 7 taken 2 times.
|
5430 | if((_walkflag(x+4,y+((bigHitbox||!diagonalMovement)?-1:7),1,get_standing_z_state()) || _walkflag(x+12,y+((bigHitbox||!diagonalMovement)?-1:7),1,get_standing_z_state()) |
| 8557 |
2/4✓ Branch 0 taken 2705 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2705 times.
|
2705 | || ((y<=0) && |
| 8558 | // Extra checks if Smart Screen Scrolling is enabled | ||
| 8559 | ✗ | (nextcombo_wf(up) || ((get_qr(qr_SMARTSCREENSCROLL)&&(!(hero_scr->flags&fMAZE)) && | |
| 8560 | ✗ | !(hero_scr->flags2&wfUP)) && (nextcombo_solid(up)))))) | |
| 8561 |
0/2✗ Branch 0 not taken.
✗ Branch 1 not taken.
|
10 | && fall < 0) |
| 8562 | { | ||
| 8563 | 2 | fall = jumping = 0; // Bumped his head | |
| 8564 | 2 | y -= y.getInt()%8; //fix coords | |
| 8565 | // ... maybe on spikes //this is the change from 2.50.1RC3 that Saffith made, that breaks some old quests. -Z | ||
| 8566 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | if ( !get_qr(qr_OLDSIDEVIEWSPIKES) ) //fix for older sideview quests -Z |
| 8567 | { | ||
| 8568 | 2 | checkdamagecombos(x+4, x+12, y-1, y-1); | |
| 8569 | 2 | } | |
| 8570 | 2 | } | |
| 8571 | } | ||
| 8572 | |||
| 8573 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 147465 times.
|
147465 | if(hoverclk > 0) |
| 8574 | { | ||
| 8575 | ✗ | if(tick_hover() && !ladderx && !laddery) | |
| 8576 | { | ||
| 8577 | ✗ | fall += gravity3; | |
| 8578 | ✗ | used_grav_or_termv = true; | |
| 8579 | ✗ | } | |
| 8580 | ✗ | } | |
| 8581 |
3/4✓ Branch 0 taken 105265 times.
✓ Branch 1 taken 42200 times.
✓ Branch 2 taken 57230 times.
✗ Branch 3 not taken.
|
147465 | else if(fall+gravity3 > 0 && fall<=0 |
| 8582 |
2/2✓ Branch 0 taken 57230 times.
✓ Branch 1 taken 48035 times.
|
105265 | && try_hover()) |
| 8583 | ✗ | used_grav_or_termv = true; | |
| 8584 |
4/8✓ Branch 0 taken 147465 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 147465 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 147465 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 147465 times.
|
147465 | else if(!ladderx && !laddery && !getOnSideviewLadder() && !IsSideSwim()) |
| 8585 | { | ||
| 8586 | 147465 | fall += gravity3; | |
| 8587 | 147465 | used_grav_or_termv = true; | |
| 8588 | 147465 | } | |
| 8589 | 147465 | } | |
| 8590 |
2/2✓ Branch 0 taken 162228 times.
✓ Branch 1 taken 9351 times.
|
171579 | else if(needFall) |
| 8591 | { | ||
| 8592 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 9351 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
9351 | if (get_qr(qr_BETTER_PLAYER_JUMP_ANIM) && (fall != 0 || hoverclk > 0)) |
| 8593 | ✗ | jumping++; | |
| 8594 | 9351 | used_grav_or_termv = true; | |
| 8595 | 9351 | } | |
| 8596 | 319044 | } | |
| 8597 | else // Topdown gravity | ||
| 8598 | { | ||
| 8599 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 14518050 times.
✓ Branch 2 taken 14513922 times.
✓ Branch 3 taken 4128 times.
|
14518050 | if (!(moveflags & move_no_fake_z)) fakez-=fakefall/(spins && fakefall>0 ? 200:100); |
| 8600 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 14518050 times.
✓ Branch 2 taken 14513922 times.
✓ Branch 3 taken 4128 times.
|
14518050 | if (!(moveflags & move_no_real_z)) z-=fall/(spins && fall>0 ? 200:100); |
| 8601 |
3/4✓ Branch 0 taken 14498304 times.
✓ Branch 1 taken 19746 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 14498304 times.
|
14518050 | if(z>0||fakez>0) |
| 8602 | { | ||
| 8603 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 19746 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
19746 | switch(action) |
| 8604 | { | ||
| 8605 | case swimming: | ||
| 8606 | { | ||
| 8607 | ✗ | set_dive(0); | |
| 8608 | ✗ | action=walking; FFCore.setHeroAction(walking); | |
| 8609 | |||
| 8610 | ✗ | break; | |
| 8611 | } | ||
| 8612 | case waterhold1: | ||
| 8613 | { | ||
| 8614 | ✗ | action=landhold1; FFCore.setHeroAction(landhold1); | |
| 8615 | ✗ | break; | |
| 8616 | } | ||
| 8617 | |||
| 8618 | case waterhold2: | ||
| 8619 | { | ||
| 8620 | ✗ | action=landhold2; FFCore.setHeroAction(landhold2); | |
| 8621 | ✗ | break; | |
| 8622 | } | ||
| 8623 | |||
| 8624 | default: | ||
| 8625 | 19746 | break; | |
| 8626 | } | ||
| 8627 | 19746 | } | |
| 8628 | |||
| 8629 |
2/2✓ Branch 0 taken 162589 times.
✓ Branch 1 taken 14518050 times.
|
14680639 | for(int32_t j=0; j<chainlinks.Count(); j++) |
| 8630 | { | ||
| 8631 | 162589 | chainlinks.spr(j)->z=z; | |
| 8632 | 162589 | chainlinks.spr(j)->fakez=fakez; | |
| 8633 | 162589 | } | |
| 8634 | |||
| 8635 |
2/2✓ Branch 0 taken 14472858 times.
✓ Branch 1 taken 45192 times.
|
14518050 | if(Lwpns.idFirst(wHookshot)>-1) |
| 8636 | { | ||
| 8637 | 45192 | Lwpns.spr(Lwpns.idFirst(wHookshot))->z=z; | |
| 8638 | 45192 | Lwpns.spr(Lwpns.idFirst(wHookshot))->fakez=fakez; | |
| 8639 | 45192 | } | |
| 8640 | |||
| 8641 |
2/2✓ Branch 0 taken 14470420 times.
✓ Branch 1 taken 47630 times.
|
14518050 | if(Lwpns.idFirst(wHSHandle)>-1) |
| 8642 | { | ||
| 8643 | 47630 | Lwpns.spr(Lwpns.idFirst(wHSHandle))->z=z; | |
| 8644 | 47630 | Lwpns.spr(Lwpns.idFirst(wHSHandle))->fakez=fakez; | |
| 8645 | 47630 | } | |
| 8646 | |||
| 8647 |
3/4✓ Branch 0 taken 14498304 times.
✓ Branch 1 taken 19746 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 14498304 times.
|
14518050 | if(z<=0&&!(moveflags & move_no_real_z)) |
| 8648 | { | ||
| 8649 | 14498304 | auto oldfall = fall; | |
| 8650 | 14498304 | z = fall = 0; | |
| 8651 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 14498304 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
14498304 | if (fakez <= 0 || (moveflags & move_no_fake_z)) |
| 8652 | { | ||
| 8653 |
2/2✓ Branch 0 taken 453 times.
✓ Branch 1 taken 14497851 times.
|
14498304 | if(oldfall > 0) |
| 8654 | { | ||
| 8655 | 453 | land_on_ground(); | |
| 8656 | |||
| 8657 | 453 | stomping = true; | |
| 8658 | 453 | } | |
| 8659 | 14498304 | } | |
| 8660 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 14498304 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
14498304 | if (fakez <= 0 || (moveflags & move_no_fake_z)) |
| 8661 | { | ||
| 8662 | 14498304 | jumping = 0; | |
| 8663 |
2/2✓ Branch 0 taken 6348 times.
✓ Branch 1 taken 14491956 times.
|
14498304 | if(check_pitslide(true) == -1) |
| 8664 | { | ||
| 8665 | 14491956 | hoverclk = 0; | |
| 8666 | 14491956 | hoverflags = 0; | |
| 8667 | 14491956 | } | |
| 8668 | 6348 | else tick_hover(); | |
| 8669 | 14498304 | } | |
| 8670 | 14498304 | } | |
| 8671 |
2/4✓ Branch 0 taken 19746 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 19746 times.
|
19746 | else if(fakez<=0&&!(moveflags & move_no_fake_z)) |
| 8672 | { | ||
| 8673 | 19746 | auto oldfakefall = fakefall; | |
| 8674 | 19746 | fakez = fakefall = 0; | |
| 8675 |
2/4✓ Branch 0 taken 19746 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 19746 times.
|
19746 | if (z <= 0 || (moveflags & move_no_real_z)) |
| 8676 | { | ||
| 8677 | ✗ | if(oldfakefall > 0) | |
| 8678 | { | ||
| 8679 | ✗ | land_on_ground(); | |
| 8680 | |||
| 8681 | ✗ | stomping = true; | |
| 8682 | ✗ | } | |
| 8683 | ✗ | } | |
| 8684 |
2/4✓ Branch 0 taken 19746 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 19746 times.
|
19746 | if (z <= 0 || (moveflags & move_no_real_z)) |
| 8685 | { | ||
| 8686 | ✗ | jumping = 0; | |
| 8687 | ✗ | if(check_pitslide(true) == -1) | |
| 8688 | { | ||
| 8689 | ✗ | hoverclk = 0; | |
| 8690 | ✗ | hoverflags = 0; | |
| 8691 | ✗ | } | |
| 8692 | ✗ | else tick_hover(); | |
| 8693 | ✗ | } | |
| 8694 | 19746 | } | |
| 8695 |
8/10✓ Branch 0 taken 14517668 times.
✓ Branch 1 taken 382 times.
✓ Branch 2 taken 14517668 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 14479322 times.
✓ Branch 5 taken 38346 times.
✓ Branch 6 taken 14498686 times.
✓ Branch 7 taken 14459958 times.
✓ Branch 8 taken 14498686 times.
✗ Branch 9 not taken.
|
14518050 | if(fall <= termv && !(moveflags & move_no_real_z) && z>0 || fakefall <= termv && !(moveflags & move_no_fake_z) && fakez > 0) |
| 8696 | { | ||
| 8697 |
4/6✓ Branch 0 taken 3066 times.
✓ Branch 1 taken 16298 times.
✓ Branch 2 taken 3066 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 3066 times.
|
28978008 | if(fall != 0 || fakefall != 0 || hoverclk>0) |
| 8698 | 16298 | jumping++; | |
| 8699 | |||
| 8700 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 19364 times.
|
19364 | if(hoverclk > 0) |
| 8701 | { | ||
| 8702 | ✗ | if(tick_hover()) | |
| 8703 | { | ||
| 8704 | ✗ | if (!(moveflags & move_no_real_z) && z > 0) | |
| 8705 | { | ||
| 8706 | ✗ | if (fall <= termv) fall += gravity3; | |
| 8707 | ✗ | used_grav_or_termv = true; | |
| 8708 | ✗ | } | |
| 8709 | ✗ | if (!(moveflags & move_no_fake_z) && fakez > 0) | |
| 8710 | { | ||
| 8711 | ✗ | if (fakefall <= termv) fakefall += gravity3; | |
| 8712 | ✗ | used_grav_or_termv = true; | |
| 8713 | ✗ | } | |
| 8714 | ✗ | } | |
| 8715 | ✗ | } | |
| 8716 |
9/14✓ Branch 0 taken 11214 times.
✓ Branch 1 taken 8150 times.
✓ Branch 2 taken 3151 times.
✓ Branch 3 taken 8063 times.
✓ Branch 4 taken 3151 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 16213 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 16213 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 16213 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 19364 times.
✗ Branch 13 not taken.
|
19364 | else if (((fall + gravity3 > 0 && fall <= 0 && !(moveflags & move_no_real_z) && z > 0) || (fakefall + gravity3 > 0 && fakefall <= 0 && !(moveflags & move_no_fake_z) && fakez > 0)) |
| 8717 | 19364 | && try_hover()) | |
| 8718 | ✗ | used_grav_or_termv = true; | |
| 8719 | else | ||
| 8720 | { | ||
| 8721 |
2/4✓ Branch 0 taken 19364 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 19364 times.
✗ Branch 3 not taken.
|
19364 | if (!(moveflags & move_no_real_z) && z > 0) |
| 8722 | { | ||
| 8723 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 19364 times.
|
19364 | if (fall <= termv) fall += gravity3; |
| 8724 | 19364 | used_grav_or_termv = true; | |
| 8725 | 19364 | } | |
| 8726 |
2/4✓ Branch 0 taken 19364 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 19364 times.
|
19364 | if (!(moveflags & move_no_fake_z) && fakez > 0) |
| 8727 | { | ||
| 8728 | ✗ | if (fakefall <= termv) fakefall += gravity3; | |
| 8729 | ✗ | used_grav_or_termv = true; | |
| 8730 | ✗ | } | |
| 8731 | } | ||
| 8732 | 19364 | } | |
| 8733 |
5/10✓ Branch 0 taken 413 times.
✓ Branch 1 taken 14478909 times.
✓ Branch 2 taken 413 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 413 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 14478909 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
14479322 | if(fall > termv && !(moveflags & move_no_real_z) && z>0 || fakefall > termv && !(moveflags & move_no_fake_z) && fakez > 0) |
| 8734 | { | ||
| 8735 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 413 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
413 | if (get_qr(qr_BETTER_PLAYER_JUMP_ANIM) && (fall != 0 || fakefall != 0 || hoverclk > 0)) |
| 8736 | ✗ | jumping++; | |
| 8737 | 413 | used_grav_or_termv = true; | |
| 8738 | 413 | } | |
| 8739 |
1/2✓ Branch 0 taken 14479322 times.
✗ Branch 1 not taken.
|
14479322 | if (fakez<0) fakez = 0; |
| 8740 |
1/2✓ Branch 0 taken 14479322 times.
✗ Branch 1 not taken.
|
14479322 | if (z<0) z = 0; |
| 8741 | } | ||
| 8742 | |||
| 8743 |
1/2✓ Branch 0 taken 14837094 times.
✗ Branch 1 not taken.
|
14837094 | if (handle_termv()) |
| 8744 | ✗ | used_grav_or_termv = true; | |
| 8745 | |||
| 8746 |
3/4✓ Branch 0 taken 176562 times.
✓ Branch 1 taken 14660532 times.
✓ Branch 2 taken 176562 times.
✗ Branch 3 not taken.
|
14837094 | if (used_grav_or_termv && last_grav_boots_id > -1) // if the gravity boots affected the player's falling, charge their cost |
| 8747 | ✗ | paymagiccost(last_grav_boots_id); | |
| 8748 | |||
| 8749 |
2/2✓ Branch 0 taken 3798296064 times.
✓ Branch 1 taken 14837094 times.
|
3813133158 | for (int q = 0; q < MAXITEMS; ++q) |
| 8750 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3798296064 times.
|
3798296064 | if (item_cooldown[q] > 0) |
| 8751 | ✗ | --item_cooldown[q]; | |
| 8752 | |||
| 8753 |
2/2✓ Branch 0 taken 14836346 times.
✓ Branch 1 taken 748 times.
|
14837094 | if(drunkclk) |
| 8754 | { | ||
| 8755 | 748 | --drunkclk; | |
| 8756 | 748 | } | |
| 8757 | |||
| 8758 |
2/2✓ Branch 0 taken 14835730 times.
✓ Branch 1 taken 1364 times.
|
14837094 | if(lstunclock > 0) |
| 8759 | { | ||
| 8760 | // also cancel Hero's attack | ||
| 8761 | 1364 | attackclk = 0; | |
| 8762 | |||
| 8763 |
2/2✓ Branch 0 taken 1032 times.
✓ Branch 1 taken 332 times.
|
1364 | if( FFCore.getHeroAction() != stunned ) |
| 8764 | { | ||
| 8765 | 332 | tempaction=action; //update so future checks won't do this | |
| 8766 | //action=freeze; //setting this makes the player invincible while stunned -V | ||
| 8767 | 332 | FFCore.setHeroAction(stunned); | |
| 8768 | 332 | } | |
| 8769 | 1364 | --lstunclock; | |
| 8770 | 1364 | } | |
| 8771 | //if the stun action is still set in FFCore, but he isn't stunned, then the timer reached 0 | ||
| 8772 | //, so we unfreeze him here, and return him to the action that he had when he was stunned. | ||
| 8773 |
4/4✓ Branch 0 taken 1365 times.
✓ Branch 1 taken 14835729 times.
✓ Branch 2 taken 1290 times.
✓ Branch 3 taken 75 times.
|
14837094 | if ( FFCore.getHeroAction() == stunned && !lstunclock ) |
| 8774 | { | ||
| 8775 | 75 | action=tempaction; FFCore.setHeroAction(tempaction); | |
| 8776 | 75 | } | |
| 8777 | |||
| 8778 |
1/2✓ Branch 0 taken 14837094 times.
✗ Branch 1 not taken.
|
14837094 | if( lbunnyclock > 0 ) |
| 8779 | { | ||
| 8780 | ✗ | --lbunnyclock; | |
| 8781 | ✗ | } | |
| 8782 |
2/2✓ Branch 0 taken 1925 times.
✓ Branch 1 taken 14835169 times.
|
14837094 | if(DMaps[cur_dmap].flags&dmfBUNNYIFNOPEARL) |
| 8783 | { | ||
| 8784 | 1925 | int32_t itemid = current_item_id(itype_pearl); | |
| 8785 |
2/2✓ Branch 0 taken 123 times.
✓ Branch 1 taken 1802 times.
|
1925 | if(itemid > -1) |
| 8786 | { | ||
| 8787 |
2/2✓ Branch 0 taken 122 times.
✓ Branch 1 taken 1 times.
|
123 | if(lbunnyclock == -1) //cure dmap-caused bunny effect |
| 8788 | 1 | lbunnyclock = 0; | |
| 8789 | 123 | } | |
| 8790 |
2/2✓ Branch 0 taken 1801 times.
✓ Branch 1 taken 1 times.
|
1802 | else if(lbunnyclock > -1) //No pearl, force into bunny mode |
| 8791 | { | ||
| 8792 | 1 | lbunnyclock = -1; | |
| 8793 | 1 | } | |
| 8794 | 1925 | } | |
| 8795 |
1/2✓ Branch 0 taken 14835169 times.
✗ Branch 1 not taken.
|
14835169 | else if(lbunnyclock == -1) //dmap-caused bunny effect |
| 8796 | { | ||
| 8797 | ✗ | lbunnyclock = 0; | |
| 8798 | ✗ | } | |
| 8799 | |||
| 8800 |
7/20✗ Branch 0 not taken.
✓ Branch 1 taken 14837094 times.
✓ Branch 2 taken 14837094 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 14837094 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 14837094 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 14837094 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 14837094 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 14837094 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
|
29674188 | bool is_broken_behavior = replay_is_active() && replay_get_meta_str("sav") == "link_to_the_zelda_2_of_3.sav"; |
| 8801 |
5/6✓ Branch 0 taken 174782 times.
✓ Branch 1 taken 14662312 times.
✓ Branch 2 taken 19400 times.
✓ Branch 3 taken 155382 times.
✓ Branch 4 taken 14681712 times.
✗ Branch 5 not taken.
|
29518806 | bool fall_check = (fall == 0 || z > 0) && (fakefall == 0 || fakez > 0); |
| 8802 |
2/2✓ Branch 0 taken 14520301 times.
✓ Branch 1 taken 316793 times.
|
14837094 | if (is_broken_behavior) |
| 8803 |
5/6✓ Branch 0 taken 1196 times.
✓ Branch 1 taken 315597 times.
✓ Branch 2 taken 156 times.
✓ Branch 3 taken 1040 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1040 times.
|
316793 | fall_check = (fall == 0 || z > 0) || (fakefall == 0 || fakez > 0); |
| 8804 | |||
| 8805 |
11/14✓ Branch 0 taken 14781769 times.
✓ Branch 1 taken 55325 times.
✓ Branch 2 taken 9705831 times.
✓ Branch 3 taken 5075938 times.
✓ Branch 4 taken 9705831 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 9705831 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 9705821 times.
✓ Branch 9 taken 10 times.
✓ Branch 10 taken 9704012 times.
✓ Branch 11 taken 1809 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 9624720 times.
|
24461814 | if(!is_on_conveyor && !(diagonalMovement||NO_GRIDLOCK) && fall_check && charging==0 && spins<=5 |
| 8806 |
4/4✓ Branch 0 taken 9703418 times.
✓ Branch 1 taken 594 times.
✓ Branch 2 taken 9624720 times.
✓ Branch 3 taken 78698 times.
|
9704012 | && action != gothit && !is_autowalking()) |
| 8807 | { | ||
| 8808 |
2/3✓ Branch 0 taken 4350755 times.
✓ Branch 1 taken 5273965 times.
✗ Branch 2 not taken.
|
9624720 | switch(dir) |
| 8809 | { | ||
| 8810 | case up: | ||
| 8811 | case down: | ||
| 8812 | 4350755 | x = TRUNCATE_HALF_TILE(x.getInt() + 4); | |
| 8813 | 4350755 | break; | |
| 8814 | |||
| 8815 | case left: | ||
| 8816 | case right: | ||
| 8817 | 5273965 | y = TRUNCATE_HALF_TILE(y.getInt() + 4); | |
| 8818 | 5273965 | break; | |
| 8819 | } | ||
| 8820 | 9624720 | } | |
| 8821 | |||
| 8822 |
4/4✓ Branch 0 taken 137817 times.
✓ Branch 1 taken 14699277 times.
✓ Branch 2 taken 85523 times.
✓ Branch 3 taken 52294 times.
|
14837094 | if((watch==true) && clockclk) |
| 8823 | { | ||
| 8824 | 52294 | --clockclk; | |
| 8825 | |||
| 8826 |
2/2✓ Branch 0 taken 52151 times.
✓ Branch 1 taken 143 times.
|
52294 | if(!clockclk) |
| 8827 | { | ||
| 8828 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 143 times.
|
143 | if(cheat_superman==false) |
| 8829 | { | ||
| 8830 | 143 | setClock(false); | |
| 8831 | 143 | } | |
| 8832 | |||
| 8833 | 143 | watch=false; | |
| 8834 | |||
| 8835 |
2/2✓ Branch 0 taken 7 times.
✓ Branch 1 taken 143 times.
|
150 | for (auto it : clock_zoras) |
| 8836 | { | ||
| 8837 | 7 | int screen = it.first; | |
| 8838 | 7 | int id = it.second; | |
| 8839 | 7 | addenemy(screen,0,0,id,0); | |
| 8840 | } | ||
| 8841 | 143 | } | |
| 8842 | 52294 | } | |
| 8843 | |||
| 8844 |
4/4✓ Branch 0 taken 14789464 times.
✓ Branch 1 taken 47630 times.
✓ Branch 2 taken 8704 times.
✓ Branch 3 taken 14780760 times.
|
14837094 | if(hookshot_frozen || switch_hooked) |
| 8845 | { | ||
| 8846 |
2/2✓ Branch 0 taken 55918 times.
✓ Branch 1 taken 416 times.
|
56334 | bool snap_player = hs_fix && replay_version_check(46); |
| 8847 |
4/4✓ Branch 0 taken 11142 times.
✓ Branch 1 taken 45192 times.
✓ Branch 2 taken 8704 times.
✓ Branch 3 taken 2438 times.
|
56334 | if(hookshot_used || switch_hooked) |
| 8848 | { | ||
| 8849 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 53896 times.
|
53896 | if (IsSideSwim()) {action=sideswimfreeze; FFCore.setHeroAction(sideswimfreeze);} |
| 8850 | 53896 | else {action=freeze; FFCore.setHeroAction(freeze);} //could be LA_HOOKSHOT for FFCore. -Z | |
| 8851 | |||
| 8852 |
3/4✓ Branch 0 taken 36429 times.
✓ Branch 1 taken 17467 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 36429 times.
|
53896 | if(pull_hero || switch_hooked) |
| 8853 | { | ||
| 8854 |
3/4✓ Branch 0 taken 8703 times.
✓ Branch 1 taken 8764 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 8703 times.
|
17467 | if(hs_switcher || switch_hooked) |
| 8855 | { | ||
| 8856 | 8764 | hs_fix = false; | |
| 8857 |
1/2✓ Branch 0 taken 8764 times.
✗ Branch 1 not taken.
|
8764 | if(switchhookclk) |
| 8858 | { | ||
| 8859 | 8764 | --switchhookclk; | |
| 8860 |
2/2✓ Branch 0 taken 137 times.
✓ Branch 1 taken 8627 times.
|
8764 | if(switchhookclk==switchhookmaxtime/2) //Perform swaps |
| 8861 | { | ||
| 8862 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 137 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
137 | if(switchhook_cost_item > -1 && !checkmagiccost(switchhook_cost_item)) |
| 8863 | ✗ | reset_hookshot(); | |
| 8864 | else | ||
| 8865 | { | ||
| 8866 | 137 | weapon *w = (weapon*)Lwpns.spr(Lwpns.idFirst(wHookshot)), | |
| 8867 | 137 | *hw = (weapon*)Lwpns.spr(Lwpns.idFirst(wHSHandle)); | |
| 8868 | |||
| 8869 |
2/2✓ Branch 0 taken 132 times.
✓ Branch 1 taken 5 times.
|
137 | if(hooked_comborpos != rpos_t::None) //Switching combos |
| 8870 | { | ||
| 8871 | 132 | rpos_t targrpos = hooked_comborpos, plrpos = COMBOPOS_REGION_B(x+8,y+8); | |
| 8872 |
3/6✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 132 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 132 times.
|
132 | if (hooked_layerbits && is_valid_rpos(targrpos) && is_valid_rpos(plrpos)) |
| 8873 | { | ||
| 8874 |
1/2✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
|
132 | int32_t max_layer = get_qr(qr_HOOKSHOTALLLAYER) ? 6 : (get_qr(qr_HOOKSHOTLAYERFIX) ? 2 : 0); |
| 8875 |
2/2✓ Branch 0 taken 924 times.
✓ Branch 1 taken 132 times.
|
1056 | for(int q = max_layer; q > -1; --q) |
| 8876 | { | ||
| 8877 |
2/2✓ Branch 0 taken 792 times.
✓ Branch 1 taken 132 times.
|
924 | if(!(hooked_layerbits & (1<<q))) |
| 8878 | 792 | continue; //non-switching layer | |
| 8879 | |||
| 8880 | 132 | auto target_rpos_handle = get_rpos_handle(targrpos, q); | |
| 8881 | 132 | auto player_rpos_handle = get_rpos_handle(plrpos, q); | |
| 8882 | |||
| 8883 | 132 | mapscr* target_scr = target_rpos_handle.scr; | |
| 8884 | |||
| 8885 | 132 | auto& cmb = target_rpos_handle.combo(); | |
| 8886 | 132 | int32_t srcfl = target_rpos_handle.sflag(); | |
| 8887 | 132 | auto& cmb2 = player_rpos_handle.combo(); | |
| 8888 | 132 | int32_t c = player_rpos_handle.data(), | |
| 8889 | 132 | cs = player_rpos_handle.cset(), | |
| 8890 | 132 | fl = player_rpos_handle.sflag(); | |
| 8891 | //{Check push status | ||
| 8892 | 132 | bool isFakePush = false; | |
| 8893 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 132 times.
|
132 | if(cmb.type == cSWITCHHOOK) |
| 8894 | { | ||
| 8895 |
1/2✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
|
132 | if(cmb.usrflags&cflag7) //counts as 'pushblock' |
| 8896 | ✗ | isFakePush = true; | |
| 8897 | 132 | } | |
| 8898 | 132 | bool isPush = isFakePush; | |
| 8899 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 132 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 132 times.
|
132 | if(!isPush) switch(srcfl) |
| 8900 | { | ||
| 8901 | case mfPUSHUD: case mfPUSHUDNS: case mfPUSHUDINS: | ||
| 8902 | case mfPUSHLR: case mfPUSHLRNS: case mfPUSHLRINS: | ||
| 8903 | case mfPUSHU: case mfPUSHUNS: case mfPUSHUINS: | ||
| 8904 | case mfPUSHD: case mfPUSHDNS: case mfPUSHDINS: | ||
| 8905 | case mfPUSHL: case mfPUSHLNS: case mfPUSHLINS: | ||
| 8906 | case mfPUSHR: case mfPUSHRNS: case mfPUSHRINS: | ||
| 8907 | case mfPUSH4: case mfPUSH4NS: case mfPUSH4INS: | ||
| 8908 | ✗ | isPush = true; | |
| 8909 | 132 | } | |
| 8910 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 132 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 132 times.
|
132 | if(!isPush) switch(cmb.flag) |
| 8911 | { | ||
| 8912 | case mfPUSHUD: case mfPUSHUDNS: case mfPUSHUDINS: | ||
| 8913 | case mfPUSHLR: case mfPUSHLRNS: case mfPUSHLRINS: | ||
| 8914 | case mfPUSHU: case mfPUSHUNS: case mfPUSHUINS: | ||
| 8915 | case mfPUSHD: case mfPUSHDNS: case mfPUSHDINS: | ||
| 8916 | case mfPUSHL: case mfPUSHLNS: case mfPUSHLINS: | ||
| 8917 | case mfPUSHR: case mfPUSHRNS: case mfPUSHRINS: | ||
| 8918 | case mfPUSH4: case mfPUSH4NS: case mfPUSH4INS: | ||
| 8919 | ✗ | isPush = true; | |
| 8920 | 132 | } | |
| 8921 |
1/2✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
|
132 | if(srcfl==mfPUSHED) isPush = false; |
| 8922 | //} | ||
| 8923 |
1/2✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
|
132 | if(cmb.type == cSWITCHHOOK) //custom flags and such |
| 8924 | { | ||
| 8925 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 132 times.
|
132 | if(cmb.usrflags&cflag3) //Breaks on swap |
| 8926 | { | ||
| 8927 | ✗ | int32_t it = -1; | |
| 8928 | ✗ | int32_t thedropset = -1; | |
| 8929 | ✗ | if(cmb.usrflags&cflag4) //drop item | |
| 8930 | { | ||
| 8931 | ✗ | if(cmb.usrflags&cflag5) | |
| 8932 | ✗ | it = cmb.attribytes[2]; | |
| 8933 | else | ||
| 8934 | { | ||
| 8935 | ✗ | it = select_dropitem(cmb.attribytes[2]); | |
| 8936 | ✗ | thedropset = cmb.attribytes[2]; | |
| 8937 | } | ||
| 8938 | ✗ | } | |
| 8939 | |||
| 8940 | ✗ | breakable* br = new breakable(x, y, 0_zf, | |
| 8941 | ✗ | cmb, target_rpos_handle.cset(), it, thedropset, cmb.attribytes[2], | |
| 8942 | ✗ | cmb.attribytes[1] ? -1 : 0, cmb.attribytes[1], switchhookclk); | |
| 8943 | ✗ | br->switch_hooked = true; | |
| 8944 | ✗ | decorations.add(br); | |
| 8945 | ✗ | hooked_layerbits &= ~(0x101<<q); //this swap completed entirely | |
| 8946 | ✗ | hooked_undercombos[q] = -1; | |
| 8947 | |||
| 8948 | ✗ | if(cmb.usrflags&cflag6) | |
| 8949 | { | ||
| 8950 | ✗ | target_rpos_handle.increment_data(); | |
| 8951 | ✗ | } | |
| 8952 | else | ||
| 8953 | { | ||
| 8954 | ✗ | target_rpos_handle.set_data(target_scr->undercombo); | |
| 8955 | ✗ | target_rpos_handle.set_cset(target_scr->undercset); | |
| 8956 | ✗ | if(cmb.usrflags&cflag2) | |
| 8957 | ✗ | target_rpos_handle.set_sflag(0); | |
| 8958 | } | ||
| 8959 | ✗ | } | |
| 8960 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 132 times.
|
132 | else if(isPush) |
| 8961 | { | ||
| 8962 | //Simulate a block clicking into place | ||
| 8963 | ✗ | movingblock mtemp; | |
| 8964 | ✗ | mtemp.clear(); | |
| 8965 | |||
| 8966 | ✗ | auto [mx, my] = COMBOXY_REGION(plrpos); | |
| 8967 | |||
| 8968 | ✗ | mtemp.set(mx,my,target_rpos_handle.data(),target_rpos_handle.cset(),q,target_rpos_handle.sflag()); | |
| 8969 | ✗ | mtemp.dir = getPushDir(target_rpos_handle.sflag()); | |
| 8970 | ✗ | if(mtemp.dir < 0) | |
| 8971 | ✗ | mtemp.dir = getPushDir(cmb.flag); | |
| 8972 | ✗ | mtemp.clk = 1; | |
| 8973 | ✗ | mtemp.force_many = isFakePush; | |
| 8974 | ✗ | mtemp.no_icy = true; | |
| 8975 | ✗ | mtemp.animate(0); | |
| 8976 | ✗ | if((mtemp.bhole || mtemp.trigger) | |
| 8977 | ✗ | && (fl == mfBLOCKTRIGGER || fl == mfBLOCKHOLE | |
| 8978 | ✗ | || cmb2.flag == mfBLOCKTRIGGER | |
| 8979 | ✗ | || cmb2.flag == mfBLOCKHOLE)) | |
| 8980 | { | ||
| 8981 | ✗ | target_rpos_handle.set_data(target_scr->undercombo); | |
| 8982 | ✗ | target_rpos_handle.set_cset(target_scr->undercset); | |
| 8983 | ✗ | target_rpos_handle.set_sflag(0); | |
| 8984 | ✗ | } | |
| 8985 | else | ||
| 8986 | { | ||
| 8987 | ✗ | target_rpos_handle.set_data(c); | |
| 8988 | ✗ | target_rpos_handle.set_cset(cs); | |
| 8989 | ✗ | if(cmb.usrflags&cflag2) | |
| 8990 | ✗ | target_rpos_handle.set_sflag(fl); | |
| 8991 | else | ||
| 8992 | ✗ | target_rpos_handle.set_sflag(0); | |
| 8993 | } | ||
| 8994 | ✗ | } | |
| 8995 | else | ||
| 8996 | { | ||
| 8997 | 132 | player_rpos_handle.set_data(target_rpos_handle.data()); | |
| 8998 | 132 | player_rpos_handle.set_cset(target_rpos_handle.cset()); | |
| 8999 |
1/2✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
|
132 | if(cmb.usrflags&cflag2) |
| 9000 | ✗ | player_rpos_handle.set_sflag(target_rpos_handle.sflag()); | |
| 9001 | |||
| 9002 | 132 | target_rpos_handle.set_data(c); | |
| 9003 | 132 | target_rpos_handle.set_cset(cs); | |
| 9004 |
1/2✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
|
132 | if(cmb.usrflags&cflag2) |
| 9005 | ✗ | target_rpos_handle.set_sflag(fl); | |
| 9006 | } | ||
| 9007 | 132 | } | |
| 9008 | ✗ | else if(isCuttableType(cmb.type)) //Break and drop effects | |
| 9009 | { | ||
| 9010 | ✗ | int32_t breakcs = target_rpos_handle.cset(); | |
| 9011 | ✗ | if(isCuttableNextType(cmb.type)) //next instead of undercmb | |
| 9012 | { | ||
| 9013 | ✗ | target_rpos_handle.increment_data(); | |
| 9014 | ✗ | } | |
| 9015 | else | ||
| 9016 | { | ||
| 9017 | ✗ | target_rpos_handle.set_data(target_scr->undercombo); | |
| 9018 | ✗ | target_rpos_handle.set_cset(target_scr->undercset); | |
| 9019 | ✗ | target_rpos_handle.set_sflag(0); | |
| 9020 | } | ||
| 9021 | |||
| 9022 | ✗ | int32_t it = -1; | |
| 9023 | ✗ | int32_t thedropset = -1; | |
| 9024 | ✗ | if(isCuttableItemType(cmb.type)) //Drop an item | |
| 9025 | { | ||
| 9026 | ✗ | if ( (cmb.usrflags&cflag2) ) | |
| 9027 | { | ||
| 9028 | ✗ | if(cmb.usrflags&cflag11) | |
| 9029 | ✗ | it = cmb.attribytes[1]; | |
| 9030 | else | ||
| 9031 | { | ||
| 9032 | ✗ | it = select_dropitem(cmb.attribytes[1]); | |
| 9033 | ✗ | thedropset = cmb.attribytes[1]; | |
| 9034 | } | ||
| 9035 | ✗ | } | |
| 9036 | else | ||
| 9037 | { | ||
| 9038 | ✗ | it = select_dropitem(12); | |
| 9039 | ✗ | thedropset = 12; | |
| 9040 | } | ||
| 9041 | ✗ | } | |
| 9042 | |||
| 9043 | ✗ | byte breaksfx = 0; | |
| 9044 | ✗ | if(get_qr(qr_MORESOUNDS)) //SFX | |
| 9045 | { | ||
| 9046 | ✗ | if (cmb.usrflags&cflag3) | |
| 9047 | { | ||
| 9048 | ✗ | breaksfx = cmb.attribytes[2]; | |
| 9049 | ✗ | } | |
| 9050 | ✗ | else if(isBushType(cmb.type) | |
| 9051 | ✗ | || isFlowersType(cmb.type) | |
| 9052 | ✗ | || isGrassType(cmb.type)) | |
| 9053 | { | ||
| 9054 | ✗ | breaksfx = QMisc.miscsfx[sfxBUSHGRASS]; | |
| 9055 | ✗ | } | |
| 9056 | ✗ | } | |
| 9057 | |||
| 9058 | //Clipping sprite | ||
| 9059 | ✗ | int16_t decotype = (cmb.usrflags & cflag1) ? | |
| 9060 | ✗ | ((cmb.usrflags & cflag10) | |
| 9061 | ✗ | ? (cmb.attribytes[0]) | |
| 9062 | : (-1)) | ||
| 9063 | : (0); | ||
| 9064 | ✗ | if(decotype > 3) decotype = 0; | |
| 9065 | ✗ | if(!decotype) | |
| 9066 | ✗ | decotype = (isBushType(cmb.type) ? 1 | |
| 9067 | ✗ | : (isFlowersType(cmb.type) ? 2 | |
| 9068 | ✗ | : (isGrassType(cmb.type) ? 3 | |
| 9069 | ✗ | : ((cmb.usrflags & cflag1) ? -1 | |
| 9070 | : -2)))); | ||
| 9071 | |||
| 9072 | ✗ | breakable* br = new breakable(x, y, 0_zf, | |
| 9073 | ✗ | cmb, breakcs, it, thedropset, breaksfx, | |
| 9074 | ✗ | decotype, cmb.attribytes[0], switchhookclk); | |
| 9075 | ✗ | br->switch_hooked = true; | |
| 9076 | ✗ | decorations.add(br); | |
| 9077 | ✗ | hooked_layerbits &= ~(0x101<<q); //this swap completed entirely | |
| 9078 | ✗ | hooked_undercombos[q] = -1; | |
| 9079 | ✗ | } | |
| 9080 | else //Unknown type, just swap combos. | ||
| 9081 | { | ||
| 9082 | ✗ | if(isPush) | |
| 9083 | { | ||
| 9084 | //Simulate a block clicking into place | ||
| 9085 | ✗ | movingblock mtemp; | |
| 9086 | ✗ | mtemp.clear(); | |
| 9087 | |||
| 9088 | ✗ | auto [mx, my] = COMBOXY_REGION(plrpos); | |
| 9089 | |||
| 9090 | ✗ | mtemp.set(mx,my,target_rpos_handle.data(),target_rpos_handle.cset(),q,target_rpos_handle.sflag()); | |
| 9091 | ✗ | mtemp.dir = getPushDir(target_rpos_handle.sflag()); | |
| 9092 | ✗ | if(mtemp.dir < 0) | |
| 9093 | ✗ | mtemp.dir = getPushDir(cmb.flag); | |
| 9094 | ✗ | mtemp.clk = 1; | |
| 9095 | ✗ | mtemp.animate(0); | |
| 9096 | ✗ | if(mtemp.bhole || mtemp.trigger) | |
| 9097 | { | ||
| 9098 | ✗ | target_rpos_handle.set_data(target_scr->undercombo); | |
| 9099 | ✗ | target_rpos_handle.set_cset(target_scr->undercset); | |
| 9100 | ✗ | target_rpos_handle.set_sflag(0); | |
| 9101 | ✗ | } | |
| 9102 | else | ||
| 9103 | { | ||
| 9104 | ✗ | target_rpos_handle.set_data(c); | |
| 9105 | ✗ | target_rpos_handle.set_cset(cs); | |
| 9106 | ✗ | target_rpos_handle.set_sflag(0); | |
| 9107 | } | ||
| 9108 | ✗ | } | |
| 9109 | else | ||
| 9110 | { | ||
| 9111 | ✗ | player_rpos_handle.set_data(target_rpos_handle.data()); | |
| 9112 | ✗ | player_rpos_handle.set_cset(target_rpos_handle.cset()); | |
| 9113 | ✗ | target_rpos_handle.set_data(c); | |
| 9114 | ✗ | target_rpos_handle.set_cset(cs); | |
| 9115 | } | ||
| 9116 | } | ||
| 9117 | 132 | } | |
| 9118 |
1/2✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
|
132 | if(switchhook_cost_item > -1) |
| 9119 | ✗ | paymagiccost(switchhook_cost_item); | |
| 9120 | 132 | zfix tx = x, ty = y; | |
| 9121 | |||
| 9122 | //Position the player at the combo | ||
| 9123 | 132 | std::tie(x, y) = COMBOXY_REGION(targrpos); | |
| 9124 | |||
| 9125 | 132 | dir = oppositeDir[dir]; | |
| 9126 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 132 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
132 | if(w && hw) |
| 9127 | { | ||
| 9128 | //Calculate chain shift | ||
| 9129 | ✗ | zfix dx = (x-tx); | |
| 9130 | ✗ | zfix dy = (y-ty); | |
| 9131 | ✗ | if(w->dir < 4) | |
| 9132 | { | ||
| 9133 | ✗ | if(w->dir & 2) | |
| 9134 | ✗ | dx = 0; | |
| 9135 | ✗ | else dy = 0; | |
| 9136 | ✗ | } | |
| 9137 | //Position the hook head at the handle | ||
| 9138 | ✗ | w->x = hw->x + dx; | |
| 9139 | ✗ | w->y = hw->y + dy; | |
| 9140 | ✗ | w->dir = oppositeDir[w->dir]; | |
| 9141 | ✗ | w->doAutoRotate(true); | |
| 9142 | ✗ | byte hflip = (w->dir > 3 ? 3 : ((w->dir & 2) ? 1 : 2)); | |
| 9143 | ✗ | w->flip ^= hflip; | |
| 9144 | //Position the handle appropriately | ||
| 9145 | ✗ | hw->x = x-(hw->x-tx); | |
| 9146 | ✗ | hw->y = y-(hw->y-ty); | |
| 9147 | ✗ | hw->dir = oppositeDir[hw->dir]; | |
| 9148 | ✗ | hw->doAutoRotate(true); | |
| 9149 | ✗ | hw->flip ^= hflip; | |
| 9150 | //Move chains | ||
| 9151 | ✗ | for(int32_t j=0; j<chainlinks.Count(); j++) | |
| 9152 | { | ||
| 9153 | ✗ | chainlinks.spr(j)->x += dx; | |
| 9154 | ✗ | chainlinks.spr(j)->y += dy; | |
| 9155 | ✗ | } | |
| 9156 | ✗ | } | |
| 9157 | 132 | hooked_comborpos = plrpos; //flip positions | |
| 9158 | 132 | } | |
| 9159 | ✗ | else reset_hookshot(); | |
| 9160 | 132 | } | |
| 9161 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
|
5 | else if(switching_object) //Switching an object |
| 9162 | { | ||
| 9163 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if(switchhook_cost_item > -1) |
| 9164 | ✗ | paymagiccost(switchhook_cost_item); | |
| 9165 | 5 | zfix tx = x, ty = y; | |
| 9166 | //Position the player at the object | ||
| 9167 | 5 | x = switching_object->x; | |
| 9168 | 5 | y = switching_object->y; | |
| 9169 | 5 | dir = oppositeDir[dir]; | |
| 9170 | //Position the object at the player | ||
| 9171 | 5 | switching_object->x = tx; | |
| 9172 | 5 | switching_object->y = ty; | |
| 9173 |
3/4✓ Branch 0 taken 3 times.
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 3 times.
|
5 | if(switching_object->dir == dir || switching_object->dir == oppositeDir[dir]) |
| 9174 | 2 | switching_object->dir = oppositeDir[switching_object->dir]; | |
| 9175 | 5 | solid_update(false); | |
| 9176 | 5 | switching_object->solid_update(false); | |
| 9177 |
2/4✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
5 | if(item* it = dynamic_cast<item*>(switching_object)) |
| 9178 | { | ||
| 9179 | ✗ | if(itemsbuf[it->id].type == itype_fairy && itemsbuf[it->id].misc3) | |
| 9180 | { | ||
| 9181 | ✗ | movefairynew2(it->x, it->y, *it); | |
| 9182 | ✗ | } | |
| 9183 | ✗ | } | |
| 9184 |
3/4✓ Branch 0 taken 1 times.
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1 times.
|
5 | if(w && hw) //!TODO No fucking clue if diagonals work |
| 9185 | { | ||
| 9186 | //Calculate chain shift | ||
| 9187 | 1 | zfix dx = (x-tx); | |
| 9188 | 1 | zfix dy = (y-ty); | |
| 9189 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | if(w->dir < 4) |
| 9190 | { | ||
| 9191 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | if(w->dir & 2) |
| 9192 | 1 | dx = 0; | |
| 9193 | ✗ | else dy = 0; | |
| 9194 | 1 | } | |
| 9195 | //Position the hook head at the handle | ||
| 9196 | 1 | w->x = hw->x + dx; | |
| 9197 | 1 | w->y = hw->y + dy; | |
| 9198 | 1 | w->dir = oppositeDir[w->dir]; | |
| 9199 | 1 | w->doAutoRotate(true); | |
| 9200 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | byte hflip = (w->dir > 3 ? 3 : ((w->dir & 2) ? 1 : 2)); |
| 9201 | 1 | w->flip ^= hflip; | |
| 9202 | 1 | w->solid_update(false); | |
| 9203 | //Position the handle appropriately | ||
| 9204 | 1 | hw->x = x-(hw->x-tx); | |
| 9205 | 1 | hw->y = y-(hw->y-ty); | |
| 9206 | 1 | hw->dir = oppositeDir[hw->dir]; | |
| 9207 | 1 | hw->doAutoRotate(true); | |
| 9208 | 1 | hw->flip ^= hflip; | |
| 9209 | 1 | hw->solid_update(false); | |
| 9210 | //Move chains | ||
| 9211 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 1 times.
|
6 | for(int32_t j=0; j<chainlinks.Count(); j++) |
| 9212 | { | ||
| 9213 | 5 | chainlinks.spr(j)->x += dx; | |
| 9214 | 5 | chainlinks.spr(j)->y += dy; | |
| 9215 | 5 | } | |
| 9216 | 1 | } | |
| 9217 | 5 | } | |
| 9218 | } | ||
| 9219 | 137 | } | |
| 9220 |
2/2✓ Branch 0 taken 8490 times.
✓ Branch 1 taken 137 times.
|
8627 | else if(!switchhookclk) |
| 9221 | { | ||
| 9222 | 137 | reset_hookshot(); | |
| 9223 | 137 | } | |
| 9224 | 8764 | } | |
| 9225 | ✗ | else reset_hookshot(); | |
| 9226 | 8764 | } | |
| 9227 | else | ||
| 9228 | { | ||
| 9229 | sprite *t; | ||
| 9230 | int32_t i; | ||
| 9231 | |||
| 9232 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 8879 times.
✓ Branch 2 taken 176 times.
✓ Branch 3 taken 8703 times.
|
8879 | for(i=0; i<Lwpns.Count() && (Lwpns.spr(i)->id!=wHSHandle); i++) |
| 9233 | { | ||
| 9234 | /* do nothing */ | ||
| 9235 | 176 | } | |
| 9236 | |||
| 9237 | 8703 | t = Lwpns.spr(i); | |
| 9238 | |||
| 9239 |
2/2✓ Branch 0 taken 18189 times.
✓ Branch 1 taken 8703 times.
|
26892 | for(i=0; i<Lwpns.Count(); i++) |
| 9240 | { | ||
| 9241 | 18189 | sprite *s = Lwpns.spr(i); | |
| 9242 | |||
| 9243 |
2/2✓ Branch 0 taken 9486 times.
✓ Branch 1 taken 8703 times.
|
18189 | if(s->id==wHookshot) |
| 9244 | { | ||
| 9245 |
2/2✓ Branch 0 taken 2098 times.
✓ Branch 1 taken 6605 times.
|
8703 | if (abs((s->y) - y) >= 1) |
| 9246 | { | ||
| 9247 |
2/2✓ Branch 0 taken 1219 times.
✓ Branch 1 taken 879 times.
|
2098 | if((s->y)>y) |
| 9248 | { | ||
| 9249 | 879 | y+=4; | |
| 9250 | |||
| 9251 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 879 times.
|
879 | if(Lwpns.idFirst(wHSHandle)!=-1) |
| 9252 | { | ||
| 9253 | 879 | t->y+=4; | |
| 9254 | 879 | } | |
| 9255 | |||
| 9256 | 879 | hs_starty+=4; | |
| 9257 | 879 | } | |
| 9258 | |||
| 9259 |
2/2✓ Branch 0 taken 879 times.
✓ Branch 1 taken 1219 times.
|
2098 | if((s->y)<y) |
| 9260 | { | ||
| 9261 | 1219 | y-=4; | |
| 9262 | |||
| 9263 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1219 times.
|
1219 | if(Lwpns.idFirst(wHSHandle)!=-1) |
| 9264 | { | ||
| 9265 | 1219 | t->y-=4; | |
| 9266 | 1219 | } | |
| 9267 | |||
| 9268 | 1219 | hs_starty-=4; | |
| 9269 | 1219 | } | |
| 9270 | 2098 | } | |
| 9271 | else | ||
| 9272 | { | ||
| 9273 | 6605 | y = (s->y); | |
| 9274 | } | ||
| 9275 |
2/2✓ Branch 0 taken 6605 times.
✓ Branch 1 taken 2098 times.
|
8703 | if (abs((s->x) - x) >= 1) |
| 9276 | { | ||
| 9277 |
2/2✓ Branch 0 taken 3246 times.
✓ Branch 1 taken 3359 times.
|
6605 | if((s->x)>x) |
| 9278 | { | ||
| 9279 | 3359 | x+=4; | |
| 9280 | |||
| 9281 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3359 times.
|
3359 | if(Lwpns.idFirst(wHSHandle)!=-1) |
| 9282 | { | ||
| 9283 | 3359 | t->x+=4; | |
| 9284 | 3359 | } | |
| 9285 | |||
| 9286 | 3359 | hs_startx+=4; | |
| 9287 | 3359 | } | |
| 9288 | |||
| 9289 |
2/2✓ Branch 0 taken 3359 times.
✓ Branch 1 taken 3246 times.
|
6605 | if((s->x)<x) |
| 9290 | { | ||
| 9291 | 3246 | x-=4; | |
| 9292 | |||
| 9293 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3246 times.
|
3246 | if(Lwpns.idFirst(wHSHandle)!=-1) |
| 9294 | { | ||
| 9295 | 3246 | t->x-=4; | |
| 9296 | 3246 | } | |
| 9297 | |||
| 9298 | 3246 | hs_startx-=4; | |
| 9299 | 3246 | } | |
| 9300 | 6605 | } | |
| 9301 | else | ||
| 9302 | { | ||
| 9303 | 2098 | x = (s->x); | |
| 9304 | } | ||
| 9305 | 8703 | } | |
| 9306 | 18189 | } | |
| 9307 | } | ||
| 9308 | 17467 | } | |
| 9309 | 53896 | } | |
| 9310 | else | ||
| 9311 | { | ||
| 9312 | 2438 | Lwpns.del(Lwpns.idFirst(wHSHandle)); | |
| 9313 | 2438 | reset_hookshot(); | |
| 9314 | } | ||
| 9315 | |||
| 9316 |
1/2✓ Branch 0 taken 56334 times.
✗ Branch 1 not taken.
|
56334 | if(snap_player) |
| 9317 | { | ||
| 9318 | ✗ | if(dir==up || dir==down) | |
| 9319 | { | ||
| 9320 | ✗ | y = TRUNCATE_TILE(int32_t(y+7)); | |
| 9321 | ✗ | } | |
| 9322 | |||
| 9323 | ✗ | if(dir==left || dir==right) | |
| 9324 | { | ||
| 9325 | ✗ | x = TRUNCATE_TILE(int32_t(x+7)); | |
| 9326 | ✗ | } | |
| 9327 | |||
| 9328 | ✗ | hs_fix=false; | |
| 9329 | ✗ | } | |
| 9330 | |||
| 9331 | 56334 | } | |
| 9332 | |||
| 9333 |
2/2✓ Branch 0 taken 1340679 times.
✓ Branch 1 taken 13496415 times.
|
14837094 | if (!get_qr(qr_NO_L_R_BUTTON_INVENTORY_SWAP)) |
| 9334 | { | ||
| 9335 |
2/2✓ Branch 0 taken 5713 times.
✓ Branch 1 taken 13490702 times.
|
13496415 | if (getInput(btnL, INPUT_PRESS | INPUT_DRUNK | INPUT_HERO_ACTION)) |
| 9336 | 5713 | selectNextBWpn(SEL_LEFT); | |
| 9337 |
2/2✓ Branch 0 taken 13482973 times.
✓ Branch 1 taken 7729 times.
|
13490702 | else if (getInput(btnR, INPUT_PRESS | INPUT_DRUNK | INPUT_HERO_ACTION)) |
| 9338 | 7729 | selectNextBWpn(SEL_RIGHT); | |
| 9339 | 13496415 | } | |
| 9340 |
4/4✓ Branch 0 taken 1548763 times.
✓ Branch 1 taken 13288331 times.
✓ Branch 2 taken 1017977 times.
✓ Branch 3 taken 530786 times.
|
14837094 | if (get_qr(qr_SELECTAWPN) && get_qr(qr_USE_EX1_EX2_INVENTORYSWAP)) |
| 9341 | { | ||
| 9342 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 530786 times.
|
530786 | if (getInput(btnEx3, INPUT_PRESS | INPUT_HERO_ACTION)) |
| 9343 | ✗ | selectNextAWpn(SEL_LEFT); | |
| 9344 |
2/2✓ Branch 0 taken 530785 times.
✓ Branch 1 taken 1 times.
|
530786 | else if (getInput(btnEx4, INPUT_PRESS | INPUT_HERO_ACTION)) |
| 9345 | 1 | selectNextAWpn(SEL_RIGHT); | |
| 9346 | 530786 | } | |
| 9347 | |||
| 9348 |
2/2✓ Branch 0 taken 14835975 times.
✓ Branch 1 taken 1119 times.
|
14837094 | if (getInput(btnP, INPUT_PRESS | INPUT_HERO_ACTION)) |
| 9349 | { | ||
| 9350 |
2/2✓ Branch 0 taken 7 times.
✓ Branch 1 taken 1112 times.
|
1119 | if( !FFCore.runOnMapScriptEngine() ) //OnMap script replaces the 'onViewMap()' call |
| 9351 | 1112 | onViewMap(); | |
| 9352 | 1119 | } | |
| 9353 |
2/2✓ Branch 0 taken 6588539 times.
✓ Branch 1 taken 14837094 times.
|
21425633 | for(int32_t i=0; i<Lwpns.Count(); i++) |
| 9354 | { | ||
| 9355 | 6588539 | weapon *w = ((weapon*)Lwpns.spr(i)); | |
| 9356 | |||
| 9357 |
6/6✓ Branch 0 taken 6521398 times.
✓ Branch 1 taken 67141 times.
✓ Branch 2 taken 6050244 times.
✓ Branch 3 taken 471154 times.
✓ Branch 4 taken 73 times.
✓ Branch 5 taken 6050171 times.
|
6588539 | if(w->id == wArrow || w->id == wBrang || w->id == wCByrna) |
| 9358 | 538368 | addsparkle(i); | |
| 9359 | 6588539 | } | |
| 9360 | |||
| 9361 |
2/2✓ Branch 0 taken 14835859 times.
✓ Branch 1 taken 1235 times.
|
14837094 | if(Lwpns.idCount(wPhantom)) |
| 9362 | { | ||
| 9363 | 1235 | addsparkle2(pDIVINEFIREROCKET,pDIVINEFIREROCKETTRAIL); | |
| 9364 | 1235 | addsparkle2(pDIVINEFIREROCKETRETURN,pDIVINEFIREROCKETTRAILRETURN); | |
| 9365 | 1235 | addsparkle2(pDIVINEPROTECTIONROCKET1,pDIVINEPROTECTIONROCKETTRAIL1); | |
| 9366 | 1235 | addsparkle2(pDIVINEPROTECTIONROCKET2,pDIVINEPROTECTIONROCKETTRAIL2); | |
| 9367 | 1235 | addsparkle2(pDIVINEPROTECTIONROCKETRETURN1,pDIVINEPROTECTIONROCKETTRAILRETURN1); | |
| 9368 | 1235 | addsparkle2(pDIVINEPROTECTIONROCKETRETURN2,pDIVINEPROTECTIONROCKETTRAILRETURN2); | |
| 9369 | 1235 | } | |
| 9370 | |||
| 9371 | // Pay magic cost for Byrna beams | ||
| 9372 | |||
| 9373 | //Byrna needs a secondary timer, for 254+, as do all items that reduce MP on a per-frae basis. Essentially, we will do % divisor == 0 for that. -Z | ||
| 9374 |
2/2✓ Branch 0 taken 14837021 times.
✓ Branch 1 taken 73 times.
|
14837094 | if(Lwpns.idCount(wCByrna)) |
| 9375 | { | ||
| 9376 | 73 | weapon *ew = (weapon*)(Lwpns.spr(Lwpns.idFirst(wCByrna))); | |
| 9377 | 73 | int32_t itemid = ew->parentitem; | |
| 9378 | |||
| 9379 |
2/4✓ Branch 0 taken 73 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 73 times.
|
73 | if(!(checkbunny(itemid) && checkmagiccost(itemid))) |
| 9380 | { | ||
| 9381 | ✗ | for (int32_t i = 0; i < Lwpns.Count(); i++) | |
| 9382 | { | ||
| 9383 | ✗ | weapon* w = ((weapon*)Lwpns.spr(i)); | |
| 9384 | |||
| 9385 | ✗ | if (w->id == wCByrna && !w->weapon_dying_frame) | |
| 9386 | ✗ | w->dead = 1; | |
| 9387 | ✗ | } | |
| 9388 | //kill the sound effect for the orbits -Z 14FEB2019 | ||
| 9389 | ✗ | stop_sfx(itemsbuf[itemid].usesound); | |
| 9390 | ✗ | } | |
| 9391 | 73 | else paymagiccost(itemid); | |
| 9392 | 73 | } | |
| 9393 | |||
| 9394 |
3/4✓ Branch 0 taken 14817348 times.
✓ Branch 1 taken 19746 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 14817348 times.
|
14837094 | if(z == 0 && fakez == 0) |
| 9395 | { | ||
| 9396 |
1/2✓ Branch 0 taken 14817348 times.
✗ Branch 1 not taken.
|
14817348 | if (standing_z_offset) |
| 9397 | { | ||
| 9398 | ✗ | standing_z_offset = false; | |
| 9399 | ✗ | yofs += 8; | |
| 9400 | ✗ | } | |
| 9401 |
2/2✓ Branch 0 taken 87 times.
✓ Branch 1 taken 14817261 times.
|
14817348 | if (standing_on_z > 0) |
| 9402 | 87 | standing_on_z = 0; | |
| 9403 | 14817348 | } | |
| 9404 |
3/4✓ Branch 0 taken 14826656 times.
✓ Branch 1 taken 10438 times.
✓ Branch 2 taken 14826656 times.
✗ Branch 3 not taken.
|
14837094 | if (!isDiving() && standing_on_z < 0) |
| 9405 | ✗ | standing_on_z = 0; | |
| 9406 | |||
| 9407 |
2/2✓ Branch 0 taken 319044 times.
✓ Branch 1 taken 14518050 times.
|
14837094 | if(!isSideViewHero()) |
| 9408 | { | ||
| 9409 | 14518050 | int32_t tx = x.getInt()+8, | |
| 9410 | 14518050 | ty = y.getInt()+8;//(bigHitbox?8:12); | |
| 9411 |
4/4✓ Branch 0 taken 14517614 times.
✓ Branch 1 taken 436 times.
✓ Branch 2 taken 368 times.
✓ Branch 3 taken 14517246 times.
|
14518050 | if (unsigned(ty) < world_h && unsigned(tx) < world_w) |
| 9412 | { | ||
| 9413 | 14517246 | rpos_t rpos = COMBOPOS_REGION_B(tx, ty); | |
| 9414 |
2/2✓ Branch 0 taken 14516746 times.
✓ Branch 1 taken 43551218 times.
|
58067964 | for(int32_t q = 0; q < 3; ++q) |
| 9415 | { | ||
| 9416 |
1/2✓ Branch 0 taken 43551218 times.
✗ Branch 1 not taken.
|
43551218 | if (rpos == rpos_t::None) break; |
| 9417 | |||
| 9418 | 43551218 | auto rpos_handle = get_rpos_handle(rpos, q); | |
| 9419 |
2/2✓ Branch 0 taken 23473752 times.
✓ Branch 1 taken 20077466 times.
|
43551218 | if (!rpos_handle.scr->is_valid()) continue; |
| 9420 | |||
| 9421 | 23473752 | auto& cmb = rpos_handle.combo(); | |
| 9422 | |||
| 9423 | 23473752 | int32_t b = 1; | |
| 9424 |
2/2✓ Branch 0 taken 10063713 times.
✓ Branch 1 taken 13410039 times.
|
23473752 | if(tx&8) b <<= 2; |
| 9425 |
2/2✓ Branch 0 taken 10401224 times.
✓ Branch 1 taken 13072528 times.
|
23473752 | if(ty&8) b <<= 1; |
| 9426 | 23473752 | b |= (b<<4); //check equivalent effect flag too | |
| 9427 |
2/2✓ Branch 0 taken 23014009 times.
✓ Branch 1 taken 459743 times.
|
23473752 | if((cmb.walk & b) != b) //not both solid and effecting |
| 9428 | 23014009 | continue; | |
| 9429 | |||
| 9430 |
2/2✓ Branch 0 taken 459189 times.
✓ Branch 1 taken 554 times.
|
459743 | bool standing_switchblock = cmb.type == cCSWITCHBLOCK && (cmb.usrflags & cflag9); |
| 9431 |
2/2✓ Branch 0 taken 459715 times.
✓ Branch 1 taken 28 times.
|
459743 | bool standing_combo = (cmb.genflags & cflag3) && !standing_switchblock; |
| 9432 | |||
| 9433 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 459743 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
459743 | if (cmb.dive_under_level && isDiving()) |
| 9434 | { | ||
| 9435 | // keep you from surfacing | ||
| 9436 | // also sets the 'standing_on_z' value, based on flippers | ||
| 9437 | ✗ | set_dive(zc_max(diveclk, 2)); | |
| 9438 | ✗ | if (standing_on_z >= -cmb.dive_under_level) // push you down further if the combo appeared on you or etc | |
| 9439 | ✗ | standing_on_z = -cmb.dive_under_level; | |
| 9440 | ✗ | } | |
| 9441 |
4/4✓ Branch 0 taken 459271 times.
✓ Branch 1 taken 472 times.
✓ Branch 2 taken 28 times.
✓ Branch 3 taken 459243 times.
|
459743 | else if (standing_switchblock || standing_combo) |
| 9442 | { | ||
| 9443 |
2/2✓ Branch 0 taken 472 times.
✓ Branch 1 taken 28 times.
|
500 | bool should_z_offs = standing_switchblock ? (cmb.usrflags&cflag10) : (cmb.genflags & cflag4); |
| 9444 |
2/2✓ Branch 0 taken 472 times.
✓ Branch 1 taken 28 times.
|
500 | zfix cmb_z = standing_switchblock ? zslongToFix(cmb.attributes[2]) : cmb.z_height; |
| 9445 |
1/2✓ Branch 0 taken 500 times.
✗ Branch 1 not taken.
|
500 | if (!cmb_z) cmb_z = STANDING_Z_MAX; |
| 9446 | |||
| 9447 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 500 times.
|
500 | if (standing_on_z >= 0) |
| 9448 | { | ||
| 9449 |
3/4✓ Branch 0 taken 78 times.
✓ Branch 1 taken 422 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 78 times.
|
500 | if (z == 0 && fakez == 0) |
| 9450 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 78 times.
|
78 | standing_on_z = zc_max(standing_on_z, cmb_z); |
| 9451 |
2/2✓ Branch 0 taken 398 times.
✓ Branch 1 taken 24 times.
|
422 | else if(get_standing_z_state() < cmb_z) |
| 9452 | 24 | standing_on_z += cmb_z - get_standing_z_state(); | |
| 9453 | 500 | } | |
| 9454 |
4/8✓ Branch 0 taken 78 times.
✓ Branch 1 taken 422 times.
✓ Branch 2 taken 78 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 78 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
500 | if(z == 0 && fakez == 0 && should_z_offs && !standing_z_offset) |
| 9455 | { | ||
| 9456 | ✗ | standing_z_offset = true; | |
| 9457 | ✗ | yofs -= 8; | |
| 9458 | ✗ | } | |
| 9459 | 500 | } | |
| 9460 | 459243 | else continue; | |
| 9461 | |||
| 9462 | 500 | break; | |
| 9463 | } | ||
| 9464 | 14517246 | } | |
| 9465 | 14518050 | } | |
| 9466 | 14837094 | ClearhitHeroUIDs(); //clear them before we advance. | |
| 9467 | 14837094 | checkhit(); | |
| 9468 | |||
| 9469 | 14837094 | bool forcedeath = dying_flags&DYING_FORCED; | |
| 9470 | 14837094 | bool norev = (dying_flags&DYING_NOREV); | |
| 9471 |
4/6✓ Branch 0 taken 14837094 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 606 times.
✓ Branch 3 taken 14836488 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 606 times.
|
14837094 | if(forcedeath || (game->get_life()<=0 && !immortal)) |
| 9472 | { | ||
| 9473 |
1/2✓ Branch 0 taken 606 times.
✗ Branch 1 not taken.
|
606 | if(forcedeath) |
| 9474 | ✗ | game->set_life(0); | |
| 9475 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 606 times.
|
606 | if(!norev) |
| 9476 |
2/2✓ Branch 0 taken 606 times.
✓ Branch 1 taken 155136 times.
|
155742 | for(size_t slot = 0; slot < 256; ++slot) |
| 9477 | { | ||
| 9478 |
2/2✓ Branch 0 taken 155128 times.
✓ Branch 1 taken 8 times.
|
155136 | if(size_t bind = game->get_bottle_slot(slot)) |
| 9479 | { | ||
| 9480 | 8 | bottletype const* bt = &QMisc.bottle_types[bind-1]; | |
| 9481 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
|
8 | if(!(bt->flags&BTFLAG_AUTOONDEATH)) |
| 9482 | 8 | continue; | |
| 9483 | ✗ | word toFill[3] = { 0 }; | |
| 9484 | ✗ | for(size_t q = 0; q < 3; ++q) | |
| 9485 | { | ||
| 9486 | ✗ | char c = bt->counter[q]; | |
| 9487 | ✗ | if(c > -1) | |
| 9488 | { | ||
| 9489 | ✗ | if(bt->flags & (1<<q)) | |
| 9490 | { | ||
| 9491 | ✗ | toFill[q] = (bt->amount[q]==100) | |
| 9492 | ✗ | ? game->get_maxcounter(c) | |
| 9493 | ✗ | : word((game->get_maxcounter(c)/100.0)*bt->amount[q]); | |
| 9494 | ✗ | } | |
| 9495 | ✗ | else toFill[q] = bt->amount[q]; | |
| 9496 | ✗ | if(toFill[q] + game->get_counter(c) > game->get_maxcounter(c)) | |
| 9497 | { | ||
| 9498 | ✗ | toFill[q] = game->get_maxcounter(c) - game->get_counter(c); | |
| 9499 | ✗ | } | |
| 9500 | ✗ | } | |
| 9501 | ✗ | } | |
| 9502 | ✗ | if(bt->flags & BTFLAG_CURESWJINX) | |
| 9503 | { | ||
| 9504 | ✗ | swordclk = 0; | |
| 9505 | ✗ | verifyAWpn(); | |
| 9506 | ✗ | } | |
| 9507 | ✗ | if(bt->flags & BTFLAG_CUREITJINX) | |
| 9508 | ✗ | itemclk = 0; | |
| 9509 | ✗ | if(bt->flags & BTFLAG_CURESHJINX) | |
| 9510 | ✗ | shieldjinxclk = 0; | |
| 9511 | ✗ | if(word max = std::max(toFill[0], std::max(toFill[1], toFill[2]))) | |
| 9512 | { | ||
| 9513 | ✗ | int32_t itemid = find_bottle_for_slot(slot,true); | |
| 9514 | ✗ | stop_sfx(QMisc.miscsfx[sfxLOWHEART]); //stop heart beep! | |
| 9515 | ✗ | if(itemid > -1) | |
| 9516 | ✗ | sfx(itemsbuf[itemid].usesound,pan(x)); | |
| 9517 | ✗ | for(size_t q = 0; q < 20; ++q) | |
| 9518 | ✗ | do_death_refill_waitframe(); | |
| 9519 | ✗ | double inc = max/60.0; //1 second | |
| 9520 | ✗ | double xtra[3]{ 0 }; | |
| 9521 | ✗ | for(size_t q = 0; q < 60; ++q) | |
| 9522 | { | ||
| 9523 | ✗ | if(!(q%6) && (toFill[0]||toFill[1]||toFill[2])) | |
| 9524 | ✗ | sfx(QMisc.miscsfx[sfxREFILL]); | |
| 9525 | ✗ | for(size_t j = 0; j < 3; ++j) | |
| 9526 | { | ||
| 9527 | ✗ | xtra[j] += inc; | |
| 9528 | ✗ | word f = floor(xtra[j]); | |
| 9529 | ✗ | xtra[j] -= f; | |
| 9530 | ✗ | if(toFill[j] > f) | |
| 9531 | { | ||
| 9532 | ✗ | toFill[j] -= f; | |
| 9533 | ✗ | game->change_counter(f,bt->counter[j]); | |
| 9534 | ✗ | } | |
| 9535 | ✗ | else if(toFill[j]) | |
| 9536 | { | ||
| 9537 | ✗ | game->change_counter(toFill[j],bt->counter[j]); | |
| 9538 | ✗ | toFill[j] = 0; | |
| 9539 | ✗ | } | |
| 9540 | ✗ | } | |
| 9541 | ✗ | do_death_refill_waitframe(); | |
| 9542 | ✗ | } | |
| 9543 | ✗ | for(size_t j = 0; j < 3; ++j) | |
| 9544 | { | ||
| 9545 | ✗ | if(toFill[j]) | |
| 9546 | { | ||
| 9547 | ✗ | game->change_counter(toFill[j],bt->counter[j]); | |
| 9548 | ✗ | toFill[j] = 0; | |
| 9549 | ✗ | } | |
| 9550 | ✗ | } | |
| 9551 | ✗ | for(size_t q = 0; q < 20; ++q) | |
| 9552 | ✗ | do_death_refill_waitframe(); | |
| 9553 | ✗ | } | |
| 9554 | ✗ | game->set_bottle_slot(slot,bt->next_type); | |
| 9555 | ✗ | if(game->get_life() > 0) | |
| 9556 | { | ||
| 9557 | ✗ | dying_flags = 0; | |
| 9558 | ✗ | forcedeath = false; | |
| 9559 | ✗ | break; //Revived! Stop drinking things... | |
| 9560 | } | ||
| 9561 | ✗ | } | |
| 9562 | 155734 | } | |
| 9563 | |||
| 9564 |
2/2✓ Branch 0 taken 106 times.
✓ Branch 1 taken 500 times.
|
606 | if ( FFCore.getQuestHeaderInfo(vZelda) >= 0x255 ) |
| 9565 | { | ||
| 9566 |
3/6✓ Branch 0 taken 106 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 106 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 106 times.
|
106 | if(forcedeath || (game->get_life()<=0 && !immortal)) //Not saved by fairy |
| 9567 | { | ||
| 9568 | // So scripts can have one frame to handle hp zero events | ||
| 9569 |
3/4✓ Branch 0 taken 106 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 48 times.
✓ Branch 3 taken 58 times.
|
106 | if(norev || false == (last_hurrah = !last_hurrah)) |
| 9570 | { | ||
| 9571 | 48 | dying_flags = 0; | |
| 9572 | 48 | drunkclk=0; | |
| 9573 | 48 | lstunclock = 0; | |
| 9574 | 48 | is_conveyor_stunned = 0; | |
| 9575 | 48 | FFCore.setHeroAction(dying); | |
| 9576 | 48 | FFCore.deallocateAllScriptOwned(ScriptType::Global, GLOBAL_SCRIPT_GAME); | |
| 9577 | 48 | FFCore.deallocateAllScriptOwned(ScriptType::Hero, SCRIPT_HERO_ACTIVE); | |
| 9578 | 48 | ALLOFF(true,true); | |
| 9579 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 48 times.
|
48 | if(lift_wpn) |
| 9580 | { | ||
| 9581 | ✗ | delete lift_wpn; | |
| 9582 | ✗ | lift_wpn = nullptr; | |
| 9583 | ✗ | } | |
| 9584 | 48 | GameFlags |= GAMEFLAG_NO_F6; | |
| 9585 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 48 times.
|
48 | if(!debug_enabled) |
| 9586 | { | ||
| 9587 | 48 | Paused=false; | |
| 9588 | 48 | } | |
| 9589 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 16 times.
|
48 | if(!get_qr(qr_ONDEATH_RUNS_AFTER_DEATH_ANIM)) |
| 9590 | { | ||
| 9591 | 16 | FFCore.runOnDeathEngine(); | |
| 9592 | 16 | FFCore.deallocateAllScriptOwned(ScriptType::Hero, SCRIPT_HERO_DEATH); | |
| 9593 | 16 | } | |
| 9594 | 48 | Playing = false; | |
| 9595 | 48 | heroDeathAnimation(); | |
| 9596 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 32 times.
|
48 | if(get_qr(qr_ONDEATH_RUNS_AFTER_DEATH_ANIM)) |
| 9597 | { | ||
| 9598 | 32 | Playing = true; | |
| 9599 | 32 | FFCore.runOnDeathEngine(); | |
| 9600 | 32 | FFCore.deallocateAllScriptOwned(ScriptType::Hero, SCRIPT_HERO_DEATH); | |
| 9601 | 32 | Playing = false; | |
| 9602 | 32 | } | |
| 9603 | 48 | GameFlags &= ~GAMEFLAG_NO_F6; | |
| 9604 | 48 | ALLOFF(true,true); | |
| 9605 | 48 | return true; | |
| 9606 | } | ||
| 9607 | 58 | } | |
| 9608 | 58 | } | |
| 9609 | else //2.50.x | ||
| 9610 | { | ||
| 9611 | // So scripts can have one frame to handle hp zero events | ||
| 9612 |
2/2✓ Branch 0 taken 249 times.
✓ Branch 1 taken 251 times.
|
500 | if(false == (last_hurrah = !last_hurrah)) |
| 9613 | { | ||
| 9614 | 249 | drunkclk=0; | |
| 9615 | 249 | heroDeathAnimation(); | |
| 9616 | |||
| 9617 | 249 | return true; | |
| 9618 | } | ||
| 9619 | } | ||
| 9620 | 309 | } | |
| 9621 | 14836488 | else last_hurrah=false; | |
| 9622 | |||
| 9623 |
2/2✓ Branch 0 taken 50288 times.
✓ Branch 1 taken 14786509 times.
|
14836797 | if(swordclk>0) |
| 9624 | { | ||
| 9625 | 50288 | --swordclk; | |
| 9626 |
2/2✓ Branch 0 taken 49945 times.
✓ Branch 1 taken 343 times.
|
50288 | if(!swordclk) verifyAWpn(); |
| 9627 | 50288 | } | |
| 9628 |
2/2✓ Branch 0 taken 10679 times.
✓ Branch 1 taken 14826118 times.
|
14836797 | if(itemclk>0) |
| 9629 | 10679 | --itemclk; | |
| 9630 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14836797 times.
|
14836797 | if(shieldjinxclk>0) |
| 9631 | ✗ | --shieldjinxclk; | |
| 9632 | |||
| 9633 |
2/2✓ Branch 0 taken 1338 times.
✓ Branch 1 taken 14835459 times.
|
14836797 | if(inwallm) |
| 9634 | { | ||
| 9635 | 1338 | attackclk=0; | |
| 9636 | 1338 | herostep(); | |
| 9637 | |||
| 9638 |
2/2✓ Branch 0 taken 1329 times.
✓ Branch 1 taken 9 times.
|
1338 | if(CarryHero()==false) |
| 9639 | 9 | restart_level(); | |
| 9640 | |||
| 9641 | 1338 | solid_update(false); | |
| 9642 | 1338 | return false; | |
| 9643 | } | ||
| 9644 | |||
| 9645 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 14835456 times.
|
14835459 | if(ewind_restart) |
| 9646 | { | ||
| 9647 | 3 | attackclk=0; | |
| 9648 | 3 | restart_level(); | |
| 9649 | 3 | xofs=0; | |
| 9650 | 3 | action=none; FFCore.setHeroAction(none); | |
| 9651 | 3 | ewind_restart=false; | |
| 9652 | 3 | solid_update(false); | |
| 9653 | 3 | return false; | |
| 9654 | } | ||
| 9655 | |||
| 9656 |
2/2✓ Branch 0 taken 5880 times.
✓ Branch 1 taken 14829576 times.
|
14835456 | if(fallclk) |
| 9657 | { | ||
| 9658 | 5880 | action=falling; FFCore.setHeroAction(falling); | |
| 9659 | 5880 | } | |
| 9660 |
2/2✓ Branch 0 taken 14815495 times.
✓ Branch 1 taken 14081 times.
|
14829576 | else if(hopclk) |
| 9661 | { | ||
| 9662 | 14081 | action=hopping; FFCore.setHeroAction(hopping); | |
| 9663 | 14081 | } | |
| 9664 | |||
| 9665 |
5/6✓ Branch 0 taken 136379 times.
✓ Branch 1 taken 14699077 times.
✓ Branch 2 taken 1633 times.
✓ Branch 3 taken 134746 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1633 times.
|
14835456 | if(isSwimming() && (liftflags&LIFTFL_DIS_SWIMMING) && !get_qr(qr_BROKEN_LIFTSWIM)) |
| 9666 | 1633 | drop_liftwpn(); | |
| 9667 | 14835456 | handle_passive_buttons(); | |
| 9668 |
2/2✓ Branch 0 taken 936 times.
✓ Branch 1 taken 14834520 times.
|
14835456 | if(liftclk) |
| 9669 | { | ||
| 9670 |
1/2✓ Branch 0 taken 936 times.
✗ Branch 1 not taken.
|
936 | if(lift_wpn) |
| 9671 | { | ||
| 9672 | 936 | action=lifting; FFCore.setHeroAction(lifting); | |
| 9673 | 936 | } | |
| 9674 | else | ||
| 9675 | { | ||
| 9676 | ✗ | liftclk = 0; | |
| 9677 | ✗ | tliftclk = 0; | |
| 9678 | } | ||
| 9679 | 936 | } | |
| 9680 |
2/2✓ Branch 0 taken 14825066 times.
✓ Branch 1 taken 9454 times.
|
14834520 | else if(lift_wpn) |
| 9681 | { | ||
| 9682 | 9454 | handle_lift(false); | |
| 9683 | 9454 | } | |
| 9684 | |||
| 9685 | // get user input or do other animation | ||
| 9686 | 14835456 | freeze_guys=false; // reset this flag, set it again if holding | |
| 9687 | |||
| 9688 |
14/16✓ Branch 0 taken 14705025 times.
✓ Branch 1 taken 130431 times.
✓ Branch 2 taken 14677799 times.
✓ Branch 3 taken 27226 times.
✓ Branch 4 taken 14676627 times.
✓ Branch 5 taken 1172 times.
✓ Branch 6 taken 14675976 times.
✓ Branch 7 taken 651 times.
✓ Branch 8 taken 14675976 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 14675976 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 14650849 times.
✓ Branch 13 taken 25127 times.
✓ Branch 14 taken 14650729 times.
✓ Branch 15 taken 120 times.
|
14835456 | if(action != landhold1 && action != landhold2 && action != waterhold1 && action != waterhold2 && action != sidewaterhold1 && action != sidewaterhold2 && fairyclk==0 && holdclk>0) |
| 9689 | { | ||
| 9690 | 120 | holdclk=0; | |
| 9691 | 120 | } | |
| 9692 | |||
| 9693 | { // active shield handling | ||
| 9694 | 14835456 | active_shield_id = refreshActiveShield(); | |
| 9695 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 14835456 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
14835456 | if (active_shield_id > -1 && !shield_active && on_cooldown(active_shield_id)) |
| 9696 | ✗ | active_shield_id = -1; | |
| 9697 | 14835456 | bool sh = active_shield_id > -1; | |
| 9698 | 14835456 | itemdata const& shield = itemsbuf[active_shield_id]; | |
| 9699 | //Handle direction forcing. This runs every frame so that scripts can interact with dir still. | ||
| 9700 | 14835456 | shield_forcedir = -1; | |
| 9701 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 14835456 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
14835456 | if(sh && action != rafting && (shield.flags & item_flag11)) //Lock Dir |
| 9702 | { | ||
| 9703 | ✗ | shield_forcedir = dir; | |
| 9704 | ✗ | } | |
| 9705 |
1/2✓ Branch 0 taken 14835456 times.
✗ Branch 1 not taken.
|
14835456 | if(sh != shield_active) //Toggle active shield on/off |
| 9706 | { | ||
| 9707 | ✗ | shield_active = sh; | |
| 9708 | ✗ | if(sh) //Toggle active shield on | |
| 9709 | { | ||
| 9710 | ✗ | sfx(shield.usesound2); //'Activate' sfx | |
| 9711 | ✗ | start_cooldown(active_shield_id); | |
| 9712 | ✗ | if (!get_qr(qr_ACTIVE_SHIELD_PASSIVE_ROC_NO_SCRIPT)) | |
| 9713 | ✗ | run_item_action_script(active_shield_id, true); | |
| 9714 | ✗ | } | |
| 9715 | ✗ | } | |
| 9716 | } | ||
| 9717 | |||
| 9718 | 14835456 | bool isthissolid = false; | |
| 9719 |
12/12✓ Branch 0 taken 134909 times.
✓ Branch 1 taken 1823 times.
✓ Branch 2 taken 7872 times.
✓ Branch 3 taken 313498 times.
✓ Branch 4 taken 3887 times.
✓ Branch 5 taken 157657 times.
✓ Branch 6 taken 14070082 times.
✓ Branch 7 taken 106351 times.
✓ Branch 8 taken 5880 times.
✓ Branch 9 taken 14081 times.
✓ Branch 10 taken 18480 times.
✓ Branch 11 taken 936 times.
|
14835456 | switch(action) |
| 9720 | { | ||
| 9721 | case gothit: | ||
| 9722 |
2/2✓ Branch 0 taken 103987 times.
✓ Branch 1 taken 2364 times.
|
106351 | if(attackclk) |
| 9723 |
2/2✓ Branch 0 taken 2037 times.
✓ Branch 1 taken 327 times.
|
2691 | if(!doattack()) |
| 9724 | { | ||
| 9725 | 327 | attackclk=spins=0; | |
| 9726 | 327 | tapping=false; | |
| 9727 | 327 | } | |
| 9728 | |||
| 9729 | 106351 | break; | |
| 9730 | |||
| 9731 | case drowning: | ||
| 9732 | case lavadrowning: | ||
| 9733 | case sidedrowning: | ||
| 9734 | { | ||
| 9735 | 7872 | herostep(); // maybe this line should be elsewhere? | |
| 9736 | |||
| 9737 | //!DROWN | ||
| 9738 | // Helpful comment to find drowning -Dimi | ||
| 9739 | |||
| 9740 | 7872 | drop_liftwpn(); | |
| 9741 |
2/2✓ Branch 0 taken 7749 times.
✓ Branch 1 taken 123 times.
|
7872 | if(--drownclk==0) |
| 9742 | { | ||
| 9743 | 123 | action=none; FFCore.setHeroAction(none); | |
| 9744 | 123 | optional<combined_handle_t> comb_handle; | |
| 9745 | 123 | int32_t water = iswaterex_z3(MAPCOMBO(x.getInt()+7.5,y.getInt()+12), -1, x.getInt()+7.5,y.getInt()+12, true, false, true, false, true, &comb_handle); | |
| 9746 |
3/4✓ Branch 0 taken 123 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 119 times.
✓ Branch 3 taken 4 times.
|
123 | if(drownCombo && water != drownCombo) |
| 9747 | { | ||
| 9748 | 4 | comb_handle = nullopt; | |
| 9749 | 4 | water = drownCombo; | |
| 9750 | 4 | } | |
| 9751 | |||
| 9752 | 123 | std::vector<int32_t> &ev = FFCore.eventData; | |
| 9753 | 123 | ev.clear(); | |
| 9754 | 123 | ev.push_back(water*10000); | |
| 9755 | |||
| 9756 | 123 | throwGenScriptEvent(GENSCR_EVENT_PLAYER_DROWN); | |
| 9757 | 123 | water = ev[0]/10000; | |
| 9758 | 123 | newcombo const& watercmb = combobuf[water]; | |
| 9759 | |||
| 9760 | 123 | int32_t damage = 4; | |
| 9761 |
1/2✓ Branch 0 taken 123 times.
✗ Branch 1 not taken.
|
123 | if (watercmb.type == cWATER) |
| 9762 | 123 | damage = watercmb.attributes[0]/10000L; | |
| 9763 | ✗ | else water = 0; | |
| 9764 | |||
| 9765 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 123 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
123 | if(cheat_superman && damage > 0) |
| 9766 | ✗ | damage = 0; | |
| 9767 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 123 times.
|
123 | if(damage) |
| 9768 | 123 | game->set_life(vbound(game->get_life()-damage,0, game->get_maxlife())); | |
| 9769 | 123 | drownCombo = 0; | |
| 9770 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 119 times.
|
123 | if(comb_handle) |
| 9771 | 119 | do_trigger_ctype_causes(*comb_handle); | |
| 9772 | 123 | go_respawn_point(); | |
| 9773 | 123 | hclk=48; | |
| 9774 | 123 | check_on_hit(); | |
| 9775 | 123 | } | |
| 9776 | |||
| 9777 | 7872 | break; | |
| 9778 | } | ||
| 9779 | case falling: | ||
| 9780 | { | ||
| 9781 | 5880 | herostep(); | |
| 9782 | 5880 | pitfall(); | |
| 9783 | 5880 | break; | |
| 9784 | } | ||
| 9785 | case freeze: | ||
| 9786 | case sideswimfreeze: | ||
| 9787 | case scrolling: | ||
| 9788 | 313498 | break; | |
| 9789 | |||
| 9790 | case casting: | ||
| 9791 | case sideswimcasting: | ||
| 9792 | { | ||
| 9793 |
2/2✓ Branch 0 taken 9 times.
✓ Branch 1 taken 3878 times.
|
3887 | if(magicitem==-1) |
| 9794 | { | ||
| 9795 | 9 | action=none; FFCore.setHeroAction(none); | |
| 9796 | 9 | } | |
| 9797 | |||
| 9798 | 3887 | break; | |
| 9799 | } | ||
| 9800 | case landhold1: | ||
| 9801 | case landhold2: | ||
| 9802 | { | ||
| 9803 |
2/2✓ Branch 0 taken 1368 times.
✓ Branch 1 taken 156289 times.
|
157657 | if(--holdclk <= 0) |
| 9804 | { | ||
| 9805 | //restart music | ||
| 9806 |
4/4✓ Branch 0 taken 85 times.
✓ Branch 1 taken 1283 times.
✓ Branch 2 taken 50 times.
✓ Branch 3 taken 35 times.
|
1368 | if(get_qr(qr_HOLDNOSTOPMUSIC) == 0 && (specialcave < GUYCAVE)) |
| 9807 | 35 | playLevelMusic(); | |
| 9808 | |||
| 9809 | 1368 | action=none; FFCore.setHeroAction(none); | |
| 9810 | 1368 | post_item_collect(); | |
| 9811 | 1368 | } | |
| 9812 | else | ||
| 9813 | 156289 | freeze_guys=true; | |
| 9814 | |||
| 9815 | 157657 | break; | |
| 9816 | } | ||
| 9817 | case waterhold1: | ||
| 9818 | case waterhold2: | ||
| 9819 | case sidewaterhold1: | ||
| 9820 | case sidewaterhold2: | ||
| 9821 | { | ||
| 9822 | 1823 | set_dive(0); | |
| 9823 | |||
| 9824 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 1807 times.
|
1823 | if(--holdclk <= 0) |
| 9825 | { | ||
| 9826 | //restart music | ||
| 9827 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
16 | if(get_qr(qr_HOLDNOSTOPMUSIC) == 0 && (specialcave < GUYCAVE)) |
| 9828 | ✗ | playLevelMusic(); | |
| 9829 | |||
| 9830 | 16 | SetSwim(); | |
| 9831 | 16 | post_item_collect(); | |
| 9832 | 16 | } | |
| 9833 | else | ||
| 9834 | 1807 | freeze_guys=true; | |
| 9835 | |||
| 9836 | 1823 | break; | |
| 9837 | } | ||
| 9838 | case hopping: | ||
| 9839 | { | ||
| 9840 |
3/4✓ Branch 0 taken 13 times.
✓ Branch 1 taken 14068 times.
✓ Branch 2 taken 13 times.
✗ Branch 3 not taken.
|
14081 | if(DRIEDLAKE) |
| 9841 | { | ||
| 9842 | ✗ | action=none; FFCore.setHeroAction(none); | |
| 9843 | ✗ | hopclk = 0; | |
| 9844 | ✗ | set_dive(0); | |
| 9845 | ✗ | break; | |
| 9846 | } | ||
| 9847 | |||
| 9848 | 14081 | do_hopping(); | |
| 9849 | 14081 | break; | |
| 9850 | } | ||
| 9851 | case inwind: | ||
| 9852 | { | ||
| 9853 | 18480 | int32_t i=Lwpns.idFirst(wWind); | |
| 9854 | |||
| 9855 |
2/2✓ Branch 0 taken 18243 times.
✓ Branch 1 taken 237 times.
|
18480 | if(i<0) |
| 9856 | { | ||
| 9857 | 237 | bool exit=false; | |
| 9858 | |||
| 9859 |
2/2✓ Branch 0 taken 125 times.
✓ Branch 1 taken 112 times.
|
237 | if(whirlwind==255) |
| 9860 | { | ||
| 9861 | 125 | exit=true; | |
| 9862 | 125 | } | |
| 9863 | // When the wind weapon goes away, check if the player has been brought to the edge of the screen | ||
| 9864 | // by the wind. If so, push them one more pixel to trigger the screen scrolling code. | ||
| 9865 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 112 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
112 | else if (dir==up && y<=viewport.top()) y=viewport.top()-1; |
| 9866 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 112 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
112 | else if (dir==down && y>=viewport.bottom()-16) y=viewport.bottom()-16+1; |
| 9867 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 112 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
112 | else if (dir==left && x<=viewport.left()) x=viewport.left()-1; |
| 9868 |
2/4✓ Branch 0 taken 112 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 112 times.
|
112 | else if (dir==right && x>=viewport.right()-16) x=viewport.right()-16+1; |
| 9869 | ✗ | else exit=true; | |
| 9870 | |||
| 9871 |
2/2✓ Branch 0 taken 112 times.
✓ Branch 1 taken 125 times.
|
237 | if(exit) |
| 9872 | { | ||
| 9873 | 125 | action=none; FFCore.setHeroAction(none); | |
| 9874 | 125 | xofs=0; | |
| 9875 | 125 | whirlwind=0; | |
| 9876 | 125 | lstep=0; | |
| 9877 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 125 times.
|
125 | if ( dontdraw < 2 ) dontdraw=0; |
| 9878 | 125 | set_respawn_point(); | |
| 9879 | 125 | } | |
| 9880 | 237 | } | |
| 9881 | else | ||
| 9882 | { | ||
| 9883 | 18243 | auto wind = Lwpns.spr(i); | |
| 9884 | 18243 | x = wind->x; | |
| 9885 | 18243 | y = wind->y; | |
| 9886 | 18243 | dir = wind->dir; | |
| 9887 | } | ||
| 9888 | } | ||
| 9889 | 18480 | break; | |
| 9890 | case lifting: | ||
| 9891 | 936 | handle_lift(); | |
| 9892 | 936 | break; | |
| 9893 | |||
| 9894 | case sideswimming: | ||
| 9895 | case sideswimattacking: | ||
| 9896 | case sideswimhit: | ||
| 9897 | case swimhit: | ||
| 9898 | case swimming: | ||
| 9899 | { | ||
| 9900 |
3/4✓ Branch 0 taken 166 times.
✓ Branch 1 taken 134743 times.
✓ Branch 2 taken 166 times.
✗ Branch 3 not taken.
|
134909 | if(DRIEDLAKE) |
| 9901 | { | ||
| 9902 | ✗ | action=none; FFCore.setHeroAction(none); | |
| 9903 | ✗ | hopclk=0; | |
| 9904 | ✗ | break; | |
| 9905 | } | ||
| 9906 | |||
| 9907 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 134909 times.
|
134909 | bool shouldbreak = (action == sideswimhit || action == swimhit); //!DIMITODO: "Can walk while hurt" compat needs to be added here. |
| 9908 | |||
| 9909 |
4/4✓ Branch 0 taken 67399 times.
✓ Branch 1 taken 67510 times.
✓ Branch 2 taken 626 times.
✓ Branch 3 taken 66773 times.
|
134909 | if((frame&1) && !shouldbreak) |
| 9910 | 66773 | herostep(); | |
| 9911 | |||
| 9912 |
2/2✓ Branch 0 taken 10279 times.
✓ Branch 1 taken 124630 times.
|
145411 | if (_walkflag(x+7,y+(bigHitbox?6:11),1,get_standing_z_state()) |
| 9913 |
2/2✓ Branch 0 taken 10502 times.
✓ Branch 1 taken 124407 times.
|
134909 | || _walkflag(x+7,y+(bigHitbox?9:12),1,get_standing_z_state()) |
| 9914 |
2/2✓ Branch 0 taken 10493 times.
✓ Branch 1 taken 9 times.
|
10502 | || _walkflag(x+8,y+(bigHitbox?6:11),1,get_standing_z_state()) |
| 9915 |
2/2✓ Branch 0 taken 214 times.
✓ Branch 1 taken 10279 times.
|
135123 | || _walkflag(x+8,y+(bigHitbox?9:12),1,get_standing_z_state())) isthissolid = true; |
| 9916 |
4/4✓ Branch 0 taken 126779 times.
✓ Branch 1 taken 8130 times.
✓ Branch 2 taken 126779 times.
✓ Branch 3 taken 8130 times.
|
134909 | if ((get_qr(qr_NO_HOPPING) || CanSideSwim()) && !isthissolid) //Since hopping won't be set with this on, something needs to kick Hero out of water... |
| 9917 | { | ||
| 9918 |
4/4✓ Branch 0 taken 8082 times.
✓ Branch 1 taken 48 times.
✓ Branch 2 taken 8027 times.
✓ Branch 3 taken 4 times.
|
16161 | if(!iswaterex_z3(MAPCOMBO(x.getInt()+4,y.getInt()+9), -1, x.getInt()+4,y.getInt()+9, true, false)||!iswaterex_z3(MAPCOMBO(x.getInt()+4,y.getInt()+15), -1, x.getInt()+4,y.getInt()+15, true, false) |
| 9919 |
4/4✓ Branch 0 taken 8058 times.
✓ Branch 1 taken 24 times.
✓ Branch 2 taken 8031 times.
✓ Branch 3 taken 27 times.
|
8082 | || !iswaterex_z3(MAPCOMBO(x.getInt()+11,y.getInt()+9), -1, x.getInt()+11,y.getInt()+9, true, false)||!iswaterex_z3(MAPCOMBO(x.getInt()+11,y.getInt()+15), -1, x.getInt()+11,y.getInt()+15, true, false)) |
| 9920 | { | ||
| 9921 | 103 | hopclk=0; | |
| 9922 | 103 | set_dive(0); | |
| 9923 |
2/4✓ Branch 0 taken 103 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 103 times.
|
103 | if (action != sideswimattacking && action != attacking) {action=none; FFCore.setHeroAction(none);} |
| 9924 | ✗ | else {action=attacking; FFCore.setHeroAction(attacking);} | |
| 9925 | 103 | hopdir=-1; | |
| 9926 | 103 | } | |
| 9927 | 8130 | } | |
| 9928 |
2/2✓ Branch 0 taken 1259 times.
✓ Branch 1 taken 133650 times.
|
134909 | if (shouldbreak) break; |
| 9929 |
4/6✓ Branch 0 taken 103 times.
✓ Branch 1 taken 133547 times.
✓ Branch 2 taken 103 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 103 times.
|
133650 | if (action == swimming || action == sideswimming || action == sideswimattacking) |
| 9930 | { | ||
| 9931 | 133547 | int32_t watercheck = iswaterex_z3(MAPCOMBO(x.getInt()+7.5,y.getInt()+12), -1, x.getInt()+7.5,y.getInt()+12, true, false); | |
| 9932 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 133547 times.
|
133547 | if (combobuf[watercheck].usrflags&cflag2) |
| 9933 | { | ||
| 9934 | ✗ | if (current_item(combobuf[watercheck].attribytes[2]) < combobuf[watercheck].attribytes[3]) | |
| 9935 | { | ||
| 9936 | ✗ | onpassivedmg = true; | |
| 9937 | ✗ | if (damageovertimeclk == 0) | |
| 9938 | { | ||
| 9939 | ✗ | int32_t curhp = game->get_life(); | |
| 9940 | ✗ | if (combobuf[watercheck].usrflags&cflag5) game->set_life(vbound(game->get_life()+ringpower(combobuf[watercheck].attributes[1]/10000L), 0, game->get_maxlife())); //Affected by rings | |
| 9941 | ✗ | else game->set_life(vbound(game->get_life()+(combobuf[watercheck].attributes[1]/10000L), 0, game->get_maxlife())); | |
| 9942 | ✗ | if ((combobuf[watercheck].attributes[2]/10000L) && (game->get_life() != curhp || !(combobuf[watercheck].usrflags&cflag6))) sfx(combobuf[watercheck].attributes[2]/10000L); | |
| 9943 | ✗ | if (game->get_life() < curhp && combobuf[watercheck].usrflags&cflag7) | |
| 9944 | { | ||
| 9945 | ✗ | hclk = 48; | |
| 9946 | ✗ | hitdir = -1; | |
| 9947 | ✗ | check_on_hit(); | |
| 9948 | ✗ | if (IsSideSwim()) {action = sideswimhit; FFCore.setHeroAction(sideswimhit);} | |
| 9949 | ✗ | else {action = swimhit; FFCore.setHeroAction(swimhit);} | |
| 9950 | ✗ | } | |
| 9951 | ✗ | } | |
| 9952 | ✗ | if (combobuf[watercheck].attribytes[1] > 0) | |
| 9953 | { | ||
| 9954 | ✗ | if (!damageovertimeclk || damageovertimeclk > combobuf[watercheck].attribytes[1]) damageovertimeclk = combobuf[watercheck].attribytes[1]; | |
| 9955 | ✗ | else --damageovertimeclk; | |
| 9956 | ✗ | } | |
| 9957 | ✗ | else damageovertimeclk = 0; | |
| 9958 | ✗ | } | |
| 9959 | ✗ | else damageovertimeclk = 0; | |
| 9960 | ✗ | } | |
| 9961 | 133547 | else damageovertimeclk = 0; | |
| 9962 | //combobuf[watercheck].attributes[0] | ||
| 9963 | 133547 | } | |
| 9964 | |||
| 9965 | 133650 | } | |
| 9966 | [[fallthrough]]; | ||
| 9967 | default: | ||
| 9968 | // call the main movement routine | ||
| 9969 |
2/2✓ Branch 0 taken 907262 times.
✓ Branch 1 taken 13296470 times.
|
14203732 | if(get_qr(qr_NEW_HERO_MOVEMENT2)) |
| 9970 | { | ||
| 9971 |
2/2✓ Branch 0 taken 108621 times.
✓ Branch 1 taken 798641 times.
|
907262 | if(premove()) |
| 9972 | 798641 | movehero(); | |
| 9973 | 907262 | } | |
| 9974 | else | ||
| 9975 | { | ||
| 9976 | 13296470 | sliding = 0; | |
| 9977 | 13296470 | moveheroOld(); | |
| 9978 | } | ||
| 9979 | 14203732 | } | |
| 9980 |
12/16✓ Branch 0 taken 319029 times.
✓ Branch 1 taken 14516427 times.
✓ Branch 2 taken 854 times.
✓ Branch 3 taken 318175 times.
✓ Branch 4 taken 854 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 834 times.
✓ Branch 7 taken 20 times.
✓ Branch 8 taken 816 times.
✓ Branch 9 taken 18 times.
✓ Branch 10 taken 816 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 816 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 816 times.
|
14835456 | if (isSideViewHero() && slopeid && hoverclk < 1 && !inair && fall == 0 && !IsSideSwim() && justmoved <= 0 && !is_autowalking()) |
| 9981 | { | ||
| 9982 |
2/2✓ Branch 0 taken 594 times.
✓ Branch 1 taken 222 times.
|
816 | if (!on_sideview_solid_oldpos(this, false, 0)) |
| 9983 | { | ||
| 9984 | 222 | zfix dy = 0; | |
| 9985 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 728 times.
|
728 | for (zfix q = 0; q <= 4; ++q) |
| 9986 | { | ||
| 9987 |
2/2✓ Branch 0 taken 506 times.
✓ Branch 1 taken 222 times.
|
728 | if (on_sideview_solid_oldpos(this, false, 0, 0, q)) |
| 9988 | { | ||
| 9989 | 222 | dy = q; | |
| 9990 | 222 | break; | |
| 9991 | } | ||
| 9992 | 506 | } | |
| 9993 |
3/6✓ Branch 0 taken 222 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 222 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 222 times.
✗ Branch 5 not taken.
|
3634 | dy = binary_search_zfix(0, dy, [&](zfix val, zfix& retval) |
| 9994 | { | ||
| 9995 |
2/2✓ Branch 0 taken 1014 times.
✓ Branch 1 taken 2398 times.
|
3412 | if (on_sideview_solid_oldpos(this, false, 0, 0, val)) |
| 9996 | { | ||
| 9997 | 1014 | retval = val; | |
| 9998 | 1014 | return BSEARCH_CONTINUE_TOWARD0; | |
| 9999 | } | ||
| 10000 | 2398 | else return BSEARCH_CONTINUE_AWAY0; | |
| 10001 | 3412 | }); | |
| 10002 |
2/2✓ Branch 0 taken 112 times.
✓ Branch 1 taken 110 times.
|
222 | if (dy) push_move(0, dy); |
| 10003 | 222 | } | |
| 10004 | 816 | } | |
| 10005 | |||
| 10006 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 14835456 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
14835456 | if(shield_forcedir > -1 && action != rafting) |
| 10007 | ✗ | dir = shield_forcedir; | |
| 10008 | |||
| 10009 | |||
| 10010 | // check for ladder removal | ||
| 10011 |
4/6✓ Branch 0 taken 9749955 times.
✓ Branch 1 taken 5085501 times.
✓ Branch 2 taken 9749955 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 9749955 times.
|
14835456 | if(diagonalMovement||NO_GRIDLOCK) |
| 10012 | { | ||
| 10013 |
2/2✓ Branch 0 taken 5066004 times.
✓ Branch 1 taken 19497 times.
|
5085501 | if(ladderx+laddery) |
| 10014 | { | ||
| 10015 |
2/2✓ Branch 0 taken 8088 times.
✓ Branch 1 taken 11409 times.
|
19497 | if(ladderdir<=down) |
| 10016 | { | ||
| 10017 |
10/10✓ Branch 0 taken 6329 times.
✓ Branch 1 taken 1759 times.
✓ Branch 2 taken 122 times.
✓ Branch 3 taken 7966 times.
✓ Branch 4 taken 6250 times.
✓ Branch 5 taken 1716 times.
✓ Branch 6 taken 7903 times.
✓ Branch 7 taken 63 times.
✓ Branch 8 taken 51 times.
✓ Branch 9 taken 7852 times.
|
8088 | if((laddery-y.getInt()>=(16+(ladderstart==dir?ladderstart==down?1:0:0))) || (laddery-y.getInt()<=(-16-(ladderstart==dir?ladderstart==up?1:0:0))) || (abs(ladderx-x.getInt())>8)) |
| 10018 | { | ||
| 10019 | 236 | reset_ladder(); | |
| 10020 | 236 | } | |
| 10021 | 8088 | } | |
| 10022 | else | ||
| 10023 | { | ||
| 10024 |
10/10✓ Branch 0 taken 65 times.
✓ Branch 1 taken 11344 times.
✓ Branch 2 taken 9385 times.
✓ Branch 3 taken 1959 times.
✓ Branch 4 taken 131 times.
✓ Branch 5 taken 11213 times.
✓ Branch 6 taken 9307 times.
✓ Branch 7 taken 1906 times.
✓ Branch 8 taken 167 times.
✓ Branch 9 taken 11046 times.
|
11409 | if((abs(laddery-y.getInt())>8) || (ladderx-x.getInt()>=(16+(ladderstart==dir?ladderstart==right?1:0:0))) || (ladderx-x.getInt()<=(-16-(ladderstart==dir?ladderstart==left?1:0:0)))) |
| 10025 | { | ||
| 10026 | 363 | reset_ladder(); | |
| 10027 | 363 | } | |
| 10028 | } | ||
| 10029 | 19497 | } | |
| 10030 | 5085501 | } | |
| 10031 | else | ||
| 10032 | { | ||
| 10033 |
4/4✓ Branch 0 taken 334176 times.
✓ Branch 1 taken 9415779 times.
✓ Branch 2 taken 194313 times.
✓ Branch 3 taken 139863 times.
|
9749955 | if((abs(laddery-y.getInt())>=16) || (abs(ladderx-x.getInt())>=16)) |
| 10034 | { | ||
| 10035 | 9610092 | reset_ladder(); | |
| 10036 | 9610092 | } | |
| 10037 | } | ||
| 10038 | |||
| 10039 |
2/2✓ Branch 0 taken 14301285 times.
✓ Branch 1 taken 534171 times.
|
14835456 | if(!get_qr(qr_OLD_RESPAWN_POINTS)) //needs to happen after ladder removal so the respawn point is set when laddering over multiple 1 tile gaps. |
| 10040 | 534171 | set_respawn_point(false); //Keep the 'last safe location' updated! | |
| 10041 | |||
| 10042 |
2/2✓ Branch 0 taken 3254 times.
✓ Branch 1 taken 14832202 times.
|
14835456 | if(ilswim) |
| 10043 | 3254 | landswim++; | |
| 10044 | 14832202 | else landswim=0; | |
| 10045 | |||
| 10046 |
2/2✓ Branch 0 taken 172 times.
✓ Branch 1 taken 14835284 times.
|
14835456 | if(hopclk!=0xFF) ilswim=false; |
| 10047 | |||
| 10048 |
4/4✓ Branch 0 taken 39632 times.
✓ Branch 1 taken 14795824 times.
✓ Branch 2 taken 3323 times.
✓ Branch 3 taken 36309 times.
|
14835456 | if((!loaded_guys) && (frame - newscr_clk >= 1)) |
| 10049 | { | ||
| 10050 |
2/2✓ Branch 0 taken 17 times.
✓ Branch 1 taken 36292 times.
|
36309 | if(hero_scr->room==rGANON) |
| 10051 | { | ||
| 10052 | 17 | ganon_intro(); | |
| 10053 | 17 | } | |
| 10054 | else | ||
| 10055 | { | ||
| 10056 | 36292 | loadguys(); | |
| 10057 | } | ||
| 10058 | 36309 | } | |
| 10059 | |||
| 10060 |
2/2✓ Branch 0 taken 41786 times.
✓ Branch 1 taken 14793670 times.
|
14835456 | if(frame - newscr_clk >= 2) |
| 10061 | { | ||
| 10062 | 14793670 | loadenemies(); | |
| 10063 | 14793670 | } | |
| 10064 | |||
| 10065 | // check lots of other things | ||
| 10066 | 14835456 | checkscroll(); | |
| 10067 | |||
| 10068 |
7/8✓ Branch 0 taken 14817101 times.
✓ Branch 1 taken 18355 times.
✓ Branch 2 taken 14809856 times.
✓ Branch 3 taken 7245 times.
✓ Branch 4 taken 14809856 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 505 times.
✓ Branch 7 taken 14809353 times.
|
14835456 | if(action!=inwind && action!=drowning && action != sidedrowning && action!=lavadrowning) |
| 10069 | { | ||
| 10070 | 14809353 | checkspecial(); | |
| 10071 | 14809353 | checkitems(); | |
| 10072 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 14809352 times.
|
14809353 | if(!is_autowalking()) |
| 10073 | { | ||
| 10074 | 14809352 | checklocked(); //This has issues if Hero's action is WALKING, in 8-way moveent. | |
| 10075 |
2/2✓ Branch 0 taken 1090996 times.
✓ Branch 1 taken 13718356 times.
|
14809352 | if(get_qr(qr_OLD_LOCKBLOCK_COLLISION)) |
| 10076 | { | ||
| 10077 | 13718356 | oldchecklockblock(); | |
| 10078 | 13718356 | oldcheckbosslockblock(); | |
| 10079 | 13718356 | } | |
| 10080 |
2/2✓ Branch 0 taken 1576927 times.
✓ Branch 1 taken 13232425 times.
|
14809352 | if(get_qr(qr_OLD_CHEST_COLLISION)) |
| 10081 | { | ||
| 10082 | 13232425 | oldcheckchest(cCHEST); | |
| 10083 | 13232425 | oldcheckchest(cLOCKEDCHEST); | |
| 10084 | 13232425 | oldcheckchest(cBOSSCHEST); | |
| 10085 | 13232425 | } | |
| 10086 | 14809352 | checkpushblock(); | |
| 10087 | 14809352 | checkswordtap(); | |
| 10088 | 14809352 | } | |
| 10089 | |||
| 10090 |
2/2✓ Branch 0 taken 47629 times.
✓ Branch 1 taken 14761722 times.
|
14809353 | if(hookshot_frozen==false) |
| 10091 | { | ||
| 10092 | 14761722 | checkspecial2(&lsave); | |
| 10093 | 14761722 | } | |
| 10094 | |||
| 10095 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 14809341 times.
|
14809351 | if(action==won) |
| 10096 | { | ||
| 10097 | 10 | return true; | |
| 10098 | } | ||
| 10099 | 14809341 | } | |
| 10100 | |||
| 10101 | // Somehow Hero was displaced from the fairy flag... | ||
| 10102 |
3/6✓ Branch 0 taken 25128 times.
✓ Branch 1 taken 14810318 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 25128 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
14835446 | if(fairyclk && action != freeze && action != sideswimfreeze) |
| 10103 | { | ||
| 10104 | ✗ | fairyclk = holdclk = refill_why = 0; | |
| 10105 | ✗ | } | |
| 10106 | |||
| 10107 |
4/4✓ Branch 0 taken 14835444 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 14752513 times.
✓ Branch 3 taken 82931 times.
|
14835446 | if((!activated_timed_warp) && (origin_scr->timedwarptics>0)) |
| 10108 | { | ||
| 10109 | 82931 | origin_scr->timedwarptics--; | |
| 10110 | |||
| 10111 |
2/2✓ Branch 0 taken 82425 times.
✓ Branch 1 taken 506 times.
|
82931 | if(origin_scr->timedwarptics==0) |
| 10112 | { | ||
| 10113 | 506 | activated_timed_warp=true; | |
| 10114 | |||
| 10115 |
2/2✓ Branch 0 taken 385 times.
✓ Branch 1 taken 121 times.
|
506 | if(origin_scr->flags4 & fTIMEDDIRECT) |
| 10116 | { | ||
| 10117 | 121 | setpit(); | |
| 10118 | 121 | } | |
| 10119 | |||
| 10120 | 506 | int32_t index2 = 0; | |
| 10121 | |||
| 10122 |
1/2✓ Branch 0 taken 506 times.
✗ Branch 1 not taken.
|
506 | if(origin_scr->flags5 & fRANDOMTIMEDWARP) index2=zc_oldrand()%4; |
| 10123 | |||
| 10124 | 506 | sdir = dir; | |
| 10125 | 506 | dowarp(origin_scr, 1, index2); | |
| 10126 | 506 | } | |
| 10127 | 82931 | } | |
| 10128 | |||
| 10129 | // Global Combo Effects (AUTO STUFF) | ||
| 10130 | 14835446 | bool awarp = false; | |
| 10131 | 4439827032 | for_some_rpos([&](const rpos_handle_t& rpos_handle) { | |
| 10132 |
2/2✓ Branch 0 taken 393837841 times.
✓ Branch 1 taken 4031153745 times.
|
4424991586 | if (!get_qr(qr_AUTOCOMBO_ANY_LAYER)) |
| 10133 | { | ||
| 10134 |
2/2✓ Branch 0 taken 5260045 times.
✓ Branch 1 taken 4025893700 times.
|
4031153745 | if (rpos_handle.layer > 2) return false; |
| 10135 |
4/4✓ Branch 0 taken 1038378000 times.
✓ Branch 1 taken 2987515700 times.
✓ Branch 2 taken 139722176 times.
✓ Branch 3 taken 898655824 times.
|
4025893700 | if (rpos_handle.layer == 1 && !get_qr(qr_AUTOCOMBO_LAYER_1)) return true; |
| 10136 |
4/4✓ Branch 0 taken 431725360 times.
✓ Branch 1 taken 2695512516 times.
✓ Branch 2 taken 109622480 times.
✓ Branch 3 taken 322102880 times.
|
3127237876 | if (rpos_handle.layer == 2 && !get_qr(qr_AUTOCOMBO_LAYER_2)) return true; |
| 10137 | 2805134996 | } | |
| 10138 | 3198972837 | int32_t ind=0; | |
| 10139 | |||
| 10140 | //AUTOMATIC TRIGGER CODE | ||
| 10141 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3198972837 times.
|
3498196323 | trig_each_combo_trigger(rpos_handle, [&](combo_trigger const& trig){ |
| 10142 | 299223486 | return trig.trigger_flags.get(TRIGFLAG_AUTOMATIC); | |
| 10143 | }); | ||
| 10144 | 3198972837 | newcombo const& cmb = rpos_handle.combo(); | |
| 10145 | |||
| 10146 | //AUTO WARP CODE | ||
| 10147 |
2/2✓ Branch 0 taken 22695 times.
✓ Branch 1 taken 3198950142 times.
|
3198972837 | if (!(cmb.only_gentrig)) |
| 10148 | { | ||
| 10149 |
2/2✓ Branch 0 taken 89 times.
✓ Branch 1 taken 3198950053 times.
|
3198950142 | if(cmb.type==cAWARPA) |
| 10150 | { | ||
| 10151 | 89 | awarp=true; | |
| 10152 | 89 | ind=0; | |
| 10153 | 89 | } | |
| 10154 |
2/2✓ Branch 0 taken 63 times.
✓ Branch 1 taken 3198949990 times.
|
3198950053 | else if(cmb.type==cAWARPB) |
| 10155 | { | ||
| 10156 | 63 | awarp=true; | |
| 10157 | 63 | ind=1; | |
| 10158 | 63 | } | |
| 10159 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 3198949987 times.
|
3198949990 | else if(cmb.type==cAWARPC) |
| 10160 | { | ||
| 10161 | 3 | awarp=true; | |
| 10162 | 3 | ind=2; | |
| 10163 | 3 | } | |
| 10164 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3198949987 times.
|
3198949987 | else if(cmb.type==cAWARPD) |
| 10165 | { | ||
| 10166 | ✗ | awarp=true; | |
| 10167 | ✗ | ind=3; | |
| 10168 | ✗ | } | |
| 10169 |
1/2✓ Branch 0 taken 3198949987 times.
✗ Branch 1 not taken.
|
3198949987 | else if(cmb.type==cAWARPR) |
| 10170 | { | ||
| 10171 | ✗ | awarp=true; | |
| 10172 | ✗ | ind=zc_oldrand()%4; | |
| 10173 | ✗ | } | |
| 10174 | 3198950142 | } | |
| 10175 |
2/2✓ Branch 0 taken 155 times.
✓ Branch 1 taken 3198972682 times.
|
3198972837 | if (awarp) |
| 10176 | { | ||
| 10177 |
2/2✓ Branch 0 taken 88 times.
✓ Branch 1 taken 67 times.
|
155 | if (rpos_handle.scr->flags5 & fDIRECTAWARP) |
| 10178 | { | ||
| 10179 | 67 | setpit(); | |
| 10180 | 67 | } | |
| 10181 | |||
| 10182 | 155 | sdir = dir; | |
| 10183 | 155 | dowarp(rpos_handle.scr, 1, ind); | |
| 10184 | 155 | return false; | |
| 10185 | } | ||
| 10186 | |||
| 10187 | 3198972682 | return true; | |
| 10188 | 4424991586 | }); | |
| 10189 | |||
| 10190 | 14835446 | awarp=false; | |
| 10191 | |||
| 10192 | 455277024 | for_some_ffcs([&](const ffc_handle_t& ffc_handle) { | |
| 10193 | 440441578 | int32_t ind=0; | |
| 10194 | |||
| 10195 |
1/2✓ Branch 0 taken 440441578 times.
✗ Branch 1 not taken.
|
440569748 | trig_each_combo_trigger(ffc_handle, [&](combo_trigger const& trig){ |
| 10196 | 128170 | return trig.trigger_flags.get(TRIGFLAG_AUTOMATIC); | |
| 10197 | }); | ||
| 10198 | 440441578 | auto& cmb = ffc_handle.combo(); | |
| 10199 | |||
| 10200 |
2/2✓ Branch 0 taken 3908 times.
✓ Branch 1 taken 440437670 times.
|
440441578 | if(!(cmb.only_gentrig)) |
| 10201 | { | ||
| 10202 |
2/2✓ Branch 0 taken 19 times.
✓ Branch 1 taken 440437651 times.
|
440437670 | if(cmb.type==cAWARPA) |
| 10203 | { | ||
| 10204 | 19 | awarp=true; | |
| 10205 | 19 | ind=0; | |
| 10206 | 19 | } | |
| 10207 |
2/2✓ Branch 0 taken 33 times.
✓ Branch 1 taken 440437618 times.
|
440437651 | else if(cmb.type==cAWARPB) |
| 10208 | { | ||
| 10209 | 33 | awarp=true; | |
| 10210 | 33 | ind=1; | |
| 10211 | 33 | } | |
| 10212 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 440437616 times.
|
440437618 | else if(cmb.type==cAWARPC) |
| 10213 | { | ||
| 10214 | 2 | awarp=true; | |
| 10215 | 2 | ind=2; | |
| 10216 | 2 | } | |
| 10217 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 440437612 times.
|
440437616 | else if(cmb.type==cAWARPD) |
| 10218 | { | ||
| 10219 | 4 | awarp=true; | |
| 10220 | 4 | ind=3; | |
| 10221 | 4 | } | |
| 10222 |
1/2✓ Branch 0 taken 440437612 times.
✗ Branch 1 not taken.
|
440437612 | else if(cmb.type==cAWARPR) |
| 10223 | { | ||
| 10224 | ✗ | awarp=true; | |
| 10225 | ✗ | ind=zc_oldrand()%4; | |
| 10226 | ✗ | } | |
| 10227 | 440437670 | } | |
| 10228 | |||
| 10229 |
2/2✓ Branch 0 taken 58 times.
✓ Branch 1 taken 440441520 times.
|
440441578 | if(awarp) |
| 10230 | { | ||
| 10231 |
1/2✓ Branch 0 taken 58 times.
✗ Branch 1 not taken.
|
58 | if(ffc_handle.scr->flags5&fDIRECTAWARP) |
| 10232 | { | ||
| 10233 | ✗ | setpit(); | |
| 10234 | ✗ | } | |
| 10235 | |||
| 10236 | 58 | sdir = dir; | |
| 10237 | 58 | dowarp(ffc_handle.scr, 1, ind, 0); | |
| 10238 | 58 | return false; | |
| 10239 | } | ||
| 10240 | |||
| 10241 | 440441520 | return true; | |
| 10242 | 440441578 | }); | |
| 10243 | |||
| 10244 | 14835446 | zfix dx, dy; | |
| 10245 |
8/10✓ Branch 0 taken 319028 times.
✓ Branch 1 taken 14516418 times.
✓ Branch 2 taken 158801 times.
✓ Branch 3 taken 160227 times.
✓ Branch 4 taken 746 times.
✓ Branch 5 taken 158055 times.
✓ Branch 6 taken 746 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 746 times.
|
14835446 | if (sideview_mode() && !on_sideview_solid_oldpos(this, false, 1) && on_sideview_solid_oldpos(this, false, 2) && !walk_through_walls && !is_autowalking()) |
| 10246 | { | ||
| 10247 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 746 times.
|
746 | if (slide_slope(this, dx, dy, slopeid)) |
| 10248 | { | ||
| 10249 | 746 | onplatid = 1; | |
| 10250 |
2/4✓ Branch 0 taken 746 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 746 times.
|
746 | if (dx || dy) push_move(dx, dy); |
| 10251 | 746 | } | |
| 10252 | 746 | } | |
| 10253 |
2/2✓ Branch 0 taken 14834608 times.
✓ Branch 1 taken 838 times.
|
14835446 | if (onplatid <= 0) slopeid = 0; |
| 10254 | 838 | else --onplatid; | |
| 10255 |
2/2✓ Branch 0 taken 11841237 times.
✓ Branch 1 taken 2994209 times.
|
14835446 | bool onplatform = (on_sideview_solid_oldpos(this, false, 1) && !getInput(btnUp, INPUT_HERO_ACTION)); |
| 10256 |
3/4✓ Branch 0 taken 14820451 times.
✓ Branch 1 taken 14995 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 14820451 times.
|
14835446 | if(!walk_through_walls && !is_autowalking()) |
| 10257 | { | ||
| 10258 |
4/4✓ Branch 0 taken 14820448 times.
✓ Branch 1 taken 1964 times.
✓ Branch 2 taken 1961 times.
✓ Branch 3 taken 14820451 times.
|
14822412 | for (auto q = 0; check_slope(this, true) && q < 2; ++q) |
| 10259 | { | ||
| 10260 | 1961 | dx = 0; | |
| 10261 | 1961 | dy = 0; | |
| 10262 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1961 times.
|
1961 | if (check_slope(this, true)) |
| 10263 | { | ||
| 10264 | 1961 | slope_info const& s = get_slope(this, true).get_info(); | |
| 10265 | 1961 | bool staircheck = false; | |
| 10266 |
3/4✓ Branch 0 taken 1815 times.
✓ Branch 1 taken 146 times.
✓ Branch 2 taken 1815 times.
✗ Branch 3 not taken.
|
1961 | if (s.slope() != slopeid && slopeid) staircheck = true; |
| 10267 |
2/2✓ Branch 0 taken 1914 times.
✓ Branch 1 taken 47 times.
|
1961 | if (onplatform) staircheck = true; |
| 10268 | 1961 | slope_push_int(s, this, dx, dy, staircheck, platformfell2); | |
| 10269 | |||
| 10270 |
4/4✓ Branch 0 taken 181 times.
✓ Branch 1 taken 1780 times.
✓ Branch 2 taken 180 times.
✓ Branch 3 taken 1 times.
|
1961 | if (dx || dy) |
| 10271 | { | ||
| 10272 | 1960 | reset_hookshot(); | |
| 10273 | 1960 | int32_t pushret = push_move(dx,dy); | |
| 10274 |
2/2✓ Branch 0 taken 1945 times.
✓ Branch 1 taken 15 times.
|
1960 | onplatform = (on_sideview_solid_oldpos(this, false, 1) && !getInput(btnUp, INPUT_HERO_ACTION)); |
| 10275 |
3/4✓ Branch 0 taken 1814 times.
✓ Branch 1 taken 146 times.
✓ Branch 2 taken 1814 times.
✗ Branch 3 not taken.
|
1960 | if (s.slope() != slopeid && slopeid) staircheck = true; |
| 10276 |
2/2✓ Branch 0 taken 1945 times.
✓ Branch 1 taken 15 times.
|
1960 | if (onplatform) staircheck = true; |
| 10277 |
4/4✓ Branch 0 taken 184 times.
✓ Branch 1 taken 1776 times.
✓ Branch 2 taken 38 times.
✓ Branch 3 taken 146 times.
|
1960 | if(sideview_mode() && slopeid) |
| 10278 | 146 | onplatid = 0; | |
| 10279 |
1/2✓ Branch 0 taken 1960 times.
✗ Branch 1 not taken.
|
1960 | if (pushret == 1) |
| 10280 | { | ||
| 10281 | ✗ | dx = -1; | |
| 10282 | ✗ | dy = 0; | |
| 10283 | ✗ | slope_push_int(s, this, dx, dy, staircheck); | |
| 10284 | ✗ | push_move(0,dy); | |
| 10285 | ✗ | } | |
| 10286 |
2/2✓ Branch 0 taken 1959 times.
✓ Branch 1 taken 1 times.
|
1960 | if (pushret == 2) |
| 10287 | { | ||
| 10288 | 1 | dx = 0; | |
| 10289 | 1 | dy = -1; | |
| 10290 | 1 | slope_push_int(s, this, dx, dy, staircheck); | |
| 10291 | 1 | push_move(dx,0); | |
| 10292 | 1 | } | |
| 10293 | 1960 | } | |
| 10294 | 1961 | } | |
| 10295 | 1961 | } | |
| 10296 | 14820451 | } | |
| 10297 | |||
| 10298 |
2/2✓ Branch 0 taken 14835196 times.
✓ Branch 1 taken 250 times.
|
14835446 | if(ffwarp) |
| 10299 | { | ||
| 10300 |
2/2✓ Branch 0 taken 123 times.
✓ Branch 1 taken 127 times.
|
250 | if(ffpit) |
| 10301 | { | ||
| 10302 | 127 | ffpit=false; | |
| 10303 | 127 | setpit(); | |
| 10304 | 127 | } | |
| 10305 | |||
| 10306 | 250 | ffwarp=false; | |
| 10307 | 250 | dowarp(hero_scr,1,0); | |
| 10308 | 250 | } | |
| 10309 | |||
| 10310 | //Hero->WarpEx | ||
| 10311 |
2/2✓ Branch 0 taken 14835332 times.
✓ Branch 1 taken 114 times.
|
14835446 | if ( FFCore.warpex[wexActive] ) |
| 10312 | { | ||
| 10313 | if(DEVLOGGING) zprint("Running warpex from hero.cpp\n"); | ||
| 10314 | 114 | FFCore.warpex[wexActive] = 0; | |
| 10315 | 114 | int32_t temp_warpex[wexActive] = {0}; //to hold the values as we clear the FFCore array. -Z | |
| 10316 |
2/2✓ Branch 0 taken 1026 times.
✓ Branch 1 taken 114 times.
|
1140 | for ( int32_t q = 0; q < wexActive; q++ ) |
| 10317 | { | ||
| 10318 | 1026 | temp_warpex[q] = FFCore.warpex[q]; | |
| 10319 | 1026 | FFCore.warpex[q] = 0; | |
| 10320 | 1026 | } | |
| 10321 | 228 | FFCore.warp_player( temp_warpex[wexType], temp_warpex[wexDMap], temp_warpex[wexScreen], temp_warpex[wexX], | |
| 10322 | 114 | temp_warpex[wexY], temp_warpex[wexEffect], temp_warpex[wexSound], temp_warpex[wexFlags], temp_warpex[wexDir]); | |
| 10323 | 114 | } | |
| 10324 | |||
| 10325 |
4/4✓ Branch 0 taken 19747 times.
✓ Branch 1 taken 14815699 times.
✓ Branch 2 taken 36641 times.
✓ Branch 3 taken 31818 times.
|
14835446 | if(z == 0 || !get_qr(qr_NO_SCROLL_WHILE_IN_AIR)) |
| 10326 | { | ||
| 10327 | // walk through bombed doors and fake walls | ||
| 10328 | 14847517 | bool walk=false; | |
| 10329 | 14847517 | int32_t dtype=dBOMBED; | |
| 10330 | |||
| 10331 |
2/2✓ Branch 0 taken 14483609 times.
✓ Branch 1 taken 300272 times.
|
14847517 | if(pushing>=24) dtype=dWALK; |
| 10332 | |||
| 10333 |
17/20✓ Branch 0 taken 6270359 times.
✓ Branch 1 taken 8513522 times.
✓ Branch 2 taken 6133753 times.
✓ Branch 3 taken 136606 times.
✓ Branch 4 taken 6133753 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 6122412 times.
✓ Branch 7 taken 11341 times.
✓ Branch 8 taken 6118991 times.
✓ Branch 9 taken 3421 times.
✓ Branch 10 taken 6111784 times.
✓ Branch 11 taken 7207 times.
✓ Branch 12 taken 6098072 times.
✓ Branch 13 taken 13712 times.
✓ Branch 14 taken 6098072 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 6098072 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 82128 times.
✓ Branch 19 taken 6180200 times.
|
14783881 | if(isdungeon() && action!=freeze && action != sideswimfreeze && loaded_guys && !inlikelike && !diveclk && action!=rafting && !lstunclock && !is_conveyor_stunned && !is_autowalking()) |
| 10334 | { | ||
| 10335 | 6180200 | int x0 = x.getInt() % 256; | |
| 10336 | 6180200 | int y0 = y.getInt() % 176; | |
| 10337 | |||
| 10338 |
12/14✓ Branch 0 taken 129000 times.
✓ Branch 1 taken 6051200 times.
✓ Branch 2 taken 1018756 times.
✓ Branch 3 taken 5032444 times.
✓ Branch 4 taken 1013652 times.
✓ Branch 5 taken 5104 times.
✓ Branch 6 taken 1013652 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1013652 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 946981 times.
✓ Branch 11 taken 941877 times.
✓ Branch 12 taken 66446 times.
✓ Branch 13 taken 225 times.
|
6180200 | if (((dtype == dBOMBED) ? getInput(btnUp, INPUT_DRUNK | INPUT_HERO_ACTION) : dir == up) && ((diagonalMovement || NO_GRIDLOCK) ? x0 > 112 && x0 < 128:x0 == 120) && y0 <= 32 && hero_scr->door[0] == dtype) |
| 10339 | { | ||
| 10340 | 225 | walk=true; | |
| 10341 | 225 | dir=up; | |
| 10342 | 225 | } | |
| 10343 | |||
| 10344 |
12/14✓ Branch 0 taken 129000 times.
✓ Branch 1 taken 6040992 times.
✓ Branch 2 taken 733936 times.
✓ Branch 3 taken 5307056 times.
✓ Branch 4 taken 858767 times.
✓ Branch 5 taken 4169 times.
✓ Branch 6 taken 858767 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 858767 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 815443 times.
✓ Branch 11 taken 811274 times.
✓ Branch 12 taken 43108 times.
✓ Branch 13 taken 216 times.
|
6169992 | if (((dtype == dBOMBED) ? getInput(btnDown, INPUT_DRUNK | INPUT_HERO_ACTION) : dir == down) && ((diagonalMovement || NO_GRIDLOCK) ? x0 > 112 && x0 < 128:x0 == 120) && y0 >= 128 && hero_scr->door[1] == dtype) |
| 10345 | { | ||
| 10346 | 216 | walk=true; | |
| 10347 | 216 | dir=down; | |
| 10348 | 216 | } | |
| 10349 | |||
| 10350 |
12/14✓ Branch 0 taken 129000 times.
✓ Branch 1 taken 6032654 times.
✓ Branch 2 taken 36355 times.
✓ Branch 3 taken 5996299 times.
✓ Branch 4 taken 101764 times.
✓ Branch 5 taken 219 times.
✓ Branch 6 taken 101764 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 101764 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 105 times.
✓ Branch 11 taken 114 times.
✓ Branch 12 taken 101589 times.
✓ Branch 13 taken 101484 times.
|
6161654 | if (((dtype == dBOMBED) ? getInput(btnLeft, INPUT_DRUNK | INPUT_HERO_ACTION) : dir == left) && x0 <= 32 && ((diagonalMovement || NO_GRIDLOCK) ? y0 > 72 && y0 < 88:y0 == 80) && hero_scr->door[2] == dtype) |
| 10351 | { | ||
| 10352 | 175 | walk=true; | |
| 10353 | 175 | dir=left; | |
| 10354 | 175 | } | |
| 10355 | |||
| 10356 |
12/14✓ Branch 0 taken 5969072 times.
✓ Branch 1 taken 129000 times.
✓ Branch 2 taken 32325 times.
✓ Branch 3 taken 5936747 times.
✓ Branch 4 taken 122261 times.
✓ Branch 5 taken 92 times.
✓ Branch 6 taken 122261 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 122261 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 58 times.
✓ Branch 11 taken 34 times.
✓ Branch 12 taken 122066 times.
✓ Branch 13 taken 122008 times.
|
6098072 | if (((dtype == dBOMBED) ? getInput(btnRight, INPUT_DRUNK | INPUT_HERO_ACTION) : dir == right) && x0 >= 208 && ((diagonalMovement || NO_GRIDLOCK) ? y0 > 72 && y0 < 88:y0 == 80) && hero_scr->door[3] == dtype) |
| 10357 | { | ||
| 10358 | 195 | walk=true; | |
| 10359 | 195 | dir=right; | |
| 10360 | 195 | } | |
| 10361 | 6058984 | } | |
| 10362 | |||
| 10363 |
2/2✓ Branch 0 taken 14826110 times.
✓ Branch 1 taken 811 times.
|
14826921 | if(walk) |
| 10364 | { | ||
| 10365 | 811 | hclk=0; | |
| 10366 | 811 | drawguys=false; | |
| 10367 | |||
| 10368 |
2/2✓ Branch 0 taken 616 times.
✓ Branch 1 taken 195 times.
|
811 | if(dtype==dWALK) |
| 10369 | { | ||
| 10370 | 195 | sfx(hero_scr->secretsfx); | |
| 10371 |
1/2✓ Branch 0 taken 195 times.
✗ Branch 1 not taken.
|
195 | if(!get_qr(qr_WALKTHROUGHWALL_NO_DOORSTATE)) |
| 10372 | ✗ | set_doorstate(current_screen, dir); | |
| 10373 | 195 | } | |
| 10374 | |||
| 10375 | 811 | action=none; FFCore.setHeroAction(none); | |
| 10376 | 811 | attackclk = 0; | |
| 10377 | 811 | stepforward(29, true); | |
| 10378 | 811 | action=scrolling; FFCore.setHeroAction(scrolling); | |
| 10379 | 811 | pushing=false; | |
| 10380 | 811 | } | |
| 10381 | 14826921 | } | |
| 10382 | |||
| 10383 |
5/6✓ Branch 0 taken 351254 times.
✓ Branch 1 taken 14512308 times.
✓ Branch 2 taken 348761 times.
✓ Branch 3 taken 2493 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 348761 times.
|
14863562 | if( game->get_life() <= (game->get_hp_per_heart()) && !(game->get_maxlife() <= (game->get_hp_per_heart())) && (heart_beep_timer > -3)) |
| 10384 | { | ||
| 10385 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 348761 times.
|
348761 | if(heart_beep) |
| 10386 | { | ||
| 10387 | ✗ | cont_sfx(QMisc.miscsfx[sfxLOWHEART]); | |
| 10388 | ✗ | } | |
| 10389 | else | ||
| 10390 | { | ||
| 10391 |
2/2✓ Branch 0 taken 348193 times.
✓ Branch 1 taken 568 times.
|
348761 | if ( heart_beep_timer == -1 ) |
| 10392 | { | ||
| 10393 | 568 | heart_beep_timer = 70; | |
| 10394 | 568 | } | |
| 10395 | |||
| 10396 |
2/2✓ Branch 0 taken 31638 times.
✓ Branch 1 taken 317123 times.
|
348761 | if ( heart_beep_timer > 0 ) |
| 10397 | { | ||
| 10398 | 31638 | --heart_beep_timer; | |
| 10399 | 31638 | cont_sfx(QMisc.miscsfx[sfxLOWHEART]); | |
| 10400 | 31638 | } | |
| 10401 | else | ||
| 10402 | { | ||
| 10403 | 317123 | stop_sfx(QMisc.miscsfx[sfxLOWHEART]); | |
| 10404 | } | ||
| 10405 | } | ||
| 10406 | 348761 | } | |
| 10407 | else | ||
| 10408 | { | ||
| 10409 |
2/2✓ Branch 0 taken 28252 times.
✓ Branch 1 taken 14486683 times.
|
14514801 | if ( heart_beep_timer > -2 ) |
| 10410 | { | ||
| 10411 | 14486683 | heart_beep_timer = -1; | |
| 10412 | 14486683 | stop_sfx(QMisc.miscsfx[sfxLOWHEART]); | |
| 10413 | 14486683 | } | |
| 10414 | } | ||
| 10415 | |||
| 10416 |
2/2✓ Branch 0 taken 14862209 times.
✓ Branch 1 taken 1487 times.
|
14863696 | if (getInput(btnS, INPUT_PRESS | INPUT_HERO_ACTION)) |
| 10417 | { | ||
| 10418 | 1487 | int32_t tmp_subscr_clk = frame; | |
| 10419 | |||
| 10420 | 1487 | int32_t save_type = 0; | |
| 10421 |
3/4✓ Branch 0 taken 1 times.
✓ Branch 1 taken 7 times.
✓ Branch 2 taken 1479 times.
✗ Branch 3 not taken.
|
1487 | switch(lsave) |
| 10422 | { | ||
| 10423 | case 0: | ||
| 10424 | { | ||
| 10425 |
2/2✓ Branch 0 taken 41 times.
✓ Branch 1 taken 1438 times.
|
1479 | if( FFCore.runScriptedActiveSubscreen() ) |
| 10426 | { | ||
| 10427 | 41 | break; | |
| 10428 | } | ||
| 10429 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1438 times.
|
1438 | else if ( !stopSubscreenFalling() ) |
| 10430 | { | ||
| 10431 | 1438 | conveyclk=3; | |
| 10432 | 1438 | dosubscr(); | |
| 10433 | 1438 | newscr_clk += frame - tmp_subscr_clk; | |
| 10434 | 1438 | } | |
| 10435 | 1438 | break; | |
| 10436 | } | ||
| 10437 | |||
| 10438 | case 2: | ||
| 10439 | ✗ | save_type = 1; | |
| 10440 | [[fallthrough]]; | ||
| 10441 | case 1: | ||
| 10442 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
|
7 | if(last_savepoint_id) |
| 10443 | 7 | trigger_save(combobuf[last_savepoint_id], hero_scr); | |
| 10444 | ✗ | else save_game((hero_scr->flags4&fSAVEROOM) != 0, save_type); //sanity? | |
| 10445 | 7 | break; | |
| 10446 | } | ||
| 10447 | 1487 | } | |
| 10448 | |||
| 10449 |
2/2✓ Branch 0 taken 855697 times.
✓ Branch 1 taken 14007997 times.
|
14863694 | if (!checkstab() ) |
| 10450 | { | ||
| 10451 | 14007997 | } | |
| 10452 | |||
| 10453 | 14863694 | check_conveyor(); | |
| 10454 | 14863694 | PhantomsCleanup(); | |
| 10455 | //Try to time the hammer pound so that Hero can;t change direction while it occurs. | ||
| 10456 |
2/2✓ Branch 0 taken 14645768 times.
✓ Branch 1 taken 217926 times.
|
14863694 | if(attack==wHammer) |
| 10457 | { | ||
| 10458 |
6/8✓ Branch 0 taken 2328 times.
✓ Branch 1 taken 215598 times.
✓ Branch 2 taken 2328 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2328 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 5 times.
✓ Branch 7 taken 2323 times.
|
217926 | if(attackclk==12 && z==0 && fakez==0 && sideviewhammerpound()) |
| 10459 | { | ||
| 10460 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 383 times.
✓ Branch 2 taken 538 times.
✓ Branch 3 taken 761 times.
✓ Branch 4 taken 641 times.
|
2323 | switch(dir) //Hero's dir |
| 10461 | { | ||
| 10462 | case up: | ||
| 10463 |
5/10✓ Branch 0 taken 383 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 383 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 383 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 383 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 383 times.
✗ Branch 9 not taken.
|
383 | decorations.add(new dHammerSmack(x-1, y-4, dHAMMERSMACK, 0)); |
| 10464 | 383 | break; | |
| 10465 | |||
| 10466 | case down: | ||
| 10467 |
5/10✓ Branch 0 taken 538 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 538 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 538 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 538 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 538 times.
✗ Branch 9 not taken.
|
538 | decorations.add(new dHammerSmack(x+8, y+28, dHAMMERSMACK, 0)); |
| 10468 | 538 | break; | |
| 10469 | |||
| 10470 | case left: | ||
| 10471 |
5/10✓ Branch 0 taken 761 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 761 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 761 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 761 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 761 times.
✗ Branch 9 not taken.
|
761 | decorations.add(new dHammerSmack(x-13, y+14, dHAMMERSMACK, 0)); |
| 10472 | 761 | break; | |
| 10473 | |||
| 10474 | case right: | ||
| 10475 |
5/10✓ Branch 0 taken 641 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 641 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 641 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 641 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 641 times.
✗ Branch 9 not taken.
|
641 | decorations.add(new dHammerSmack(x+21, y+14, dHAMMERSMACK, 0)); |
| 10476 | 641 | break; | |
| 10477 | } | ||
| 10478 | |||
| 10479 | 2323 | } | |
| 10480 | 217926 | } | |
| 10481 | |||
| 10482 | 14863694 | handleSpotlights(); | |
| 10483 | |||
| 10484 |
2/2✓ Branch 0 taken 14863374 times.
✓ Branch 1 taken 320 times.
|
14863694 | if(getOnSideviewLadder()) |
| 10485 | { | ||
| 10486 |
5/8✓ Branch 0 taken 311 times.
✓ Branch 1 taken 9 times.
✓ Branch 2 taken 311 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 311 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 311 times.
|
320 | if(!canSideviewLadder() || jumping<0 || fall!=0 || fakefall!=0) |
| 10487 | { | ||
| 10488 | 9 | setOnSideviewLadder(false); | |
| 10489 | 9 | } | |
| 10490 |
4/8✓ Branch 0 taken 311 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 78 times.
✓ Branch 3 taken 233 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 78 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
311 | else if(CANFORCEFACEUP) |
| 10491 | { | ||
| 10492 | 78 | setDir(up); | |
| 10493 | 78 | } | |
| 10494 | 320 | } | |
| 10495 |
2/2✓ Branch 0 taken 14575510 times.
✓ Branch 1 taken 288184 times.
|
14863694 | if (justmoved > 0) --justmoved; |
| 10496 | 14863694 | return false; | |
| 10497 | 14865342 | } | |
| 10498 | |||
| 10499 | 5339 | bool HeroClass::push_pixel(zfix dx, zfix dy) | |
| 10500 | { | ||
| 10501 | ASSERT(abs(dx) <= 1 && abs(dy) <= 1); | ||
| 10502 |
3/4✓ Branch 0 taken 2332 times.
✓ Branch 1 taken 3007 times.
✓ Branch 2 taken 2332 times.
✗ Branch 3 not taken.
|
5339 | if(dx && dy) |
| 10503 | { | ||
| 10504 | ✗ | bool r = push_pixel(0,dy); | |
| 10505 | ✗ | bool r2 = push_pixel(dx,0); | |
| 10506 | ✗ | return r && r2; | |
| 10507 | } | ||
| 10508 |
2/2✓ Branch 0 taken 1072 times.
✓ Branch 1 taken 4267 times.
|
5339 | if(dx < 0) |
| 10509 | { | ||
| 10510 |
1/2✓ Branch 0 taken 1072 times.
✗ Branch 1 not taken.
|
2144 | if(!(solpush_walkflag(x+dx,y+(bigHitbox?0:8),1,this) |
| 10511 |
1/2✓ Branch 0 taken 1072 times.
✗ Branch 1 not taken.
|
1072 | || solpush_walkflag(x+dx,y+8,1,this) |
| 10512 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 1072 times.
✓ Branch 2 taken 950 times.
✓ Branch 3 taken 122 times.
|
1072 | || (y.getInt()&7?solpush_walkflag(x+dx,y+16,1,this):0))) |
| 10513 | { | ||
| 10514 | 1072 | x += dx; | |
| 10515 | 1072 | return true; | |
| 10516 | } | ||
| 10517 | ✗ | return false; | |
| 10518 | } | ||
| 10519 |
2/2✓ Branch 0 taken 1260 times.
✓ Branch 1 taken 3007 times.
|
4267 | else if(dx > 0) |
| 10520 | { | ||
| 10521 |
2/2✓ Branch 0 taken 1224 times.
✓ Branch 1 taken 36 times.
|
2504 | if(!(solpush_walkflag(x+15+dx,y+(bigHitbox?0:8),1,this) |
| 10522 |
2/2✓ Branch 0 taken 1244 times.
✓ Branch 1 taken 16 times.
|
1260 | || solpush_walkflag(x+15+dx,y+8,1,this) |
| 10523 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 1244 times.
✓ Branch 2 taken 1037 times.
✓ Branch 3 taken 207 times.
|
1244 | || (y.getInt()&7?solpush_walkflag(x+15+dx,y+16,1,this):0))) |
| 10524 | { | ||
| 10525 | 1224 | x += dx; | |
| 10526 | 1224 | return true; | |
| 10527 | } | ||
| 10528 | 36 | return false; | |
| 10529 | } | ||
| 10530 |
2/2✓ Branch 0 taken 1378 times.
✓ Branch 1 taken 1629 times.
|
3007 | else if(dy < 0) |
| 10531 | { | ||
| 10532 |
2/2✓ Branch 0 taken 1377 times.
✓ Branch 1 taken 1 times.
|
2755 | if(!(solpush_walkflag(x,y+(bigHitbox?0:8)+dy,2,this) |
| 10533 |
4/4✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1377 times.
✓ Branch 2 taken 1169 times.
✓ Branch 3 taken 208 times.
|
1378 | || (x.getInt()&7?solpush_walkflag(x+16,y+(bigHitbox?0:8)+dy,1,this):0))) |
| 10534 | { | ||
| 10535 | 1377 | y += dy; | |
| 10536 | 1377 | return true; | |
| 10537 | } | ||
| 10538 | 1 | return false; | |
| 10539 | } | ||
| 10540 |
1/2✓ Branch 0 taken 1629 times.
✗ Branch 1 not taken.
|
1629 | else if(dy > 0) |
| 10541 | { | ||
| 10542 |
2/2✓ Branch 0 taken 1599 times.
✓ Branch 1 taken 30 times.
|
3228 | if(!(solpush_walkflag(x,y+15+dy,2,this) |
| 10543 |
4/4✓ Branch 0 taken 30 times.
✓ Branch 1 taken 1599 times.
✓ Branch 2 taken 190 times.
✓ Branch 3 taken 1409 times.
|
1629 | || (x.getInt()&7?solpush_walkflag(x+16,y+15+dy,1,this):0))) |
| 10544 | { | ||
| 10545 | 1599 | y += dy; | |
| 10546 | 1599 | return true; | |
| 10547 | } | ||
| 10548 | 30 | return false; | |
| 10549 | } | ||
| 10550 | ✗ | return false; | |
| 10551 | 5339 | } | |
| 10552 | 2537 | int32_t HeroClass::push_move(zfix dx, zfix dy) | |
| 10553 | { | ||
| 10554 | 2537 | int32_t ret = 0; | |
| 10555 |
4/4✓ Branch 0 taken 2332 times.
✓ Branch 1 taken 3662 times.
✓ Branch 2 taken 2537 times.
✓ Branch 3 taken 3457 times.
|
5994 | while(dx || dy) |
| 10556 | { | ||
| 10557 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3457 times.
|
3457 | if(check_pitslide() != -1) |
| 10558 | ✗ | break; | |
| 10559 |
2/2✓ Branch 0 taken 450 times.
✓ Branch 1 taken 3007 times.
|
3457 | if(dy) |
| 10560 | { | ||
| 10561 |
2/2✓ Branch 0 taken 751 times.
✓ Branch 1 taken 2256 times.
|
3007 | zfix cy = (abs(dy) >= 1) ? sign(dy) : dy; |
| 10562 | 3007 | dy -= cy; | |
| 10563 |
2/2✓ Branch 0 taken 2976 times.
✓ Branch 1 taken 31 times.
|
3007 | if(!push_pixel(0,cy)) |
| 10564 | { | ||
| 10565 | 31 | dy = 0; | |
| 10566 | 31 | ret |= 2; | |
| 10567 | 31 | } | |
| 10568 | 3007 | } | |
| 10569 |
2/2✓ Branch 0 taken 1125 times.
✓ Branch 1 taken 2332 times.
|
3457 | if(dx) |
| 10570 | { | ||
| 10571 |
2/2✓ Branch 0 taken 555 times.
✓ Branch 1 taken 1777 times.
|
2332 | zfix cx = (abs(dx) >= 1) ? sign(dx) : dx; |
| 10572 | 2332 | dx -= cx; | |
| 10573 |
2/2✓ Branch 0 taken 2296 times.
✓ Branch 1 taken 36 times.
|
2332 | if(!push_pixel(cx,0)) |
| 10574 | { | ||
| 10575 | 36 | dx = 0; | |
| 10576 | 36 | ret |= 1; | |
| 10577 | 36 | } | |
| 10578 | 2332 | } | |
| 10579 | } | ||
| 10580 | 2537 | return ret; | |
| 10581 | } | ||
| 10582 | |||
| 10583 | 14836784 | bool HeroClass::setSolid(bool set) | |
| 10584 | { | ||
| 10585 |
1/2✓ Branch 0 taken 14836784 times.
✗ Branch 1 not taken.
|
14836784 | bool actual = set && !walk_through_walls; //not solid when noclipping |
| 10586 | 14836784 | bool ret = solid_object::setSolid(actual); | |
| 10587 | 14836784 | solid = set; | |
| 10588 | 14836784 | return ret; | |
| 10589 | } | ||
| 10590 | |||
| 10591 | 32877 | void HeroClass::solid_push(solid_object* obj) | |
| 10592 | { | ||
| 10593 |
1/2✓ Branch 0 taken 32877 times.
✗ Branch 1 not taken.
|
32877 | if(obj == this) return; //can't push self |
| 10594 | |||
| 10595 | 32877 | zfix dx, dy; | |
| 10596 | 32877 | int32_t hdir = -1; | |
| 10597 | 32877 | solid_push_int(obj,dx,dy,hdir,!on_ffc_platform()); | |
| 10598 | |||
| 10599 |
4/4✓ Branch 0 taken 32787 times.
✓ Branch 1 taken 90 times.
✓ Branch 2 taken 32523 times.
✓ Branch 3 taken 264 times.
|
32877 | if(!dx && !dy) return; |
| 10600 | |||
| 10601 | 354 | obj->doContactDamage(hdir); | |
| 10602 | |||
| 10603 | 354 | bool t = obj->getTempNonsolid(); | |
| 10604 | 354 | obj->setTempNonsolid(true); | |
| 10605 | |||
| 10606 | 354 | push_move(dx,dy); | |
| 10607 | |||
| 10608 | 354 | obj->setTempNonsolid(t); | |
| 10609 | 32877 | } | |
| 10610 | |||
| 10611 | #define COND_AWPN (get_qr(qr_SELECTAWPN) ? game->awpn : 255) | ||
| 10612 | #define COND_BWPN (game->bwpn) | ||
| 10613 | #define COND_XWPN (get_qr(qr_SET_XBUTTON_ITEMS) ? game->xwpn : 255) | ||
| 10614 | #define COND_YWPN (get_qr(qr_SET_YBUTTON_ITEMS) ? game->ywpn : 255) | ||
| 10615 | //Helper function | ||
| 10616 | 1330 | static void deselectbombsWPN(word& wpos, int32_t& BTNwpn, int32_t& directItemBTN, | |
| 10617 | word f1 = 255, word f2 = 255, word f3 = 255) | ||
| 10618 | { | ||
| 10619 | 1330 | byte pgn = wpos&0xFF, pos = wpos>>8; | |
| 10620 | 1330 | bool empty = pgn==255; | |
| 10621 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1330 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1330 | if(empty && get_qr(qr_NO_BUTTON_VERIFY)) return; //intentional nothingness |
| 10622 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1330 times.
|
1330 | SubscrPage* pg = new_subscreen_active->get_page(pgn==255?new_subscreen_active->curpage:pgn); |
| 10623 |
1/2✓ Branch 0 taken 1330 times.
✗ Branch 1 not taken.
|
1330 | if(!pg) |
| 10624 | { | ||
| 10625 | ✗ | wpos = 255; //set to nothingness | |
| 10626 | ✗ | return; | |
| 10627 | } | ||
| 10628 | |||
| 10629 |
4/6✓ Branch 0 taken 1309 times.
✓ Branch 1 taken 21 times.
✓ Branch 2 taken 21 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 21 times.
✗ Branch 5 not taken.
|
1330 | auto fp1 = ((f1&0xFF)==255) ? 255 : ((empty || (f1&0xFF)==(wpos&0xFF)) ? f1 : 255); |
| 10630 |
1/6✓ Branch 0 taken 1330 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1330 | auto fp2 = ((f2&0xFF)==255) ? 255 : ((empty || (f2&0xFF)==(wpos&0xFF)) ? f2 : 255); |
| 10631 |
1/6✓ Branch 0 taken 1330 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1330 | auto fp3 = ((f3&0xFF)==255) ? 255 : ((empty || (f3&0xFF)==(wpos&0xFF)) ? f3 : 255); |
| 10632 | 1330 | auto temp = pg->movepos_legacy(SEL_VERIFY_LEFT, wpos, fp1, fp2, fp3); | |
| 10633 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1330 times.
|
1330 | if((temp&0xFF) == 0xFF) |
| 10634 | ✗ | BTNwpn = -1; | |
| 10635 | 1330 | else BTNwpn = pg->get_item_pos(temp>>8); | |
| 10636 |
2/2✓ Branch 0 taken 1328 times.
✓ Branch 1 taken 2 times.
|
1330 | directItemBTN = NEG_OR_MASK(BTNwpn,0xFFF); |
| 10637 | 1330 | wpos = temp; | |
| 10638 | 1330 | } | |
| 10639 | // A routine used exclusively by startwpn, | ||
| 10640 | // to switch Hero's weapon if his current weapon (bombs) was depleted. | ||
| 10641 | 1464 | void HeroClass::deselectbombs(int32_t super) | |
| 10642 | { | ||
| 10643 |
6/10✓ Branch 0 taken 1347 times.
✓ Branch 1 taken 117 times.
✓ Branch 2 taken 1347 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1347 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1347 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 1347 times.
|
1464 | if ( get_qr(qr_NEVERDISABLEAMMOONSUBSCREEN) || itemsbuf[game->forced_awpn].type == itype_bomb || itemsbuf[game->forced_bwpn].type == itype_bomb || itemsbuf[game->forced_xwpn].type == itype_bomb || itemsbuf[game->forced_ywpn].type == itype_bomb) return; |
| 10644 |
4/6✓ Branch 0 taken 1330 times.
✓ Branch 1 taken 17 times.
✓ Branch 2 taken 1330 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1330 times.
✗ Branch 5 not taken.
|
1347 | if(getItemFamily(itemsbuf,Bwpn)==(super? itype_sbomb : itype_bomb) && (directWpn<0 || Bwpn==directWpn)) |
| 10645 | { | ||
| 10646 |
1/2✓ Branch 0 taken 1330 times.
✗ Branch 1 not taken.
|
1330 | if(!new_subscreen_active) |
| 10647 | ✗ | return; | |
| 10648 |
4/6✓ Branch 0 taken 21 times.
✓ Branch 1 taken 1309 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1330 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1330 times.
|
1330 | deselectbombsWPN(game->bwpn, Bwpn, directItemB, COND_AWPN, COND_XWPN, COND_YWPN); |
| 10649 | 1330 | } | |
| 10650 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 17 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
17 | else if (getItemFamily(itemsbuf,Xwpn)==(super? itype_sbomb : itype_bomb) && (directWpn<0 || Xwpn==directWpn)) |
| 10651 | { | ||
| 10652 | ✗ | if(!new_subscreen_active) | |
| 10653 | ✗ | return; | |
| 10654 | ✗ | deselectbombsWPN(game->xwpn, Xwpn, directItemX, COND_AWPN, COND_BWPN, COND_YWPN); | |
| 10655 | ✗ | } | |
| 10656 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 17 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
17 | else if (getItemFamily(itemsbuf,Ywpn)==(super? itype_sbomb : itype_bomb) && (directWpn<0 || Ywpn==directWpn)) |
| 10657 | { | ||
| 10658 | ✗ | if(!new_subscreen_active) | |
| 10659 | ✗ | return; | |
| 10660 | ✗ | deselectbombsWPN(game->ywpn, Ywpn, directItemY, COND_AWPN, COND_XWPN, COND_BWPN); | |
| 10661 | ✗ | } | |
| 10662 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 17 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
17 | else if (getItemFamily(itemsbuf,Awpn)==(super? itype_sbomb : itype_bomb) && (directWpn<0 || Awpn==directWpn)) |
| 10663 | { | ||
| 10664 | ✗ | if(!new_subscreen_active) | |
| 10665 | ✗ | return; | |
| 10666 | ✗ | deselectbombsWPN(game->awpn, Awpn, directItemA, COND_BWPN, COND_XWPN, COND_YWPN); | |
| 10667 | ✗ | } | |
| 10668 | 1464 | } | |
| 10669 | |||
| 10670 | int32_t potion_life=0; | ||
| 10671 | int32_t potion_magic=0; | ||
| 10672 | |||
| 10673 | 148649 | static bool drown_check(int cid) | |
| 10674 | { | ||
| 10675 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 148649 times.
|
148649 | if(Hero.is_autowalking()) return false; |
| 10676 | 148649 | int flippers_id = current_item_id(itype_flippers); | |
| 10677 |
2/2✓ Branch 0 taken 147783 times.
✓ Branch 1 taken 866 times.
|
148649 | if (flippers_id < 0) |
| 10678 | 866 | return true; | |
| 10679 | 147783 | itemdata const& itm = itemsbuf[flippers_id]; | |
| 10680 | 147783 | newcombo const& cmb = combobuf[cid]; | |
| 10681 |
4/4✓ Branch 0 taken 6 times.
✓ Branch 1 taken 147777 times.
✓ Branch 2 taken 143007 times.
✓ Branch 3 taken 4770 times.
|
147783 | return (itm.level < cmb.attribytes[0] || ((cmb.usrflags & cflag1) && !(itm.flags & item_flag3))); |
| 10682 | 148649 | } | |
| 10683 | 19447325 | int HeroClass::onWater(bool drownonly) | |
| 10684 | { | ||
| 10685 |
13/22✓ Branch 0 taken 41972 times.
✓ Branch 1 taken 19405353 times.
✓ Branch 2 taken 19405353 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 19405353 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 19405353 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 41972 times.
✓ Branch 9 taken 19405353 times.
✓ Branch 10 taken 41972 times.
✓ Branch 11 taken 19405353 times.
✓ Branch 12 taken 41972 times.
✓ Branch 13 taken 19405353 times.
✓ Branch 14 taken 159582 times.
✓ Branch 15 taken 19203799 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
✗ Branch 20 not taken.
✗ Branch 21 not taken.
|
38852678 | if (replay_is_active() && replay_get_meta_str("sav") == "nargads_trail_crystal_crusades_23_of_24.sav") |
| 10686 | ; // old broken behavior skips the below check in some circumstances | ||
| 10687 |
6/8✓ Branch 0 taken 19078331 times.
✓ Branch 1 taken 125468 times.
✓ Branch 2 taken 19078275 times.
✓ Branch 3 taken 56 times.
✓ Branch 4 taken 19078239 times.
✓ Branch 5 taken 36 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
19203799 | else if(ladderx || laddery || hoverclk || action == rafting |
| 10688 |
11/12✓ Branch 0 taken 18948639 times.
✓ Branch 1 taken 129600 times.
✓ Branch 2 taken 18939337 times.
✓ Branch 3 taken 9302 times.
✓ Branch 4 taken 38254 times.
✓ Branch 5 taken 18901083 times.
✓ Branch 6 taken 18909039 times.
✓ Branch 7 taken 34016 times.
✓ Branch 8 taken 18909039 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 18827230 times.
✓ Branch 11 taken 81809 times.
|
19078239 | || inlikelike || DRIEDLAKE || z || fakez || fall < 0 || fakefall < 0 |
| 10689 |
2/4✓ Branch 0 taken 18827230 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 18827230 times.
|
18827230 | || (platform_ffc && !sideview_mode())) |
| 10690 | 418541 | return 0; // player isn't in water | |
| 10691 | 18986812 | int32_t water = 0; | |
| 10692 | 18986812 | int32_t types[4] = {0}; | |
| 10693 | 18986812 | int32_t x1 = x+4, x2 = x+11, | |
| 10694 | 18986812 | y1 = y+9, y2 = y+15; | |
| 10695 |
2/2✓ Branch 0 taken 3633264 times.
✓ Branch 1 taken 15353548 times.
|
18986812 | if (get_qr(qr_SMARTER_WATER)) |
| 10696 | { | ||
| 10697 |
4/4✓ Branch 0 taken 24295 times.
✓ Branch 1 taken 3608969 times.
✓ Branch 2 taken 55 times.
✓ Branch 3 taken 17161 times.
|
3650480 | if (iswaterex_z3(0, -1, x1, y1, true, false) && |
| 10698 |
2/2✓ Branch 0 taken 21064 times.
✓ Branch 1 taken 3231 times.
|
24295 | iswaterex_z3(0, -1, x1, y2, true, false) && |
| 10699 |
2/2✓ Branch 0 taken 17216 times.
✓ Branch 1 taken 3848 times.
|
21064 | iswaterex_z3(0, -1, x2, y1, true, false) && |
| 10700 | 17216 | iswaterex_z3(0, -1, x2, y2, true, false)) water = iswaterex_z3(0, -1, (x2+x1)/2,(y2+y1)/2, true, false); | |
| 10701 | 3633264 | } | |
| 10702 | else | ||
| 10703 | { | ||
| 10704 | 15353548 | rpos_handle_t rpos_handles[4]; | |
| 10705 | 15353548 | rpos_handles[0] = get_rpos_handle_for_world_xy(x1, y1, 0); | |
| 10706 | 15353548 | rpos_handles[1] = get_rpos_handle_for_world_xy(x1, y2, 0); | |
| 10707 | 15353548 | rpos_handles[2] = get_rpos_handle_for_world_xy(x2, y1, 0); | |
| 10708 | 15353548 | rpos_handles[3] = get_rpos_handle_for_world_xy(x2, y2, 0); | |
| 10709 | |||
| 10710 | 15353548 | types[0] = rpos_handles[0].ctype(); | |
| 10711 |
2/2✓ Branch 0 taken 15125722 times.
✓ Branch 1 taken 227826 times.
|
15353548 | if (auto ffc_handle = getFFCAt(x1, y1)) |
| 10712 | 227826 | types[0] = ffc_handle->ctype(); | |
| 10713 | |||
| 10714 | 15353548 | types[1] = rpos_handles[1].ctype(); | |
| 10715 |
2/2✓ Branch 0 taken 15154122 times.
✓ Branch 1 taken 199426 times.
|
15353548 | if (auto ffc_handle = getFFCAt(x1, y2)) |
| 10716 | 199426 | types[1] = ffc_handle->ctype(); | |
| 10717 | |||
| 10718 | 15353548 | types[2] = rpos_handles[2].ctype(); | |
| 10719 |
2/2✓ Branch 0 taken 15122621 times.
✓ Branch 1 taken 230927 times.
|
15353548 | if (auto ffc_handle = getFFCAt(x2, y1)) |
| 10720 | 230927 | types[2] = ffc_handle->ctype(); | |
| 10721 | |||
| 10722 | 15353548 | types[3] = rpos_handles[3].ctype(); | |
| 10723 |
2/2✓ Branch 0 taken 15147393 times.
✓ Branch 1 taken 206155 times.
|
15353548 | if (auto ffc_handle = getFFCAt(x2, y2)) |
| 10724 | 206155 | types[3] = ffc_handle->ctype(); | |
| 10725 | |||
| 10726 | 15353548 | auto rpos_handle = get_rpos_handle_for_world_xy((x2+x1)/2, (y2+y1)/2, 0); | |
| 10727 | 15353548 | auto typec = rpos_handle.ctype(); | |
| 10728 | 15353548 | auto cid = rpos_handle.data(); | |
| 10729 |
2/2✓ Branch 0 taken 15135801 times.
✓ Branch 1 taken 217747 times.
|
15353548 | if (auto ffc_handle = getFFCAt((x2+x1)/2, (y2+y1)/2)) |
| 10730 | { | ||
| 10731 | 217747 | typec = ffc_handle->ctype(); | |
| 10732 | 217747 | cid = ffc_handle->data(); | |
| 10733 | 217747 | } | |
| 10734 | |||
| 10735 |
5/6✓ Branch 0 taken 133431 times.
✓ Branch 1 taken 15220117 times.
✓ Branch 2 taken 132794 times.
✓ Branch 3 taken 637 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 131778 times.
|
15485326 | if(combo_class_buf[types[0]].water && combo_class_buf[types[1]].water && |
| 10736 |
4/4✓ Branch 0 taken 132019 times.
✓ Branch 1 taken 775 times.
✓ Branch 2 taken 131778 times.
✓ Branch 3 taken 241 times.
|
132794 | combo_class_buf[types[2]].water && combo_class_buf[types[3]].water && combo_class_buf[typec].water) |
| 10737 | 131778 | water = cid; | |
| 10738 | } | ||
| 10739 |
2/2✓ Branch 0 taken 18837873 times.
✓ Branch 1 taken 148939 times.
|
18986812 | if(water > 0) |
| 10740 | { | ||
| 10741 |
4/4✓ Branch 0 taken 137727 times.
✓ Branch 1 taken 11212 times.
✓ Branch 2 taken 454 times.
✓ Branch 3 taken 137273 times.
|
148939 | if(!drownonly || drown_check(water)) |
| 10742 | 11666 | return water; | |
| 10743 | 137273 | } | |
| 10744 | 18975146 | return 0; | |
| 10745 | 19405353 | } | |
| 10746 | |||
| 10747 | ✗ | bool HeroClass::mirrorBonk() | |
| 10748 | { | ||
| 10749 | ✗ | zfix tx = x, ty = y, tz = z; | |
| 10750 | ✗ | WalkflagInfo info = walkflag(x,y+(bigHitbox?0:8),2,up); | |
| 10751 | ✗ | info = info || walkflagMBlock(x+8,y+(bigHitbox?0:8)); | |
| 10752 | ✗ | execute(info); | |
| 10753 | ✗ | bool fail = info.isUnwalkable(); | |
| 10754 | |||
| 10755 | ✗ | if(!fail) //not solid, but check for water/pits... | |
| 10756 | { | ||
| 10757 | ✗ | if(onWater(true)) | |
| 10758 | ✗ | fail = true; | |
| 10759 | ✗ | if(pitslide() || fallclk) | |
| 10760 | ✗ | fail = true; | |
| 10761 | ✗ | fallclk = 0; | |
| 10762 | ✗ | } | |
| 10763 | ✗ | x = tx; y = ty; z = tz; | |
| 10764 | ✗ | return fail; | |
| 10765 | } | ||
| 10766 | |||
| 10767 | ✗ | void HeroClass::doMirror(int32_t mirrorid) | |
| 10768 | { | ||
| 10769 | ✗ | if(z > 0 || fakez > 0) return; //No mirror in air | |
| 10770 | ✗ | if(mirrorid < 0) | |
| 10771 | ✗ | mirrorid = current_item_id(itype_mirror); | |
| 10772 | ✗ | if(mirrorid < 0) return; | |
| 10773 | ✗ | if (on_cooldown(mirrorid)) return; | |
| 10774 | |||
| 10775 | ✗ | if((hero_scr->flags9&fDISABLE_MIRROR) || !(checkbunny(mirrorid) && checkmagiccost(mirrorid))) | |
| 10776 | { | ||
| 10777 | ✗ | item_error(); | |
| 10778 | ✗ | return; | |
| 10779 | } | ||
| 10780 | static const int32_t sens = 4; //sensitivity of 'No Mirror' combos (0 most, 8 least) | ||
| 10781 | ✗ | rpos_t rposes[] = {COMBOPOS_REGION_B(x+sens,y+sens), COMBOPOS_REGION_B(x+sens,y+15-sens), | |
| 10782 | ✗ | COMBOPOS_REGION_B(x+15-sens,y+sens), COMBOPOS_REGION_B(x+15-sens,y+15-sens)}; | |
| 10783 | ✗ | for(auto rpos : rposes) | |
| 10784 | { | ||
| 10785 | ✗ | if (rpos == rpos_t::None) | |
| 10786 | ✗ | continue; | |
| 10787 | |||
| 10788 | ✗ | if(HASFLAG_ANY(mfNOMIRROR, rpos)) //"No Mirror" flag touching the player | |
| 10789 | { | ||
| 10790 | ✗ | item_error(); | |
| 10791 | ✗ | return; | |
| 10792 | } | ||
| 10793 | } | ||
| 10794 | |||
| 10795 | ✗ | itemdata const& mirror = itemsbuf[mirrorid]; | |
| 10796 | ✗ | if(DMaps[cur_dmap].flags & dmfMIRRORCONTINUE) | |
| 10797 | { | ||
| 10798 | ✗ | paymagiccost(mirrorid); | |
| 10799 | ✗ | start_cooldown(mirrorid); | |
| 10800 | ✗ | if(mirror.usesound2) sfx(mirror.usesound2); | |
| 10801 | |||
| 10802 | ✗ | doWarpEffect(mirror.misc2, true); | |
| 10803 | ✗ | if(mirror.flags & item_flag2) //Act as F6->Continue | |
| 10804 | { | ||
| 10805 | ✗ | Quit = qCONT; | |
| 10806 | ✗ | skipcont = 1; | |
| 10807 | ✗ | } | |
| 10808 | else //Act as Divine Escape | ||
| 10809 | { | ||
| 10810 | ✗ | int32_t div_prot_temp=div_prot_item; | |
| 10811 | ✗ | restart_level(); | |
| 10812 | ✗ | div_prot_item=div_prot_temp; | |
| 10813 | ✗ | magicitem=-1; | |
| 10814 | ✗ | magiccastclk=0; | |
| 10815 | ✗ | if ( Hero.getDontDraw() < 2 ) { Hero.setDontDraw(0); } | |
| 10816 | } | ||
| 10817 | ✗ | } | |
| 10818 | else | ||
| 10819 | { | ||
| 10820 | ✗ | int32_t destdmap = DMaps[cur_dmap].mirrorDMap; | |
| 10821 | ✗ | int32_t offscr = cur_screen - DMaps[cur_dmap].xoff; | |
| 10822 | ✗ | if(destdmap < 0) | |
| 10823 | ✗ | return; | |
| 10824 | ✗ | int32_t destscr = DMaps[destdmap].xoff + offscr; | |
| 10825 | ✗ | if((offscr%16 != destscr%16) || unsigned(destscr) >= 0x80) | |
| 10826 | ✗ | return; | |
| 10827 | ✗ | paymagiccost(mirrorid); | |
| 10828 | ✗ | start_cooldown(mirrorid); | |
| 10829 | |||
| 10830 | //Store some values to restore if 'warp fails' | ||
| 10831 | ✗ | int32_t tLastEntrance = lastentrance, | |
| 10832 | ✗ | tLastEntranceDMap = lastentrance_dmap, | |
| 10833 | ✗ | tContScr = game->get_continue_scrn(), | |
| 10834 | ✗ | tContDMap = game->get_continue_dmap(), | |
| 10835 | ✗ | tPortalDMap = game->saved_mirror_portal.srcdmap; | |
| 10836 | ✗ | int32_t sourcescr = cur_screen, sourcedmap = cur_dmap; | |
| 10837 | ✗ | zfix tx = x, ty = y, tz = z; | |
| 10838 | ✗ | game->saved_mirror_portal.srcdmap = -1; | |
| 10839 | ✗ | action = none; FFCore.setHeroAction(none); | |
| 10840 | |||
| 10841 | //Warp to new dmap | ||
| 10842 | ✗ | FFCore.warp_player(wtIWARP, destdmap, destscr, -1, -1, mirror.misc1, | |
| 10843 | ✗ | mirror.usesound, 0, -1); | |
| 10844 | |||
| 10845 | //Check for valid landing location | ||
| 10846 | ✗ | if(mirrorBonk()) //Invalid landing, warp back! | |
| 10847 | { | ||
| 10848 | ✗ | action = none; FFCore.setHeroAction(none); | |
| 10849 | ✗ | lastentrance = tLastEntrance; | |
| 10850 | ✗ | lastentrance_dmap = tLastEntranceDMap; | |
| 10851 | ✗ | game->set_continue_scrn(tContScr); | |
| 10852 | ✗ | game->set_continue_dmap(tContDMap); | |
| 10853 | ✗ | x = tx; | |
| 10854 | ✗ | y = ty; | |
| 10855 | ✗ | z = tz; | |
| 10856 | ✗ | game->saved_mirror_portal.srcdmap = tPortalDMap; | |
| 10857 | ✗ | FFCore.warp_player(wtIWARP, sourcedmap, sourcescr, -1, -1, mirror.misc1, | |
| 10858 | ✗ | mirror.usesound, 0, -1); | |
| 10859 | ✗ | } | |
| 10860 | ✗ | else if(mirror.flags & item_flag1) //Place portal! | |
| 10861 | { | ||
| 10862 | //Place the portal | ||
| 10863 | ✗ | game->set_portal(sourcedmap, destdmap, offscr, x.getZLong(), y.getZLong(), mirror.usesound, mirror.misc1, mirror.wpn); | |
| 10864 | //Since it was placed after loading this screen, load the portal object now | ||
| 10865 | ✗ | game->load_portal(); | |
| 10866 | //Don't immediately trigger the warp back | ||
| 10867 | ✗ | mirror_portal.prox_active = false; | |
| 10868 | |||
| 10869 | //Set continue point | ||
| 10870 | ✗ | if(cur_dmap != game->get_continue_dmap()) | |
| 10871 | { | ||
| 10872 | ✗ | game->set_continue_scrn(DMaps[cur_dmap].cont + DMaps[cur_dmap].xoff); | |
| 10873 | ✗ | } | |
| 10874 | ✗ | game->set_continue_dmap(cur_dmap); | |
| 10875 | ✗ | lastentrance_dmap = cur_dmap; | |
| 10876 | ✗ | lastentrance = game->get_continue_scrn(); | |
| 10877 | ✗ | } | |
| 10878 | } | ||
| 10879 | ✗ | } | |
| 10880 | |||
| 10881 | 14835456 | void HeroClass::handle_passive_buttons() | |
| 10882 | { | ||
| 10883 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14835456 times.
|
14835456 | if(no_control()) return; |
| 10884 | 14835456 | do_liftglove(-1,true); | |
| 10885 | 14835456 | do_jump(-1,true); | |
| 10886 | 14835456 | } | |
| 10887 | |||
| 10888 | 14821126 | void HeroClass::for_each_rpos_stood_on(std::function<void(const rpos_handle_t&)> proc) | |
| 10889 | { | ||
| 10890 | 14821126 | auto rpos = COMBOPOS_REGION_B(x+8, y+(sideview_mode()?16:12)); | |
| 10891 |
2/2✓ Branch 0 taken 322384 times.
✓ Branch 1 taken 14498742 times.
|
14821126 | auto rpos2 = sideview_mode() ? COMBOPOS_REGION_B(x+8, y+12) : rpos_t::None; |
| 10892 |
4/4✓ Branch 0 taken 1161 times.
✓ Branch 1 taken 14819965 times.
✓ Branch 2 taken 549 times.
✓ Branch 3 taken 612 times.
|
14821126 | if (rpos != rpos_t::None || rpos2 != rpos_t::None) |
| 10893 | { | ||
| 10894 |
2/2✓ Branch 0 taken 103743598 times.
✓ Branch 1 taken 14820514 times.
|
118564112 | for (int layer = 0; layer < 7; ++layer) |
| 10895 | { | ||
| 10896 |
2/2✓ Branch 0 taken 3843 times.
✓ Branch 1 taken 103739755 times.
|
103743598 | if (rpos != rpos_t::None) |
| 10897 | { | ||
| 10898 | 103739755 | auto handle = get_rpos_handle(rpos, layer); | |
| 10899 |
3/4✓ Branch 0 taken 2252845 times.
✓ Branch 1 taken 101486910 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2252845 times.
|
103739755 | if (!sideview_mode() || !(handle.combo().genflags & cflag5)) |
| 10900 | 103739755 | proc(handle); | |
| 10901 | 103739755 | } | |
| 10902 |
2/2✓ Branch 0 taken 101486910 times.
✓ Branch 1 taken 2256688 times.
|
103743598 | if (rpos2 != rpos_t::None) |
| 10903 | { | ||
| 10904 | 2256688 | auto handle = get_rpos_handle(rpos2, layer); | |
| 10905 |
1/2✓ Branch 0 taken 2256688 times.
✗ Branch 1 not taken.
|
2256688 | if (handle.combo().genflags & cflag5) // sideview_mode() already checked above |
| 10906 | ✗ | proc(handle); | |
| 10907 | 2256688 | } | |
| 10908 | 103743598 | } | |
| 10909 | 14820514 | } | |
| 10910 | 14821126 | } | |
| 10911 | |||
| 10912 | 3793 | void HeroClass::land_on_ground() | |
| 10913 | { | ||
| 10914 |
1/2✓ Branch 0 taken 3793 times.
✗ Branch 1 not taken.
|
3793 | if (fakez<0) fakez = 0; |
| 10915 |
1/2✓ Branch 0 taken 3793 times.
✗ Branch 1 not taken.
|
3793 | if (z<0) z = 0; |
| 10916 | |||
| 10917 | 3793 | bool played_land_sfx = false; | |
| 10918 |
2/2✓ Branch 0 taken 77 times.
✓ Branch 1 taken 3716 times.
|
3793 | if(get_qr(qr_OLD_LANDING_SFX)) |
| 10919 | { | ||
| 10920 |
9/10✓ Branch 0 taken 3307 times.
✓ Branch 1 taken 409 times.
✓ Branch 2 taken 10 times.
✓ Branch 3 taken 399 times.
✓ Branch 4 taken 9 times.
✓ Branch 5 taken 1 times.
✓ Branch 6 taken 9 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 3694 times.
✓ Branch 9 taken 22 times.
|
4125 | if(!sideview_mode() && ((iswaterex_z3(MAPCOMBO(x,y+8), -1, x, y+8, true, false) && ladderx<=0 && laddery<=0) || COMBOTYPE(x,y+8)==cSHALLOWWATER)) |
| 10921 | 22 | sfx(WAV_ZN1SPLASH,pan(x)); | |
| 10922 | 3716 | played_land_sfx = true; | |
| 10923 | 3716 | } | |
| 10924 | |||
| 10925 |
1/2✓ Branch 0 taken 3793 times.
✗ Branch 1 not taken.
|
30295 | for_each_rpos_stood_on([&](const rpos_handle_t& handle) |
| 10926 | { | ||
| 10927 | 26502 | auto& cmb = handle.combo(); | |
| 10928 | 26502 | byte csfx = cmb.sfx_landing; | |
| 10929 |
3/4✓ Branch 0 taken 27 times.
✓ Branch 1 taken 26475 times.
✓ Branch 2 taken 27 times.
✗ Branch 3 not taken.
|
26502 | if (csfx && !get_qr(qr_OLD_LANDING_SFX)) |
| 10930 | { | ||
| 10931 | ✗ | sfx(csfx, pan(x)); | |
| 10932 | ✗ | played_land_sfx = true; | |
| 10933 | ✗ | } | |
| 10934 |
1/2✓ Branch 0 taken 26502 times.
✗ Branch 1 not taken.
|
26714 | trig_each_combo_trigger(handle, [&](combo_trigger const& trig){ |
| 10935 | 212 | return trig.trigger_flags.get(TRIGFLAG_PLAYERLANDHERE); | |
| 10936 | }); | ||
| 10937 | 26502 | }); | |
| 10938 | |||
| 10939 |
3/4✓ Branch 0 taken 77 times.
✓ Branch 1 taken 3716 times.
✓ Branch 2 taken 77 times.
✗ Branch 3 not taken.
|
3793 | if(!played_land_sfx && QMisc.miscsfx[sfxHERO_LANDS]) |
| 10940 | ✗ | sfx(QMisc.miscsfx[sfxHERO_LANDS], pan(x)); | |
| 10941 | |||
| 10942 | |||
| 10943 | 1869041 | for_some_rpos([&](const rpos_handle_t& rpos_handle) { | |
| 10944 |
1/2✓ Branch 0 taken 1865248 times.
✗ Branch 1 not taken.
|
1889804 | trig_each_combo_trigger(rpos_handle, [&](combo_trigger const& trig){ |
| 10945 | 24556 | return trig.trigger_flags.get(TRIGFLAG_PLAYERLANDANYWHERE); | |
| 10946 | }); | ||
| 10947 | |||
| 10948 | 1865248 | return true; | |
| 10949 | ✗ | }); | |
| 10950 | 117711 | for_some_ffcs([&](const ffc_handle_t& ffc_handle) { | |
| 10951 |
1/2✓ Branch 0 taken 113918 times.
✗ Branch 1 not taken.
|
113918 | trig_each_combo_trigger(ffc_handle, [&](combo_trigger const& trig){ |
| 10952 | ✗ | return trig.trigger_flags.get(TRIGFLAG_PLAYERLANDANYWHERE); | |
| 10953 | }); | ||
| 10954 | |||
| 10955 | 113918 | return true; | |
| 10956 | ✗ | }); | |
| 10957 | 3793 | } | |
| 10958 | |||
| 10959 | 2248 | bool HeroClass::run_item_action_script(int itemid, bool paid_magic) | |
| 10960 | { | ||
| 10961 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2248 times.
|
2248 | if (unsigned(itemid) > MAXITEMS) |
| 10962 | ✗ | return false; | |
| 10963 | 2248 | itemdata const& itm = itemsbuf[itemid]; | |
| 10964 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2248 times.
|
2248 | if (!itm.script) |
| 10965 | 2248 | return false; | |
| 10966 | ✗ | if (FFCore.doscript(ScriptType::Item, itemid) && get_qr(qr_ITEMSCRIPTSKEEPRUNNING)) | |
| 10967 | ✗ | return false; //already running! | |
| 10968 | ✗ | if (!checkitem_jinx(itemid)) | |
| 10969 | ✗ | return false; | |
| 10970 | ✗ | if (!(paid_magic || checkmagiccost(itemid))) | |
| 10971 | ✗ | return false; | |
| 10972 | ✗ | if (!checkbunny(itemid)) | |
| 10973 | ✗ | return false; | |
| 10974 | ✗ | if (!paid_magic) | |
| 10975 | ✗ | paymagiccost(itemid); | |
| 10976 | ✗ | FFCore.reset_script_engine_data(ScriptType::Item, itemid); | |
| 10977 | ✗ | ZScriptVersion::RunScript(ScriptType::Item, itm.script, itemid); | |
| 10978 | |||
| 10979 | ✗ | did_scriptb = true; // unsure if this is really necessary, but copying this part just in case. | |
| 10980 | ✗ | return true; | |
| 10981 | 2248 | } | |
| 10982 | |||
| 10983 | static bool did_passive_jump = false; | ||
| 10984 | 14835841 | bool HeroClass::do_jump(int32_t jumpid, bool passive) | |
| 10985 | { | ||
| 10986 |
2/2✓ Branch 0 taken 385 times.
✓ Branch 1 taken 14835456 times.
|
14835841 | if(passive) did_passive_jump = false; |
| 10987 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 385 times.
|
385 | else if(did_passive_jump) return false; //don't jump twice in the same frame |
| 10988 | |||
| 10989 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14835841 times.
|
14835841 | if (on_cooldown(jumpid)) return false; |
| 10990 |
2/2✓ Branch 0 taken 629529 times.
✓ Branch 1 taken 14206312 times.
|
14835841 | if(nomove_action(action)) return false; //can't jump while ex. drowning |
| 10991 |
2/2✓ Branch 0 taken 454 times.
✓ Branch 1 taken 14205858 times.
|
14206312 | if(onWater(true)) return false; //Don't allow jumping off of water frame-perfectly... |
| 10992 | |||
| 10993 |
2/2✓ Branch 0 taken 383 times.
✓ Branch 1 taken 14205475 times.
|
14205858 | if(jumpid < 0) |
| 10994 | 14205475 | jumpid = current_item_id(itype_rocs,true,true); | |
| 10995 | |||
| 10996 |
2/2✓ Branch 0 taken 13815841 times.
✓ Branch 1 taken 390017 times.
|
14205858 | if(unsigned(jumpid) >= MAXITEMS) return false; |
| 10997 |
4/4✓ Branch 0 taken 388790 times.
✓ Branch 1 taken 1227 times.
✓ Branch 2 taken 1935 times.
✓ Branch 3 taken 386855 times.
|
390017 | if(inlikelike || charging) return false; |
| 10998 |
1/2✓ Branch 0 taken 386855 times.
✗ Branch 1 not taken.
|
386855 | if(!checkitem_jinx(jumpid)) return false; |
| 10999 | |||
| 11000 | 386855 | itemdata const& itm = itemsbuf[jumpid]; | |
| 11001 | |||
| 11002 | 386855 | bool standing = isStanding(true); | |
| 11003 |
3/4✓ Branch 0 taken 372203 times.
✓ Branch 1 taken 14652 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 14652 times.
|
386855 | bool coyotejump = !standing && coyotetime < (zc_min(65535,itm.misc5)); |
| 11004 |
4/6✓ Branch 0 taken 386855 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 14652 times.
✓ Branch 3 taken 372203 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 14652 times.
|
386855 | if(!(coyotejump || standing || extra_jump_count < itm.misc1)) return false; |
| 11005 |
2/4✓ Branch 0 taken 372203 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 372203 times.
|
372203 | if(!(checkbunny(jumpid) && checkmagiccost(jumpid))) |
| 11006 | { | ||
| 11007 | ✗ | item_error(); | |
| 11008 | ✗ | return false; | |
| 11009 | } | ||
| 11010 | |||
| 11011 | 372203 | byte intbtn = byte(itm.misc2&0xFF); | |
| 11012 |
2/2✓ Branch 0 taken 368 times.
✓ Branch 1 taken 371835 times.
|
372203 | if(passive) |
| 11013 | { | ||
| 11014 |
1/2✓ Branch 0 taken 371835 times.
✗ Branch 1 not taken.
|
371835 | if(!getIntBtnInput(intbtn, INPUT_PRESS | INPUT_DRUNK | INPUT_PEEK)) |
| 11015 | 371835 | return false; //not pressed | |
| 11016 | ✗ | } | |
| 11017 | |||
| 11018 | 368 | paymagiccost(jumpid); | |
| 11019 | 368 | start_cooldown(jumpid); | |
| 11020 | |||
| 11021 |
1/2✓ Branch 0 taken 368 times.
✗ Branch 1 not taken.
|
368 | if (itm.flags & item_flag6) // delayed effect on release, store the jump id |
| 11022 | { | ||
| 11023 | ✗ | current_rocs_jump_id = jumpid; | |
| 11024 | ✗ | released_jump_button = false; | |
| 11025 | ✗ | } | |
| 11026 | |||
| 11027 |
1/2✓ Branch 0 taken 368 times.
✗ Branch 1 not taken.
|
368 | if(!standing) |
| 11028 | { | ||
| 11029 | ✗ | ++extra_jump_count; | |
| 11030 | ✗ | fall = 0; | |
| 11031 | ✗ | fakefall = 0; | |
| 11032 | ✗ | if(hoverclk > 0) | |
| 11033 | ✗ | hoverclk = -hoverclk; | |
| 11034 | ✗ | } | |
| 11035 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 368 times.
|
368 | if(itm.flags & item_flag1) |
| 11036 | ✗ | setFall(fall - itm.power); | |
| 11037 | 368 | else setFall(fall - (FEATHERJUMP*(itm.power+2))); | |
| 11038 | 368 | coyotetime = 65535; //jumped, so no coyotetime | |
| 11039 | 368 | setOnSideviewLadder(false); | |
| 11040 | |||
| 11041 | // Reset the ladder, unless on an unwalkable combo | ||
| 11042 |
4/6✓ Branch 0 taken 367 times.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 367 times.
✓ Branch 4 taken 368 times.
✗ Branch 5 not taken.
|
368 | if((ladderx || laddery) && !(_walkflag(ladderx,laddery,0,get_standing_z_state()))) |
| 11043 | ✗ | reset_ladder(); | |
| 11044 | |||
| 11045 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 368 times.
|
368 | if(itm.usesound) |
| 11046 | 368 | sfx(itm.usesound,pan(x)); | |
| 11047 | |||
| 11048 |
1/2✓ Branch 0 taken 368 times.
✗ Branch 1 not taken.
|
368 | if(passive) |
| 11049 | { | ||
| 11050 | ✗ | did_passive_jump = true; | |
| 11051 | ✗ | getIntBtnInput(intbtn, INPUT_PRESS | INPUT_DRUNK); //eat buttons | |
| 11052 | ✗ | if (!get_qr(qr_ACTIVE_SHIELD_PASSIVE_ROC_NO_SCRIPT)) | |
| 11053 | ✗ | run_item_action_script(jumpid, true); | |
| 11054 | ✗ | } | |
| 11055 | 368 | return true; | |
| 11056 | 14835841 | } | |
| 11057 | 15688 | void HeroClass::drop_liftwpn() | |
| 11058 | { | ||
| 11059 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 15687 times.
|
15688 | if(!lift_wpn) return; |
| 11060 | |||
| 11061 | 1 | handle_lift(false); //sets position properly, accounting for large weapons | |
| 11062 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | int liftid = last_lift_id ? *last_lift_id : current_item_id(itype_liftglove,true,true); |
| 11063 | 1 | itemdata const& glove = itemsbuf[liftid]; | |
| 11064 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | if(isSideViewGravity()) |
| 11065 | { | ||
| 11066 | ✗ | lift_wpn->moveflags |= move_no_fake_z; | |
| 11067 | ✗ | } | |
| 11068 | else | ||
| 11069 | { | ||
| 11070 | 1 | auto lheight = liftheight+z+fakez; | |
| 11071 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | if(glove.flags & item_flag1) |
| 11072 | { | ||
| 11073 | ✗ | lift_wpn->z = 0; | |
| 11074 | ✗ | lift_wpn->fakez = lheight; | |
| 11075 | ✗ | lift_wpn->moveflags |= move_no_real_z; | |
| 11076 | ✗ | } | |
| 11077 | else | ||
| 11078 | { | ||
| 11079 | 1 | lift_wpn->z = lheight; | |
| 11080 | 1 | lift_wpn->moveflags |= move_no_fake_z; | |
| 11081 | } | ||
| 11082 | } | ||
| 11083 | 1 | lift_wpn->dir = dir; | |
| 11084 | 1 | lift_wpn->step = 0; | |
| 11085 | 1 | lift_wpn->fakefall = 0; | |
| 11086 | 1 | lift_wpn->fall = 0; | |
| 11087 | 1 | Lwpns.add(lift_wpn); | |
| 11088 | 1 | lift_wpn = nullptr; | |
| 11089 | 15688 | } | |
| 11090 | 14835456 | void HeroClass::do_liftglove(int32_t liftid, bool passive) | |
| 11091 | { | ||
| 11092 |
2/2✓ Branch 0 taken 14825050 times.
✓ Branch 1 taken 10406 times.
|
14835456 | if(!lift_wpn) |
| 11093 | 14825050 | last_lift_id.reset(); | |
| 11094 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14835456 times.
|
14835456 | if(liftid < 0) |
| 11095 | { | ||
| 11096 |
4/4✓ Branch 0 taken 9569 times.
✓ Branch 1 taken 14825887 times.
✓ Branch 2 taken 689 times.
✓ Branch 3 taken 8880 times.
|
14835456 | if(last_lift_id && can_lift(*last_lift_id)) |
| 11097 | 8880 | liftid = *last_lift_id; | |
| 11098 | 14826576 | else liftid = current_item_id(itype_liftglove,true,true); | |
| 11099 | 14835456 | } | |
| 11100 |
2/2✓ Branch 0 taken 362622 times.
✓ Branch 1 taken 14472834 times.
|
14835456 | if(!can_lift(liftid)) return; |
| 11101 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 362622 times.
|
362622 | if (on_cooldown(liftid)) return; |
| 11102 | 362622 | itemdata const& glove = itemsbuf[liftid]; | |
| 11103 | 362622 | byte intbtn = byte(glove.misc1&0xFF); | |
| 11104 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 362622 times.
|
362622 | if(passive) |
| 11105 | { | ||
| 11106 |
2/2✓ Branch 0 taken 2248 times.
✓ Branch 1 taken 360374 times.
|
362622 | if(!getIntBtnInput(intbtn, INPUT_PRESS | INPUT_DRUNK | INPUT_PEEK)) |
| 11107 | 360374 | return; //not pressed | |
| 11108 | 2248 | } | |
| 11109 | |||
| 11110 | 2248 | bool had_weapon = lift_wpn; | |
| 11111 | |||
| 11112 |
3/4✓ Branch 0 taken 2187 times.
✓ Branch 1 taken 61 times.
✓ Branch 2 taken 2187 times.
✗ Branch 3 not taken.
|
4435 | if(!(had_weapon || //Allow throwing while bunnied/don't charge magic for throwing |
| 11113 |
1/2✓ Branch 0 taken 2187 times.
✗ Branch 1 not taken.
|
2187 | (checkbunny(liftid) && checkmagiccost(liftid)))) |
| 11114 | { | ||
| 11115 | ✗ | item_error(); | |
| 11116 | ✗ | return; | |
| 11117 | } | ||
| 11118 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 2248 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
2248 | if(glove.script!=0 && (FFCore.doscript(ScriptType::Item, liftid) && get_qr(qr_ITEMSCRIPTSKEEPRUNNING))) |
| 11119 | ✗ | return; | |
| 11120 | |||
| 11121 | 2248 | bool paidmagic = had_weapon; //don't pay to throw, only to lift | |
| 11122 |
1/2✓ Branch 0 taken 2248 times.
✗ Branch 1 not taken.
|
2248 | if (run_item_action_script(liftid, paidmagic)) |
| 11123 | { | ||
| 11124 | ✗ | paidmagic = true; | |
| 11125 | ✗ | bool has_weapon = lift_wpn; | |
| 11126 | ✗ | if(has_weapon != had_weapon) //Item action script changed the lift information | |
| 11127 | { | ||
| 11128 | ✗ | if(passive) | |
| 11129 | ✗ | getIntBtnInput(intbtn, INPUT_PRESS | INPUT_DRUNK); //eat buttons | |
| 11130 | ✗ | return; | |
| 11131 | } | ||
| 11132 | ✗ | } | |
| 11133 | |||
| 11134 |
2/2✓ Branch 0 taken 61 times.
✓ Branch 1 taken 2187 times.
|
2248 | if(lift_wpn) |
| 11135 | { | ||
| 11136 |
1/2✓ Branch 0 taken 61 times.
✗ Branch 1 not taken.
|
61 | if(!paidmagic) |
| 11137 | { | ||
| 11138 | ✗ | paidmagic = true; | |
| 11139 | ✗ | paymagiccost(liftid); | |
| 11140 | ✗ | } | |
| 11141 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 61 times.
|
61 | if(!liftclk) |
| 11142 | { | ||
| 11143 | //Throw the weapon! | ||
| 11144 | //hero's direction and position | ||
| 11145 | 61 | handle_lift(false); //sets position properly, accounting for large weapons | |
| 11146 | |||
| 11147 | 61 | lift_wpn->dir = dir; | |
| 11148 |
1/2✓ Branch 0 taken 61 times.
✗ Branch 1 not taken.
|
61 | if(lift_wpn->angular) |
| 11149 | ✗ | lift_wpn->angle = WrapAngle(DirToRadians(dir)); | |
| 11150 | |||
| 11151 | 61 | lift_wpn->doAutoRotate(false, true); | |
| 11152 | //Configured throw speed in both axes | ||
| 11153 | 61 | auto basestep = glove.misc2; | |
| 11154 | 61 | lift_wpn->step = zfix(basestep)/100; | |
| 11155 | |||
| 11156 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 61 times.
|
61 | if(isSideViewGravity()) |
| 11157 | { | ||
| 11158 | ✗ | lift_wpn->fall = -glove.misc3; | |
| 11159 | ✗ | switch(dir) | |
| 11160 | { | ||
| 11161 | case left: case right: | ||
| 11162 | ✗ | break; //nothing special for sideways | |
| 11163 | case up: //step converts to upwards fall | ||
| 11164 | ✗ | lift_wpn->fall -= basestep; | |
| 11165 | ✗ | lift_wpn->step = 0; | |
| 11166 | ✗ | break; | |
| 11167 | case down: //step converts into straight down fall | ||
| 11168 | ✗ | lift_wpn->fall = zc_min(basestep,lift_wpn->get_terminalv_fall()); | |
| 11169 | ✗ | lift_wpn->step = 0; | |
| 11170 | ✗ | break; | |
| 11171 | } | ||
| 11172 | ✗ | lift_wpn->moveflags |= move_no_fake_z; | |
| 11173 | ✗ | } | |
| 11174 | else | ||
| 11175 | { | ||
| 11176 | 61 | auto lheight = liftheight+z+fakez; | |
| 11177 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 61 times.
|
61 | if(glove.flags & item_flag1) |
| 11178 | { | ||
| 11179 | ✗ | lift_wpn->z = 0; | |
| 11180 | ✗ | lift_wpn->fakez = lheight; | |
| 11181 | ✗ | lift_wpn->fakefall = -glove.misc3; | |
| 11182 | ✗ | lift_wpn->moveflags |= move_no_real_z; | |
| 11183 | ✗ | } | |
| 11184 | else | ||
| 11185 | { | ||
| 11186 | 61 | lift_wpn->z = lheight; | |
| 11187 | 61 | lift_wpn->fall = -glove.misc3; | |
| 11188 | 61 | lift_wpn->moveflags |= move_no_fake_z; | |
| 11189 | } | ||
| 11190 | } | ||
| 11191 | 61 | Lwpns.add(lift_wpn); | |
| 11192 | 61 | lift_wpn = nullptr; | |
| 11193 | 61 | last_lift_id.reset(); | |
| 11194 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 61 times.
|
61 | if(glove.usesound2) |
| 11195 | 61 | sfx(glove.usesound2,pan(x)); | |
| 11196 | 61 | } | |
| 11197 | ✗ | else last_lift_id = liftid; | |
| 11198 | |||
| 11199 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 61 times.
|
61 | if(passive) |
| 11200 | { | ||
| 11201 | 61 | getIntBtnInput(intbtn, INPUT_PRESS | INPUT_DRUNK); //eat buttons | |
| 11202 | 61 | } | |
| 11203 | 61 | start_cooldown(liftid); | |
| 11204 | 61 | return; | |
| 11205 | } | ||
| 11206 | |||
| 11207 | 2187 | bool lifted = false; | |
| 11208 | //Check for a liftable weapon | ||
| 11209 | //if(!lifted) | ||
| 11210 | { | ||
| 11211 | 2187 | zfix hx, hy, hw, hh; | |
| 11212 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 340 times.
✓ Branch 2 taken 580 times.
✓ Branch 3 taken 670 times.
✓ Branch 4 taken 597 times.
|
2187 | switch(dir) |
| 11213 | { | ||
| 11214 | case up: | ||
| 11215 | 340 | hx = x; | |
| 11216 | 340 | hy = y-8; | |
| 11217 | 340 | hw = 16; | |
| 11218 | 340 | hh = bigHitbox ? 8 : 16; | |
| 11219 | 340 | break; | |
| 11220 | case down: | ||
| 11221 | 580 | hx = x; | |
| 11222 | 580 | hy = y+16; | |
| 11223 | 580 | hw = 16; | |
| 11224 | 580 | hh = 8; | |
| 11225 | 580 | break; | |
| 11226 | case left: | ||
| 11227 | 670 | hx = x-8; | |
| 11228 | 670 | hy = y; | |
| 11229 | 670 | hw = 8; | |
| 11230 | 670 | hh = 16; | |
| 11231 | 670 | break; | |
| 11232 | case right: | ||
| 11233 | 597 | hx = x+16; | |
| 11234 | 597 | hy = y; | |
| 11235 | 597 | hw = 8; | |
| 11236 | 597 | hh = 16; | |
| 11237 | 597 | break; | |
| 11238 | } | ||
| 11239 |
2/2✓ Branch 0 taken 2185 times.
✓ Branch 1 taken 113 times.
|
2298 | for(int32_t q = 0; q < Lwpns.Count(); ++q) |
| 11240 | { | ||
| 11241 | 113 | weapon* w = (weapon*)Lwpns.spr(q); | |
| 11242 |
3/4✓ Branch 0 taken 7 times.
✓ Branch 1 taken 106 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 7 times.
|
113 | if((w->lift_level && w->lift_level <= glove.level)) |
| 11243 | { | ||
| 11244 | 7 | auto tmpflags = w->misc_wflags; | |
| 11245 | 7 | w->misc_wflags &= ~WFLAG_NO_COLL_WHEN_STILL; | |
| 11246 | 7 | bool hit = w->hit(hx,hy,0,hw,hh,1); | |
| 11247 | 7 | w->misc_wflags = tmpflags; | |
| 11248 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 2 times.
|
7 | if(!hit) |
| 11249 | 5 | continue; | |
| 11250 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if(glove.usesound) |
| 11251 | 2 | sfx(glove.usesound,pan(x)); | |
| 11252 | 2 | lift(w, w->lift_time, w->lift_height); | |
| 11253 | 2 | Lwpns.remove(w); | |
| 11254 | 2 | lifted = true; | |
| 11255 | 2 | break; | |
| 11256 | } | ||
| 11257 | 106 | } | |
| 11258 | } | ||
| 11259 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 2185 times.
|
2187 | if(!lifted) //Check for a liftable combo |
| 11260 | { | ||
| 11261 | 2185 | zfix bx, by; | |
| 11262 | 2185 | zfix bx2, by2; | |
| 11263 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 340 times.
✓ Branch 2 taken 580 times.
✓ Branch 3 taken 670 times.
✓ Branch 4 taken 595 times.
|
2185 | switch(dir) |
| 11264 | { | ||
| 11265 | case up: | ||
| 11266 | 340 | by = y + (bigHitbox ? -2 : 6); | |
| 11267 | 340 | by2 = by; | |
| 11268 | 340 | bx = x + 4; | |
| 11269 | 340 | bx2 = bx + 8; | |
| 11270 | 340 | break; | |
| 11271 | case down: | ||
| 11272 | 580 | by = y + 17; | |
| 11273 | 580 | by2 = by; | |
| 11274 | 580 | bx = x + 4; | |
| 11275 | 580 | bx2 = bx + 8; | |
| 11276 | 580 | break; | |
| 11277 | case left: | ||
| 11278 | 670 | by = y + (bigHitbox ? 0 : 8); | |
| 11279 | 670 | by2 = y + 8; | |
| 11280 | 670 | bx = x - 2; | |
| 11281 | 670 | bx2 = x - 2; | |
| 11282 | 670 | break; | |
| 11283 | case right: | ||
| 11284 | 595 | by = y + (bigHitbox ? 0 : 8); | |
| 11285 | 595 | by2 = y + 8; | |
| 11286 | 595 | bx = x + 17; | |
| 11287 | 595 | bx2 = x + 17; | |
| 11288 | 595 | break; | |
| 11289 | } | ||
| 11290 | 2185 | rpos_t rpos = COMBOPOS_REGION_B(bx, by); | |
| 11291 | 2185 | rpos_t rpos2 = COMBOPOS_REGION_B(bx2, by2); | |
| 11292 | |||
| 11293 |
2/2✓ Branch 0 taken 2142 times.
✓ Branch 1 taken 15271 times.
|
17413 | for(auto lyr = 6; lyr >= 0; --lyr) |
| 11294 | { | ||
| 11295 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 15271 times.
|
15271 | if(rpos != rpos_t::None) |
| 11296 | { | ||
| 11297 | 15271 | auto rpos_handle = get_rpos_handle(rpos, lyr); | |
| 11298 | 15271 | auto& cmb = rpos_handle.combo(); | |
| 11299 |
2/2✓ Branch 0 taken 15231 times.
✓ Branch 1 taken 40 times.
|
15271 | if(cmb.liftflags & LF_LIFTABLE) |
| 11300 | { | ||
| 11301 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 40 times.
|
40 | if(do_lift_combo(rpos_handle,liftid)) |
| 11302 | { | ||
| 11303 | 40 | lifted = true; | |
| 11304 | 40 | break; | |
| 11305 | } | ||
| 11306 | ✗ | } | |
| 11307 | 15231 | } | |
| 11308 |
3/4✓ Branch 0 taken 2139 times.
✓ Branch 1 taken 13092 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2139 times.
|
15231 | if(rpos != rpos2 && rpos2 != rpos_t::None) |
| 11309 | { | ||
| 11310 | 2139 | auto rpos_handle_2 = get_rpos_handle(rpos2, lyr); | |
| 11311 | 2139 | newcombo const& cmb2 = combobuf[rpos_handle_2.data()]; | |
| 11312 |
2/2✓ Branch 0 taken 2136 times.
✓ Branch 1 taken 3 times.
|
2139 | if(cmb2.liftflags & LF_LIFTABLE) |
| 11313 | { | ||
| 11314 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | if(do_lift_combo(rpos_handle_2,liftid)) |
| 11315 | { | ||
| 11316 | 3 | lifted = true; | |
| 11317 | 3 | break; | |
| 11318 | } | ||
| 11319 | ✗ | } | |
| 11320 | 2136 | } | |
| 11321 | 15228 | } | |
| 11322 | 2185 | } | |
| 11323 | |||
| 11324 |
2/2✓ Branch 0 taken 45 times.
✓ Branch 1 taken 2142 times.
|
2187 | if(!lifted) |
| 11325 | { | ||
| 11326 | 2142 | last_lift_id.reset(); | |
| 11327 | 2142 | return; | |
| 11328 | } | ||
| 11329 | 45 | last_lift_id = liftid; | |
| 11330 | |||
| 11331 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 45 times.
|
45 | if(!paidmagic) |
| 11332 | { | ||
| 11333 | 45 | paidmagic = true; | |
| 11334 | 45 | paymagiccost(liftid); | |
| 11335 | 45 | } | |
| 11336 | 45 | start_cooldown(liftid); | |
| 11337 | 45 | set_liftflags(liftid); | |
| 11338 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 45 times.
|
45 | if(passive) |
| 11339 | 45 | getIntBtnInput(intbtn, INPUT_PRESS | INPUT_DRUNK); //eat buttons | |
| 11340 | 45 | return; | |
| 11341 | 14835456 | } | |
| 11342 | 21661 | void HeroClass::handle_lift(bool dec) | |
| 11343 | { | ||
| 11344 |
1/2✓ Branch 0 taken 21661 times.
✗ Branch 1 not taken.
|
21661 | if(lift_wpn) |
| 11345 | { | ||
| 11346 | 21661 | lift_wpn->fakez = 0; | |
| 11347 | 21661 | lift_wpn->dir = dir; | |
| 11348 | 21661 | } | |
| 11349 | ✗ | else liftclk = 0; | |
| 11350 | |||
| 11351 |
2/2✓ Branch 0 taken 19896 times.
✓ Branch 1 taken 1765 times.
|
21661 | if(liftclk <= (dec?1:0)) |
| 11352 | { | ||
| 11353 | 19896 | liftclk = 0; | |
| 11354 | 19896 | tliftclk = 0; | |
| 11355 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 19896 times.
|
19896 | if(lift_wpn) |
| 11356 | { | ||
| 11357 |
2/4✓ Branch 0 taken 19896 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 19896 times.
|
19896 | if(lift_wpn->txsz > 1 || lift_wpn->tysz > 1) |
| 11358 | { | ||
| 11359 | ✗ | lift_wpn->x = x+8 - (lift_wpn->txsz*8); | |
| 11360 | ✗ | lift_wpn->y = y+8 - (lift_wpn->tysz*8); | |
| 11361 | ✗ | } | |
| 11362 | else | ||
| 11363 | { | ||
| 11364 | 19896 | lift_wpn->x = x; | |
| 11365 | 19896 | lift_wpn->y = y; | |
| 11366 | } | ||
| 11367 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 19896 times.
|
19896 | if(isSideViewGravity()) |
| 11368 | ✗ | lift_wpn->y -= liftheight; | |
| 11369 | 19896 | else lift_wpn->z = liftheight; | |
| 11370 | 19896 | } | |
| 11371 |
2/2✓ Branch 0 taken 19834 times.
✓ Branch 1 taken 62 times.
|
19896 | if(action == lifting) |
| 11372 | { | ||
| 11373 | 62 | action = none; FFCore.setHeroAction(none); | |
| 11374 | 62 | } | |
| 11375 | 19896 | return; | |
| 11376 | } | ||
| 11377 |
2/2✓ Branch 0 taken 891 times.
✓ Branch 1 taken 874 times.
|
1765 | if(dec) --liftclk; |
| 11378 | double xdist, ydist; | ||
| 11379 | 1765 | double perc = (liftclk/double(tliftclk)); | |
| 11380 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 318 times.
✓ Branch 2 taken 255 times.
✓ Branch 3 taken 514 times.
✓ Branch 4 taken 678 times.
|
1765 | switch(dir) |
| 11381 | { | ||
| 11382 | case up: | ||
| 11383 | { | ||
| 11384 | 318 | xdist = 0; | |
| 11385 | 318 | ydist = -16; | |
| 11386 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 318 times.
|
318 | if(lift_wpn->txsz > 1) |
| 11387 | { | ||
| 11388 | ✗ | xdist = -((lift_wpn->txsz*8)-8); | |
| 11389 | ✗ | } | |
| 11390 | 318 | else xdist = 0; | |
| 11391 |
1/2✓ Branch 0 taken 318 times.
✗ Branch 1 not taken.
|
318 | if(lift_wpn->tysz > 1) |
| 11392 | { | ||
| 11393 | ✗ | ydist = -(lift_wpn->tysz*16); | |
| 11394 | ✗ | } | |
| 11395 | 318 | ydist *= perc; | |
| 11396 | 318 | break; | |
| 11397 | } | ||
| 11398 | case down: | ||
| 11399 | { | ||
| 11400 | 255 | xdist = 0; | |
| 11401 | 255 | ydist = 16; | |
| 11402 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 255 times.
|
255 | if(lift_wpn->txsz > 1) |
| 11403 | { | ||
| 11404 | ✗ | xdist = -((lift_wpn->txsz*8)-8); | |
| 11405 | ✗ | } | |
| 11406 | 255 | else xdist = 0; | |
| 11407 | 255 | ydist *= perc; | |
| 11408 | 255 | break; | |
| 11409 | } | ||
| 11410 | case left: | ||
| 11411 | { | ||
| 11412 | 514 | xdist = -16; | |
| 11413 | 514 | ydist = 0; | |
| 11414 |
1/2✓ Branch 0 taken 514 times.
✗ Branch 1 not taken.
|
514 | if(lift_wpn->txsz > 1) |
| 11415 | { | ||
| 11416 | ✗ | xdist = -(lift_wpn->txsz*16); | |
| 11417 | ✗ | } | |
| 11418 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 514 times.
|
514 | if(lift_wpn->tysz > 1) |
| 11419 | { | ||
| 11420 | ✗ | ydist = -((lift_wpn->tysz*8)-8); | |
| 11421 | ✗ | } | |
| 11422 | 514 | else ydist = 0; | |
| 11423 | 514 | xdist *= perc; | |
| 11424 | 514 | break; | |
| 11425 | } | ||
| 11426 | case right: | ||
| 11427 | { | ||
| 11428 | 678 | xdist = 16; | |
| 11429 | 678 | ydist = 0; | |
| 11430 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 678 times.
|
678 | if(lift_wpn->tysz > 1) |
| 11431 | { | ||
| 11432 | ✗ | ydist = -((lift_wpn->tysz*8)-8); | |
| 11433 | ✗ | } | |
| 11434 | 678 | else ydist = 0; | |
| 11435 | 678 | xdist *= perc; | |
| 11436 | 678 | break; | |
| 11437 | } | ||
| 11438 | } | ||
| 11439 | |||
| 11440 | 1765 | lift_wpn->x = x + xdist; | |
| 11441 | 1765 | lift_wpn->y = y + ydist; | |
| 11442 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1765 times.
|
1765 | if(isSideViewGravity()) |
| 11443 | ✗ | lift_wpn->y -= liftheight*(1.0-perc); | |
| 11444 | 1765 | else lift_wpn->z = liftheight*(1.0-perc); | |
| 11445 | 21661 | } | |
| 11446 | 14845068 | bool HeroClass::can_lift(int32_t gloveid) | |
| 11447 | { | ||
| 11448 |
2/2✓ Branch 0 taken 14409554 times.
✓ Branch 1 taken 435514 times.
|
14845068 | if(unsigned(gloveid) >= MAXITEMS) return false; |
| 11449 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 435514 times.
|
435514 | if(lstunclock) return false; |
| 11450 |
1/2✓ Branch 0 taken 435514 times.
✗ Branch 1 not taken.
|
435514 | if(!checkitem_jinx(gloveid)) return false; |
| 11451 | 435514 | itemdata const& glove = itemsbuf[gloveid]; | |
| 11452 |
3/3✓ Branch 0 taken 371545 times.
✓ Branch 1 taken 57216 times.
✓ Branch 2 taken 6753 times.
|
435514 | switch(action) |
| 11453 | { | ||
| 11454 | case none: case walking: | ||
| 11455 | 371545 | break; | |
| 11456 | |||
| 11457 | case swimming: | ||
| 11458 |
1/2✓ Branch 0 taken 6753 times.
✗ Branch 1 not taken.
|
6753 | if(glove.flags & item_flag2) |
| 11459 | ✗ | break; | |
| 11460 | 6753 | return false; | |
| 11461 | |||
| 11462 | default: | ||
| 11463 | 57216 | return false; | |
| 11464 | } | ||
| 11465 | 371545 | return true; | |
| 11466 | 14845068 | } | |
| 11467 | 62 | void HeroClass::lift(weapon* w, byte timer, zfix height) | |
| 11468 | { | ||
| 11469 | 62 | lift_wpn = w; | |
| 11470 | 62 | liftclk = timer; | |
| 11471 | 62 | tliftclk = timer; | |
| 11472 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 62 times.
|
62 | if(height < 0) |
| 11473 | ✗ | liftheight = 0; | |
| 11474 | 62 | else liftheight = height; | |
| 11475 | 62 | } | |
| 11476 | |||
| 11477 | 340 | bool HeroClass::is_holding_item() const | |
| 11478 | { | ||
| 11479 |
2/2✓ Branch 0 taken 80 times.
✓ Branch 1 taken 260 times.
|
340 | switch (action) |
| 11480 | { | ||
| 11481 | case landhold1: | ||
| 11482 | case landhold2: | ||
| 11483 | case sidewaterhold1: | ||
| 11484 | case sidewaterhold2: | ||
| 11485 | case waterhold1: | ||
| 11486 | case waterhold2: | ||
| 11487 | 260 | return true; | |
| 11488 | } | ||
| 11489 | |||
| 11490 | 80 | return false; | |
| 11491 | 340 | } | |
| 11492 | |||
| 11493 | 15980 | void HeroClass::check_on_hit() // Called when the player is hit | |
| 11494 | { | ||
| 11495 |
3/4✓ Branch 0 taken 11 times.
✓ Branch 1 taken 15969 times.
✓ Branch 2 taken 11 times.
✗ Branch 3 not taken.
|
15980 | if(lift_wpn && (liftflags & LIFTFL_DROP_ON_HIT)) |
| 11496 | ✗ | drop_liftwpn(); | |
| 11497 | 15980 | } | |
| 11498 | |||
| 11499 | 137 | void HeroClass::doSwitchHook(byte style) | |
| 11500 | { | ||
| 11501 | 137 | hs_switcher = true; | |
| 11502 | 137 | pull_hero = true; | |
| 11503 | //{ Load hook weapons, set them to obey special drawing | ||
| 11504 | 137 | weapon *w = (weapon*)Lwpns.spr(Lwpns.idFirst(wHookshot)), | |
| 11505 | 137 | *hw = (weapon*)Lwpns.spr(Lwpns.idFirst(wHSHandle)); | |
| 11506 | |||
| 11507 |
2/2✓ Branch 0 taken 136 times.
✓ Branch 1 taken 1 times.
|
137 | if(w) |
| 11508 | 1 | w->switch_hooked = true; | |
| 11509 |
2/2✓ Branch 0 taken 136 times.
✓ Branch 1 taken 1 times.
|
137 | if(hw) |
| 11510 | 1 | hw->switch_hooked = true; | |
| 11511 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 137 times.
|
142 | for(int32_t j=0; j<chainlinks.Count(); j++) |
| 11512 | { | ||
| 11513 | 5 | chainlinks.spr(j)->switch_hooked = true; | |
| 11514 | 5 | } | |
| 11515 | //} | ||
| 11516 | 137 | rpos_t plrpos = COMBOPOS_REGION_B(x+8, y+8); | |
| 11517 |
3/4✓ Branch 0 taken 132 times.
✓ Branch 1 taken 5 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 132 times.
|
137 | if(hooked_comborpos != rpos_t::None && plrpos != rpos_t::None) |
| 11518 | { | ||
| 11519 |
1/2✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
|
132 | int32_t max_layer = get_qr(qr_HOOKSHOTALLLAYER) ? 6 : (get_qr(qr_HOOKSHOTLAYERFIX) ? 2 : 0); |
| 11520 | 132 | hooked_layerbits = 0; | |
| 11521 |
2/2✓ Branch 0 taken 924 times.
✓ Branch 1 taken 132 times.
|
1056 | for(auto q = 0; q < 7; ++q) |
| 11522 | 924 | hooked_undercombos[q] = -1; | |
| 11523 | |||
| 11524 | 132 | int target_pos = RPOS_TO_POS(hooked_comborpos); | |
| 11525 | 132 | int player_pos = RPOS_TO_POS(plrpos); | |
| 11526 | |||
| 11527 |
2/2✓ Branch 0 taken 924 times.
✓ Branch 1 taken 132 times.
|
1056 | for(auto q = max_layer; q > -1; --q) |
| 11528 | { | ||
| 11529 | 924 | auto target_pos_handle = get_rpos_handle(hooked_comborpos, q); | |
| 11530 | 924 | auto player_pos_handle = get_rpos_handle(plrpos, q); | |
| 11531 | |||
| 11532 | 924 | mapscr* player_scr = player_pos_handle.scr; | |
| 11533 | 924 | mapscr* target_scr = target_pos_handle.scr; | |
| 11534 | |||
| 11535 | 924 | newcombo const& cmb = combobuf[target_scr->data[target_pos]]; | |
| 11536 | 924 | newcombo const& comb2 = combobuf[player_scr->data[player_pos]]; | |
| 11537 | 924 | int32_t fl1 = target_scr->sflag[target_pos], | |
| 11538 | 924 | fl2 = player_scr->sflag[player_pos]; | |
| 11539 | 924 | bool isPush = false; | |
| 11540 |
2/2✓ Branch 0 taken 792 times.
✓ Branch 1 taken 132 times.
|
924 | if(isSwitchHookable(cmb)) |
| 11541 | { | ||
| 11542 |
1/2✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
|
132 | if(cmb.type == cSWITCHHOOK) |
| 11543 | { | ||
| 11544 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 132 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
132 | if((cmb.usrflags&cflag1) && player_scr->data[player_pos]) |
| 11545 | ✗ | continue; //don't swap with non-zero combo | |
| 11546 |
3/12✗ Branch 0 not taken.
✓ Branch 1 taken 132 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 132 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 132 times.
|
132 | if(zc_max(1,itemsbuf[(w && w->parentitem>-1) ? w->parentitem : current_item_id(itype_switchhook)].level) < cmb.attribytes[0]) |
| 11547 | ✗ | continue; //too low a switchhook level | |
| 11548 | 132 | hooked_layerbits |= 1<<q; //Swapping | |
| 11549 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 132 times.
|
132 | if(cmb.usrflags&cflag3) |
| 11550 | { | ||
| 11551 | ✗ | if(cmb.usrflags&cflag6) | |
| 11552 | { | ||
| 11553 | ✗ | hooked_undercombos[q] = target_scr->data[target_pos]+1; | |
| 11554 | ✗ | hooked_undercombos[q+7] = target_scr->cset[target_pos]; | |
| 11555 | ✗ | } | |
| 11556 | else | ||
| 11557 | { | ||
| 11558 | ✗ | hooked_undercombos[q] = target_scr->undercombo; | |
| 11559 | ✗ | hooked_undercombos[q+7] = target_scr->undercset; | |
| 11560 | } | ||
| 11561 | ✗ | } | |
| 11562 | else | ||
| 11563 | { | ||
| 11564 | 132 | hooked_layerbits |= 1<<(q+8); //Swapping BACK | |
| 11565 |
1/2✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
|
132 | if(cmb.usrflags&cflag7) //counts as 'pushblock' |
| 11566 | ✗ | isPush = true; | |
| 11567 | } | ||
| 11568 | 132 | } | |
| 11569 | ✗ | else if(isCuttableType(cmb.type)) | |
| 11570 | { | ||
| 11571 | ✗ | if(isCuttableNextType(cmb.type)) | |
| 11572 | { | ||
| 11573 | ✗ | hooked_undercombos[q] = target_scr->data[target_pos]+1; | |
| 11574 | ✗ | hooked_undercombos[q+7] = target_scr->cset[target_pos]; | |
| 11575 | ✗ | } | |
| 11576 | else | ||
| 11577 | { | ||
| 11578 | ✗ | hooked_undercombos[q] = target_scr->undercombo; | |
| 11579 | ✗ | hooked_undercombos[q+7] = target_scr->undercset; | |
| 11580 | } | ||
| 11581 | ✗ | hooked_layerbits |= 1<<q; //Swapping | |
| 11582 | ✗ | } | |
| 11583 | else | ||
| 11584 | { | ||
| 11585 | ✗ | hooked_layerbits |= 1<<q; //Swapping | |
| 11586 | ✗ | hooked_layerbits |= 1<<(q+8); //Swapping BACK | |
| 11587 | } | ||
| 11588 | 132 | } | |
| 11589 |
2/2✓ Branch 0 taken 792 times.
✓ Branch 1 taken 132 times.
|
924 | if(hooked_layerbits & (1<<(q+8))) //2-way swap, check for pushblocks |
| 11590 | { | ||
| 11591 |
3/6✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 132 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 132 times.
✗ Branch 5 not taken.
|
132 | if((cmb.type==cPUSH_WAIT || cmb.type==cPUSH_HW || cmb.type==cPUSH_HW2) |
| 11592 | 132 | && hasMainGuy(target_scr->screen)) | |
| 11593 | { | ||
| 11594 | ✗ | hooked_layerbits &= ~(0x101<<q); //Can't swap yet | |
| 11595 | ✗ | continue; | |
| 11596 | } | ||
| 11597 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 132 times.
|
132 | if(fl1 == mfPUSHED) |
| 11598 | { | ||
| 11599 | ✗ | hooked_layerbits &= ~(0x101<<q); //Can't swap at all, locked in place | |
| 11600 | ✗ | continue; | |
| 11601 | } | ||
| 11602 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 132 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 132 times.
|
132 | if(!isPush) switch(fl1) |
| 11603 | { | ||
| 11604 | case mfPUSHUD: case mfPUSHUDNS: case mfPUSHUDINS: | ||
| 11605 | case mfPUSHLR: case mfPUSHLRNS: case mfPUSHLRINS: | ||
| 11606 | case mfPUSHU: case mfPUSHUNS: case mfPUSHUINS: | ||
| 11607 | case mfPUSHD: case mfPUSHDNS: case mfPUSHDINS: | ||
| 11608 | case mfPUSHL: case mfPUSHLNS: case mfPUSHLINS: | ||
| 11609 | case mfPUSHR: case mfPUSHRNS: case mfPUSHRINS: | ||
| 11610 | case mfPUSH4: case mfPUSH4NS: case mfPUSH4INS: | ||
| 11611 | ✗ | isPush = true; | |
| 11612 | 132 | } | |
| 11613 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 132 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 132 times.
|
132 | if(!isPush) switch(cmb.flag) |
| 11614 | { | ||
| 11615 | case mfPUSHUD: case mfPUSHUDNS: case mfPUSHUDINS: | ||
| 11616 | case mfPUSHLR: case mfPUSHLRNS: case mfPUSHLRINS: | ||
| 11617 | case mfPUSHU: case mfPUSHUNS: case mfPUSHUINS: | ||
| 11618 | case mfPUSHD: case mfPUSHDNS: case mfPUSHDINS: | ||
| 11619 | case mfPUSHL: case mfPUSHLNS: case mfPUSHLINS: | ||
| 11620 | case mfPUSHR: case mfPUSHRNS: case mfPUSHRINS: | ||
| 11621 | case mfPUSH4: case mfPUSH4NS: case mfPUSH4INS: | ||
| 11622 | ✗ | isPush = true; | |
| 11623 | 132 | } | |
| 11624 |
1/2✓ Branch 0 taken 132 times.
✗ Branch 1 not taken.
|
132 | if(isPush) //Check for block holes / triggers |
| 11625 | { | ||
| 11626 | ✗ | if(comb2.flag == mfBLOCKHOLE || fl2 == mfBLOCKHOLE | |
| 11627 | ✗ | || comb2.flag == mfBLOCKTRIGGER || fl2 == mfBLOCKTRIGGER) | |
| 11628 | { | ||
| 11629 | ✗ | hooked_layerbits &= ~(1<<(q+8)); //Don't swap the hole/trigger back | |
| 11630 | ✗ | } | |
| 11631 | ✗ | else if(!get_qr(qr_BLOCKHOLE_SAME_ONLY)) | |
| 11632 | { | ||
| 11633 | ✗ | auto maxLayer = get_qr(qr_PUSHBLOCK_LAYER_1_2) ? 2 : 0; | |
| 11634 | ✗ | for(auto lyr = 0; lyr < maxLayer; ++lyr) | |
| 11635 | { | ||
| 11636 | ✗ | if(lyr == q) continue; | |
| 11637 | ✗ | switch(player_scr->sflag[player_pos]) | |
| 11638 | { | ||
| 11639 | case mfBLOCKHOLE: case mfBLOCKTRIGGER: | ||
| 11640 | ✗ | hooked_layerbits &= ~(1<<(q+8)); //Don't swap the hole/trigger back | |
| 11641 | ✗ | lyr=7; | |
| 11642 | ✗ | break; | |
| 11643 | } | ||
| 11644 | ✗ | switch(combobuf[player_scr->data[player_pos]].flag) | |
| 11645 | { | ||
| 11646 | case mfBLOCKHOLE: case mfBLOCKTRIGGER: | ||
| 11647 | ✗ | hooked_layerbits &= ~(1<<(q+8)); //Don't swap the hole/trigger back | |
| 11648 | ✗ | lyr=7; | |
| 11649 | ✗ | break; | |
| 11650 | } | ||
| 11651 | ✗ | } | |
| 11652 | ✗ | } | |
| 11653 | ✗ | } | |
| 11654 | 132 | } | |
| 11655 | 924 | } | |
| 11656 | 132 | } | |
| 11657 | 137 | switch_hooked = true; | |
| 11658 | 137 | switchhookstyle = style; | |
| 11659 |
2/4✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 136 times.
✗ Branch 3 not taken.
|
137 | switch(style) |
| 11660 | ✗ | { | |
| 11661 | default: case swPOOF: | ||
| 11662 | { | ||
| 11663 | 1 | wpndata const& spr = wpnsbuf[QMisc.sprites[sprSWITCHPOOF]]; | |
| 11664 |
2/4✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
1 | switchhookmaxtime = switchhookclk = zc_max(spr.frames,1) * zc_max(spr.speed,1); |
| 11665 |
3/6✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | decorations.add(new comboSprite(x, y, dCOMBOSPRITE, 0, QMisc.sprites[sprSWITCHPOOF])); |
| 11666 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | if(hooked_comborpos != rpos_t::None) |
| 11667 | { | ||
| 11668 | ✗ | auto [decx, decy] = COMBOXY_REGION(hooked_comborpos); | |
| 11669 | ✗ | decorations.add(new comboSprite(decx, decy, dCOMBOSPRITE, 0, QMisc.sprites[sprSWITCHPOOF])); | |
| 11670 | ✗ | } | |
| 11671 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | else if(switching_object) |
| 11672 |
3/6✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
|
1 | decorations.add(new comboSprite(switching_object->x, switching_object->y, dCOMBOSPRITE, 0, QMisc.sprites[sprSWITCHPOOF])); |
| 11673 | 1 | break; | |
| 11674 | } | ||
| 11675 | case swFLICKER: | ||
| 11676 | { | ||
| 11677 | 136 | switchhookmaxtime = switchhookclk = 64; | |
| 11678 | 136 | break; | |
| 11679 | } | ||
| 11680 | case swRISE: | ||
| 11681 | { | ||
| 11682 | ✗ | switchhookmaxtime = switchhookclk = 64; | |
| 11683 | ✗ | break; | |
| 11684 | } | ||
| 11685 | } | ||
| 11686 | 137 | } | |
| 11687 | |||
| 11688 | 47629 | bool HeroClass::startwpn(int32_t itemid) | |
| 11689 | { | ||
| 11690 |
1/2✓ Branch 0 taken 47629 times.
✗ Branch 1 not taken.
|
47629 | if(itemid < 0) return false; |
| 11691 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 47629 times.
|
47629 | if (on_cooldown(itemid)) return false; |
| 11692 | 47629 | itemdata const& itm = itemsbuf[itemid]; | |
| 11693 |
6/6✓ Branch 0 taken 11065 times.
✓ Branch 1 taken 36564 times.
✓ Branch 2 taken 8861 times.
✓ Branch 3 taken 27703 times.
✓ Branch 4 taken 1 times.
✓ Branch 5 taken 116 times.
|
47746 | if(((dir==up && y<24) || (dir==down && y>world_h-48) || |
| 11694 |
6/6✓ Branch 0 taken 13494 times.
✓ Branch 1 taken 14209 times.
✓ Branch 2 taken 14197 times.
✓ Branch 3 taken 12 times.
✓ Branch 4 taken 117 times.
✓ Branch 5 taken 47500 times.
|
47629 | (dir==left && x<32) || (dir==right && x>world_w-48)) && !(get_qr(qr_ITEMSONEDGES) || inlikelike)) |
| 11695 | 116 | return false; | |
| 11696 | |||
| 11697 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 47513 times.
|
47513 | bool liftonly = lift_wpn && (liftflags & LIFTFL_DIS_ITEMS); |
| 11698 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 47513 times.
|
47513 | if(liftonly) |
| 11699 | { | ||
| 11700 | ✗ | dowpn = -1; | |
| 11701 | ✗ | switch(itm.type) | |
| 11702 | { | ||
| 11703 | case itype_bomb: | ||
| 11704 | case itype_sbomb: | ||
| 11705 | ✗ | if(itm.flags & item_flag4) | |
| 11706 | ✗ | do_liftglove(-1,false); | |
| 11707 | ✗ | break; | |
| 11708 | case itype_liftglove: | ||
| 11709 | ✗ | do_liftglove(-1,false); | |
| 11710 | ✗ | break; | |
| 11711 | } | ||
| 11712 | ✗ | return false; | |
| 11713 | } | ||
| 11714 | |||
| 11715 | 47513 | int32_t wx=x; | |
| 11716 | 47513 | int32_t wy=y-fakez; | |
| 11717 | 47513 | int32_t wz=z; | |
| 11718 | 47513 | bool ret = true; | |
| 11719 | |||
| 11720 |
5/5✓ Branch 0 taken 12 times.
✓ Branch 1 taken 11046 times.
✓ Branch 2 taken 8829 times.
✓ Branch 3 taken 13463 times.
✓ Branch 4 taken 14163 times.
|
47513 | switch(dir) |
| 11721 | { | ||
| 11722 | case up: | ||
| 11723 | 11046 | wy-=16; | |
| 11724 | 11046 | break; | |
| 11725 | |||
| 11726 | case down: | ||
| 11727 | 8829 | wy+=16; | |
| 11728 | 8829 | break; | |
| 11729 | |||
| 11730 | case left: | ||
| 11731 | 13463 | wx-=16; | |
| 11732 | 13463 | break; | |
| 11733 | |||
| 11734 | case right: | ||
| 11735 | 14163 | wx+=16; | |
| 11736 | 14163 | break; | |
| 11737 | } | ||
| 11738 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 47513 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
47513 | if (IsSideSwim() && (itm.flags & item_sideswim_disabled)) return false; |
| 11739 | |||
| 11740 |
17/28✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 639 times.
✓ Branch 3 taken 1174 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1464 times.
✓ Branch 6 taken 2490 times.
✓ Branch 7 taken 35 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 385 times.
✓ Branch 12 taken 376 times.
✓ Branch 13 taken 1837 times.
✓ Branch 14 taken 20038 times.
✓ Branch 15 taken 2335 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 2602 times.
✓ Branch 18 taken 20 times.
✓ Branch 19 taken 14090 times.
✓ Branch 20 taken 12 times.
✓ Branch 21 taken 8 times.
✗ Branch 22 not taken.
✓ Branch 23 taken 4 times.
✗ Branch 24 not taken.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✗ Branch 27 not taken.
|
47513 | switch(itm.type) |
| 11741 | { | ||
| 11742 | case itype_liftglove: | ||
| 11743 | { | ||
| 11744 | ✗ | do_liftglove(itemid,false); | |
| 11745 | ✗ | dowpn = -1; | |
| 11746 | ✗ | ret = false; | |
| 11747 | ✗ | break; | |
| 11748 | } | ||
| 11749 | case itype_potion: | ||
| 11750 | { | ||
| 11751 |
2/4✓ Branch 0 taken 35 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 35 times.
|
35 | if(!(checkbunny(itemid) && checkmagiccost(itemid))) |
| 11752 | { | ||
| 11753 | ✗ | return item_error(); | |
| 11754 | } | ||
| 11755 | |||
| 11756 | 35 | paymagiccost(itemid); | |
| 11757 | 35 | start_cooldown(itemid); | |
| 11758 | |||
| 11759 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 35 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
35 | if(itm.misc1 || itm.misc2) |
| 11760 | { | ||
| 11761 | 35 | refill_what=REFILL_ALL; | |
| 11762 | 35 | refill_why=itemid; | |
| 11763 | 35 | StartRefill(REFILL_ALL); | |
| 11764 | 35 | potion_life = game->get_life(); | |
| 11765 | 35 | potion_magic = game->get_magic(); | |
| 11766 | |||
| 11767 | //add a quest rule or an item option that lets you specify whether or not to pause music during refilling | ||
| 11768 | //music_pause(); | ||
| 11769 | 35 | stop_sfx(QMisc.miscsfx[sfxLOWHEART]); //stop heart beep! | |
| 11770 |
2/2✓ Branch 0 taken 6288 times.
✓ Branch 1 taken 35 times.
|
6323 | while(refill()) |
| 11771 | { | ||
| 11772 | 6288 | do_refill_waitframe(); | |
| 11773 | } | ||
| 11774 | |||
| 11775 | //add a quest rule or an item option that lets you specify whether or not to pause music during refilling | ||
| 11776 | //music_resume(); | ||
| 11777 | 35 | ret = false; | |
| 11778 | 35 | } | |
| 11779 | |||
| 11780 | 35 | break; | |
| 11781 | } | ||
| 11782 | case itype_bottle: | ||
| 11783 | { | ||
| 11784 | ✗ | if(!(checkbunny(itemid) && checkmagiccost(itemid))) | |
| 11785 | { | ||
| 11786 | ✗ | return item_error(); | |
| 11787 | } | ||
| 11788 | ✗ | if(itm.script!=0 && (FFCore.doscript(ScriptType::Item, itemid) && get_qr(qr_ITEMSCRIPTSKEEPRUNNING))) | |
| 11789 | ✗ | return false; | |
| 11790 | |||
| 11791 | ✗ | size_t bind = game->get_bottle_slot(itm.misc1); | |
| 11792 | ✗ | bool paidmagic = false; | |
| 11793 | ✗ | if(itm.script) | |
| 11794 | { | ||
| 11795 | ✗ | paidmagic = true; | |
| 11796 | ✗ | paymagiccost(itemid); | |
| 11797 | ✗ | start_cooldown(itemid); | |
| 11798 | |||
| 11799 | ✗ | int i = itemid; | |
| 11800 | ✗ | FFCore.reset_script_engine_data(ScriptType::Item, i); | |
| 11801 | ✗ | ZScriptVersion::RunScript(ScriptType::Item, itm.script, i); | |
| 11802 | ✗ | bind = game->get_bottle_slot(itm.misc1); | |
| 11803 | ✗ | } | |
| 11804 | ✗ | bottletype const* bt = bind ? &(QMisc.bottle_types[bind-1]) : NULL; | |
| 11805 | ✗ | if(bt) | |
| 11806 | { | ||
| 11807 | ✗ | word toFill[3] = { 0 }; | |
| 11808 | ✗ | for(size_t q = 0; q < 3; ++q) | |
| 11809 | { | ||
| 11810 | ✗ | char c = bt->counter[q]; | |
| 11811 | ✗ | if(c > -1) | |
| 11812 | { | ||
| 11813 | ✗ | if(bt->flags & (1<<q)) | |
| 11814 | { | ||
| 11815 | ✗ | toFill[q] = (bt->amount[q]==100) | |
| 11816 | ✗ | ? game->get_maxcounter(c) | |
| 11817 | ✗ | : word((game->get_maxcounter(c)/100.0)*bt->amount[q]); | |
| 11818 | ✗ | } | |
| 11819 | ✗ | else toFill[q] = bt->amount[q]; | |
| 11820 | ✗ | if(toFill[q] + game->get_counter(c) > game->get_maxcounter(c)) | |
| 11821 | { | ||
| 11822 | ✗ | toFill[q] = game->get_maxcounter(c) - game->get_counter(c); | |
| 11823 | ✗ | } | |
| 11824 | ✗ | } | |
| 11825 | ✗ | } | |
| 11826 | ✗ | word max = std::max(toFill[0], std::max(toFill[1], toFill[2])); | |
| 11827 | ✗ | bool run = max > 0; | |
| 11828 | ✗ | bool check_jinxes = true; | |
| 11829 | ✗ | if(get_qr(qr_NO_BOTTLE_IF_ANY_COUNTER_FULL)) | |
| 11830 | { | ||
| 11831 | ✗ | for(int q = 0; q < 3; ++q) | |
| 11832 | { | ||
| 11833 | ✗ | if(bt->counter[q] > -1) | |
| 11834 | { | ||
| 11835 | ✗ | check_jinxes = false; | |
| 11836 | ✗ | if(!toFill[q]) | |
| 11837 | { | ||
| 11838 | ✗ | run = false; | |
| 11839 | ✗ | break; | |
| 11840 | } | ||
| 11841 | ✗ | } | |
| 11842 | ✗ | } | |
| 11843 | ✗ | } | |
| 11844 | ✗ | if(check_jinxes) | |
| 11845 | { | ||
| 11846 | ✗ | if((bt->flags & BTFLAG_CURESWJINX) && swordclk) | |
| 11847 | ✗ | run = true; | |
| 11848 | ✗ | else if((bt->flags & BTFLAG_CUREITJINX) && itemclk) | |
| 11849 | ✗ | run = true; | |
| 11850 | ✗ | else if((bt->flags & BTFLAG_CURESHJINX) && shieldjinxclk) | |
| 11851 | ✗ | run = true; | |
| 11852 | ✗ | } | |
| 11853 | ✗ | if(run || (bt->flags&BTFLAG_ALLOWIFFULL)) | |
| 11854 | { | ||
| 11855 | ✗ | if(bt->flags & BTFLAG_CURESWJINX) | |
| 11856 | { | ||
| 11857 | ✗ | swordclk = 0; | |
| 11858 | ✗ | verifyAWpn(); | |
| 11859 | ✗ | } | |
| 11860 | ✗ | if(bt->flags & BTFLAG_CUREITJINX) | |
| 11861 | ✗ | itemclk = 0; | |
| 11862 | ✗ | if(bt->flags & BTFLAG_CURESHJINX) | |
| 11863 | ✗ | shieldjinxclk = 0; | |
| 11864 | ✗ | if(!paidmagic) | |
| 11865 | { | ||
| 11866 | ✗ | paymagiccost(itemid); | |
| 11867 | ✗ | start_cooldown(itemid); | |
| 11868 | ✗ | } | |
| 11869 | ✗ | stop_sfx(QMisc.miscsfx[sfxLOWHEART]); //stop heart beep! | |
| 11870 | ✗ | sfx(itm.usesound,pan(x)); | |
| 11871 | ✗ | for(size_t q = 0; q < 20; ++q) | |
| 11872 | ✗ | do_refill_waitframe(); | |
| 11873 | ✗ | double inc = max/60.0; //1 second | |
| 11874 | ✗ | double xtra[3]{ 0 }; | |
| 11875 | ✗ | for(size_t q = 0; q < 60; ++q) | |
| 11876 | { | ||
| 11877 | ✗ | if(!(q%6) && (toFill[0]||toFill[1]||toFill[2])) | |
| 11878 | ✗ | sfx(QMisc.miscsfx[sfxREFILL]); | |
| 11879 | ✗ | for(size_t j = 0; j < 3; ++j) | |
| 11880 | { | ||
| 11881 | ✗ | xtra[j] += inc; | |
| 11882 | ✗ | word f = floor(xtra[j]); | |
| 11883 | ✗ | xtra[j] -= f; | |
| 11884 | ✗ | if(toFill[j] > f) | |
| 11885 | { | ||
| 11886 | ✗ | toFill[j] -= f; | |
| 11887 | ✗ | game->change_counter(f,bt->counter[j]); | |
| 11888 | ✗ | } | |
| 11889 | ✗ | else if(toFill[j]) | |
| 11890 | { | ||
| 11891 | ✗ | game->change_counter(toFill[j],bt->counter[j]); | |
| 11892 | ✗ | toFill[j] = 0; | |
| 11893 | ✗ | } | |
| 11894 | ✗ | } | |
| 11895 | ✗ | do_refill_waitframe(); | |
| 11896 | ✗ | } | |
| 11897 | ✗ | for(size_t j = 0; j < 3; ++j) | |
| 11898 | { | ||
| 11899 | ✗ | if(toFill[j]) | |
| 11900 | { | ||
| 11901 | ✗ | game->change_counter(toFill[j],bt->counter[j]); | |
| 11902 | ✗ | toFill[j] = 0; | |
| 11903 | ✗ | } | |
| 11904 | ✗ | } | |
| 11905 | ✗ | for(size_t q = 0; q < 20; ++q) | |
| 11906 | ✗ | do_refill_waitframe(); | |
| 11907 | ✗ | game->set_bottle_slot(itm.misc1, bt->next_type); | |
| 11908 | ✗ | } | |
| 11909 | ✗ | } | |
| 11910 | |||
| 11911 | ✗ | dowpn = -1; | |
| 11912 | ✗ | ret = false; | |
| 11913 | ✗ | break; | |
| 11914 | } | ||
| 11915 | |||
| 11916 | case itype_note: | ||
| 11917 | { | ||
| 11918 | ✗ | if(!(checkbunny(itemid) && checkmagiccost(itemid))) | |
| 11919 | { | ||
| 11920 | ✗ | return item_error(); | |
| 11921 | } | ||
| 11922 | ✗ | if(!msg_active) | |
| 11923 | { | ||
| 11924 | ✗ | if(play_combo_string(itm.misc1, current_screen)) | |
| 11925 | { | ||
| 11926 | ✗ | sfx(itm.usesound); | |
| 11927 | ✗ | paymagiccost(itemid); | |
| 11928 | ✗ | start_cooldown(itemid); | |
| 11929 | ✗ | } | |
| 11930 | ✗ | } | |
| 11931 | ✗ | dowpn = -1; | |
| 11932 | ✗ | ret = false; | |
| 11933 | ✗ | break; | |
| 11934 | } | ||
| 11935 | |||
| 11936 | case itype_mirror: | ||
| 11937 | ✗ | doMirror(itemid); | |
| 11938 | ✗ | if(Quit) | |
| 11939 | ✗ | return false; | |
| 11940 | ✗ | ret = false; | |
| 11941 | ✗ | break; | |
| 11942 | |||
| 11943 | case itype_rocs: | ||
| 11944 | { | ||
| 11945 |
2/2✓ Branch 0 taken 368 times.
✓ Branch 1 taken 17 times.
|
385 | if(!do_jump(itemid,false)) return false; |
| 11946 | 368 | ret = false; | |
| 11947 | } | ||
| 11948 | 368 | break; | |
| 11949 | |||
| 11950 | case itype_letter: | ||
| 11951 | { | ||
| 11952 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
8 | if(current_item(itype_letter)==i_letter && |
| 11953 |
2/4✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
|
4 | (cur_screen >= 128 ? special_warp_return_scr : hero_scr)->room==rP_SHOP && |
| 11954 |
2/4✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
|
4 | (cur_screen >= 128 ? special_warp_return_scr : hero_scr)->guy && |
| 11955 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | ((cur_screen<128&&!(DMaps[cur_dmap].flags&dmfGUYCAVES)) |
| 11956 |
1/4✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
|
4 | ||(cur_screen>=128&&DMaps[cur_dmap].flags&dmfGUYCAVES)) && |
| 11957 | 4 | checkbunny(itemid) | |
| 11958 | ) | ||
| 11959 | { | ||
| 11960 | 4 | int32_t usedid = getItemID(itemsbuf, itype_letter,i_letter+1); | |
| 11961 | |||
| 11962 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | if(usedid != -1) |
| 11963 | 4 | getitem(usedid, true, true); | |
| 11964 | |||
| 11965 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | sfx((cur_screen >= 128 ? special_warp_return_scr : hero_scr)->secretsfx); |
| 11966 | 4 | setupscreen(); | |
| 11967 | 4 | action=none; FFCore.setHeroAction(none); | |
| 11968 | 4 | start_cooldown(itemid); | |
| 11969 | 4 | } | |
| 11970 | |||
| 11971 | 4 | ret = false; | |
| 11972 | } | ||
| 11973 | 4 | break; | |
| 11974 | |||
| 11975 | case itype_whistle: | ||
| 11976 | { | ||
| 11977 | bool whistleflag; | ||
| 11978 | |||
| 11979 |
4/4✓ Branch 0 taken 364 times.
✓ Branch 1 taken 12 times.
✓ Branch 2 taken 12 times.
✓ Branch 3 taken 376 times.
|
376 | if(!(checkbunny(itemid) && checkmagiccost(itemid))) |
| 11980 | { | ||
| 11981 | 24 | return item_error(); | |
| 11982 | } | ||
| 11983 | |||
| 11984 | 376 | paymagiccost(itemid); | |
| 11985 | 376 | start_cooldown(itemid); | |
| 11986 | 376 | sfx(itm.usesound); | |
| 11987 | |||
| 11988 |
4/4✓ Branch 0 taken 288 times.
✓ Branch 1 taken 88 times.
✓ Branch 2 taken 143 times.
✓ Branch 3 taken 145 times.
|
376 | if(dir==up || dir==right) |
| 11989 | 231 | ++blowcnt; | |
| 11990 | else | ||
| 11991 | 145 | --blowcnt; | |
| 11992 | |||
| 11993 | 376 | uint32_t frames_to_wait = 0; | |
| 11994 |
2/2✓ Branch 0 taken 12 times.
✓ Branch 1 taken 364 times.
|
376 | if (replay_is_active()) |
| 11995 | { | ||
| 11996 | // How long an sfx takes to play (`sfx_allocated`) is not deterministic, | ||
| 11997 | // use a fixed number of frames in replay mode. | ||
| 11998 | // This has changed over time. | ||
| 11999 |
2/2✓ Branch 0 taken 217 times.
✓ Branch 1 taken 147 times.
|
364 | if (replay_version_check(0, 26)) |
| 12000 | { | ||
| 12001 | 217 | frames_to_wait = 180; | |
| 12002 | 217 | } | |
| 12003 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 65 times.
|
147 | else if (replay_version_check(27, 31)) |
| 12004 | { | ||
| 12005 | 82 | frames_to_wait = 0; | |
| 12006 | 82 | } | |
| 12007 | else | ||
| 12008 | { | ||
| 12009 | 65 | SAMPLE* sample = sfx_get_sample(itm.usesound); | |
| 12010 |
2/4✓ Branch 0 taken 65 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 65 times.
|
65 | if (sample && sample->freq) |
| 12011 | 65 | frames_to_wait = 60 * sample->len / sample->freq; | |
| 12012 | } | ||
| 12013 | 364 | } | |
| 12014 | |||
| 12015 | 376 | int sfx_count = 0; | |
| 12016 |
6/8✗ Branch 0 not taken.
✓ Branch 1 taken 50805 times.
✓ Branch 2 taken 12 times.
✓ Branch 3 taken 12 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 50817 times.
✓ Branch 6 taken 50453 times.
✓ Branch 7 taken 376 times.
|
50829 | while ((!replay_is_active() && sfx_allocated(itm.usesound)) || (replay_is_active() && sfx_count < frames_to_wait)) |
| 12017 | { | ||
| 12018 | 50453 | sfx_count += 1; | |
| 12019 | 50453 | advanceframe(true); | |
| 12020 | |||
| 12021 |
1/2✓ Branch 0 taken 50453 times.
✗ Branch 1 not taken.
|
50453 | if(Quit) |
| 12022 | ✗ | return false; | |
| 12023 | } | ||
| 12024 | |||
| 12025 |
9/14✓ Branch 0 taken 364 times.
✓ Branch 1 taken 12 times.
✓ Branch 2 taken 364 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 364 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 364 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 364 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 364 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 376 times.
✓ Branch 13 taken 12 times.
|
376 | Lwpns.add(new weapon(x,y-fakez,z,wWhistle,0,0,dir,itemid,getUID(),false,0,1,0)); |
| 12026 | |||
| 12027 |
2/2✓ Branch 0 taken 270 times.
✓ Branch 1 taken 106 times.
|
376 | if((whistleflag=trigger_secrets_if_flag(x,y,mfWHISTLE,get_qr(qr_PERMANENT_WHISTLE_SECRETS)))) |
| 12028 | 106 | didstuff |= did_whistle; | |
| 12029 | |||
| 12030 |
4/4✓ Branch 0 taken 110 times.
✓ Branch 1 taken 266 times.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 262 times.
|
376 | if((didstuff&did_whistle && itm.flags&item_flag1) || cur_screen>=128) |
| 12031 | 114 | return false; | |
| 12032 | |||
| 12033 |
2/2✓ Branch 0 taken 23 times.
✓ Branch 1 taken 239 times.
|
262 | if(itm.flags&item_flag1) didstuff |= did_whistle; |
| 12034 | |||
| 12035 |
4/4✓ Branch 0 taken 225 times.
✓ Branch 1 taken 25 times.
✓ Branch 2 taken 10 times.
✓ Branch 3 taken 235 times.
|
262 | if((hero_scr->flags&fWHISTLE) || (hero_scr->flags7 & fWHISTLEWATER) |
| 12036 |
1/2✓ Branch 0 taken 225 times.
✗ Branch 1 not taken.
|
225 | || (hero_scr->flags7&fWHISTLEPAL)) |
| 12037 | { | ||
| 12038 | 35 | whistleclk=0; // signal to start drying lake or doing other stuff | |
| 12039 | 35 | } | |
| 12040 | else | ||
| 12041 | { | ||
| 12042 | 235 | int32_t where = itm.misc1; | |
| 12043 | |||
| 12044 |
2/2✓ Branch 0 taken 221 times.
✓ Branch 1 taken 14 times.
|
235 | if(where>right) where=dir^1; |
| 12045 | |||
| 12046 |
5/6✓ Branch 0 taken 157 times.
✓ Branch 1 taken 78 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 73 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 152 times.
|
387 | if(((DMaps[cur_dmap].flags&dmfWHIRLWIND && TriforceCount()) || DMaps[cur_dmap].flags&dmfWHIRLWINDRET) && |
| 12047 |
1/2✓ Branch 0 taken 152 times.
✗ Branch 1 not taken.
|
162 | itm.misc2 >= 0 && itm.misc2 <= 8 && !whistleflag) |
| 12048 | { | ||
| 12049 |
4/4✓ Branch 0 taken 2 times.
✓ Branch 1 taken 150 times.
✓ Branch 2 taken 140 times.
✓ Branch 3 taken 10 times.
|
152 | zfix windx = where == left ? (zfix)(viewport.right()-16) : where == right ? (zfix)viewport.left() : x; |
| 12050 |
4/4✓ Branch 0 taken 4 times.
✓ Branch 1 taken 148 times.
✓ Branch 2 taken 142 times.
✓ Branch 3 taken 6 times.
|
152 | zfix windy = where == down ? (zfix)viewport.top() : where == up ? zfix(viewport.bottom()-16) : y; |
| 12051 |
1/2✓ Branch 0 taken 152 times.
✗ Branch 1 not taken.
|
304 | Lwpns.add(new weapon( |
| 12052 |
1/2✓ Branch 0 taken 152 times.
✗ Branch 1 not taken.
|
152 | windx, |
| 12053 |
1/2✓ Branch 0 taken 152 times.
✗ Branch 1 not taken.
|
152 | windy, |
| 12054 |
1/2✓ Branch 0 taken 152 times.
✗ Branch 1 not taken.
|
152 | (zfix)0, |
| 12055 | wWind, | ||
| 12056 | 0, //type | ||
| 12057 | 0, | ||
| 12058 | 152 | where, | |
| 12059 |
1/2✓ Branch 0 taken 152 times.
✗ Branch 1 not taken.
|
152 | itemid,getUID(),false,false,true,0)); //last arg is byte special, used to override type for wWind for now. -Z 18JULY2020 |
| 12060 | 152 | } | |
| 12061 | |||
| 12062 | 225 | whistleitem=itemid; | |
| 12063 | } | ||
| 12064 | |||
| 12065 | 258 | ret = false; | |
| 12066 | } | ||
| 12067 | 258 | break; | |
| 12068 | |||
| 12069 | case itype_bomb: case itype_sbomb: | ||
| 12070 | { | ||
| 12071 | 1464 | bool sbomb = (itm.type == itype_sbomb); | |
| 12072 | 1464 | auto lit_ty = sbomb ? wLitSBomb : wLitBomb; | |
| 12073 | 1464 | auto boom_ty = sbomb ? wSBomb : wBomb; | |
| 12074 | //Remote detonation | ||
| 12075 |
3/4✓ Branch 0 taken 1464 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 1460 times.
|
1464 | if(Lwpns.idCount(lit_ty) >= zc_max(itm.misc2,1)) |
| 12076 | { | ||
| 12077 | 4 | weapon *ew = (weapon*)(Lwpns.spr(Lwpns.idFirst(lit_ty))); | |
| 12078 | |||
| 12079 |
2/4✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
|
4 | while(Lwpns.idCount(lit_ty) && ew->misc == 0) |
| 12080 | { | ||
| 12081 | //If this ever needs a version check, in the future. -z | ||
| 12082 | ✗ | if (boom_ty == wBomb && (FFCore.getQuestHeaderInfo(vZelda) > 0x250 || ( FFCore.getQuestHeaderInfo(vZelda) == 0x250 && FFCore.getQuestHeaderInfo(vBuild) > 31))) | |
| 12083 | { | ||
| 12084 | ✗ | if ( ew->power > 1 ) //Don't reduce 1 to 0. -Z | |
| 12085 | ✗ | ew->power *= 0.5; //Remote bombs were dealing double damage. -Z | |
| 12086 | ✗ | } | |
| 12087 | ✗ | ew->misc=50; | |
| 12088 | ✗ | ew->clk=ew->misc-3; | |
| 12089 | ✗ | ew->id=boom_ty; | |
| 12090 | ✗ | ew = (weapon*)(Lwpns.spr(Lwpns.idFirst(lit_ty))); | |
| 12091 | } | ||
| 12092 | |||
| 12093 | 4 | deselectbombs(sbomb); | |
| 12094 | 4 | return false; | |
| 12095 | } | ||
| 12096 | |||
| 12097 |
3/4✓ Branch 0 taken 17 times.
✓ Branch 1 taken 1443 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 17 times.
|
1460 | if((itm.flags & item_flag4) && lift_wpn) |
| 12098 | { | ||
| 12099 | ✗ | do_liftglove(-1,false); //Throw the already-held weapon | |
| 12100 | ✗ | start_cooldown(itemid); | |
| 12101 | ✗ | return false; | |
| 12102 | } | ||
| 12103 |
2/4✓ Branch 0 taken 1460 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1460 times.
|
1460 | if(!(checkbunny(itemid) && checkmagiccost(itemid))) |
| 12104 | { | ||
| 12105 | ✗ | return item_error(); | |
| 12106 | } | ||
| 12107 | |||
| 12108 | 1460 | paymagiccost(itemid); | |
| 12109 | 1460 | start_cooldown(itemid); | |
| 12110 | |||
| 12111 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1460 times.
|
1460 | if(itm.misc1>0) // If not remote bombs |
| 12112 | 1460 | deselectbombs(sbomb); | |
| 12113 | |||
| 12114 |
2/2✓ Branch 0 taken 492 times.
✓ Branch 1 taken 968 times.
|
1460 | if(isdungeon()) |
| 12115 | { | ||
| 12116 |
2/2✓ Branch 0 taken 36 times.
✓ Branch 1 taken 932 times.
|
968 | wy=zc_max(wy,16); |
| 12117 | 968 | } | |
| 12118 | |||
| 12119 |
4/8✓ Branch 0 taken 1460 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1460 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1460 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1460 times.
✗ Branch 7 not taken.
|
2920 | weapon* wpn = new weapon((zfix)wx,(zfix)wy,(zfix)wz,lit_ty,itm.level, |
| 12120 |
2/4✓ Branch 0 taken 1460 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1460 times.
✗ Branch 3 not taken.
|
1460 | itm.power*game->get_hero_dmgmult(),dir,itemid,getUID(),false,false,true); |
| 12121 | 1460 | bool lifted = false; | |
| 12122 |
2/2✓ Branch 0 taken 1443 times.
✓ Branch 1 taken 17 times.
|
1460 | if(itm.flags & item_flag4) |
| 12123 | { | ||
| 12124 | 17 | auto liftid = current_item_id(itype_liftglove); | |
| 12125 |
2/4✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 17 times.
|
17 | if(liftid > -1 && (itm.weap_data.lift_level <= itemsbuf[liftid].level)) |
| 12126 | { | ||
| 12127 | 17 | lift(wpn, itm.weap_data.lift_time, itm.weap_data.lift_height); | |
| 12128 | 17 | set_liftflags(liftid); | |
| 12129 | 17 | lifted = true; | |
| 12130 | 17 | } | |
| 12131 | 17 | } | |
| 12132 |
2/2✓ Branch 0 taken 17 times.
✓ Branch 1 taken 1443 times.
|
1460 | if(!lifted) |
| 12133 | { | ||
| 12134 | 1443 | Lwpns.add(wpn); | |
| 12135 | 1443 | sfx(WAV_PLACE,pan(wx)); | |
| 12136 | 1443 | } | |
| 12137 | } | ||
| 12138 | 1460 | break; | |
| 12139 | |||
| 12140 | case itype_wand: | ||
| 12141 | { | ||
| 12142 |
2/2✓ Branch 0 taken 440 times.
✓ Branch 1 taken 1397 times.
|
1837 | if(Lwpns.idCount(wMagic)) |
| 12143 | { | ||
| 12144 | 440 | misc_internal_hero_flags &= ~LF_PAID_WAND_COST; | |
| 12145 | 440 | return false; | |
| 12146 | } | ||
| 12147 | |||
| 12148 | 1397 | int32_t bookid = current_item_id(itype_book); | |
| 12149 |
3/4✓ Branch 0 taken 716 times.
✓ Branch 1 taken 681 times.
✓ Branch 2 taken 716 times.
✗ Branch 3 not taken.
|
1397 | if (bookid > -1 && on_cooldown(bookid)) |
| 12150 | ✗ | bookid = -1; | |
| 12151 |
3/4✓ Branch 0 taken 716 times.
✓ Branch 1 taken 681 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 716 times.
|
1397 | bool paybook = (bookid>-1 && checkbunny(bookid) && checkmagiccost(bookid)); |
| 12152 | |||
| 12153 |
4/4✓ Branch 0 taken 173 times.
✓ Branch 1 taken 1224 times.
✓ Branch 2 taken 34 times.
✓ Branch 3 taken 139 times.
|
1397 | if(!(itm.flags&item_flag1) && !paybook) //Can the wand shoot without the book? |
| 12154 | { | ||
| 12155 | 139 | misc_internal_hero_flags &= ~LF_PAID_WAND_COST; | |
| 12156 | 139 | return false; | |
| 12157 | } | ||
| 12158 | |||
| 12159 |
4/6✓ Branch 0 taken 1258 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1258 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1255 times.
✓ Branch 5 taken 3 times.
|
1258 | if(!checkbunny(itemid) || !(misc_internal_hero_flags & LF_PAID_WAND_COST || checkmagiccost(itemid))) |
| 12160 | { | ||
| 12161 | 3 | return item_error(); | |
| 12162 | } | ||
| 12163 | |||
| 12164 |
2/2✓ Branch 0 taken 1251 times.
✓ Branch 1 taken 4 times.
|
1255 | if(Lwpns.idCount(wBeam)) |
| 12165 | 4 | Lwpns.del(Lwpns.idFirst(wBeam)); | |
| 12166 | |||
| 12167 | int32_t type, pow; | ||
| 12168 |
2/2✓ Branch 0 taken 533 times.
✓ Branch 1 taken 722 times.
|
1255 | if ( get_qr(qr_BROKENBOOKCOST) ) |
| 12169 | { | ||
| 12170 |
2/2✓ Branch 0 taken 413 times.
✓ Branch 1 taken 120 times.
|
533 | type = bookid != -1 ? current_item(itype_book) : itm.level; |
| 12171 |
2/2✓ Branch 0 taken 413 times.
✓ Branch 1 taken 120 times.
|
533 | pow = (bookid != -1 ? current_item_power(itype_book) : itm.power)*game->get_hero_dmgmult(); |
| 12172 | 533 | } | |
| 12173 | else | ||
| 12174 | { | ||
| 12175 |
3/4✓ Branch 0 taken 303 times.
✓ Branch 1 taken 419 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 303 times.
|
722 | type = (bookid != -1 && paybook) ? current_item(itype_book) : itm.level; |
| 12176 |
3/4✓ Branch 0 taken 303 times.
✓ Branch 1 taken 419 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 303 times.
|
722 | pow = ((bookid != -1 && paybook) ? current_item_power(itype_book) : itm.power)*game->get_hero_dmgmult(); |
| 12177 | } | ||
| 12178 |
4/6✗ Branch 0 not taken.
✓ Branch 1 taken 1255 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2510 times.
✓ Branch 4 taken 1255 times.
✓ Branch 5 taken 1255 times.
|
2510 | for(int32_t i=(spins==1?up:dir); i<=(spins==1 ? right:dir); i++) |
| 12179 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1255 times.
|
2510 | if(dir!=(i^1)) |
| 12180 | { | ||
| 12181 |
5/10✓ Branch 0 taken 1255 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1255 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1255 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1255 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1255 times.
✗ Branch 9 not taken.
|
1255 | weapon *magic = new weapon((zfix)wx,(zfix)wy,(zfix)wz,wMagic,type,pow,i, itemid,getUID(),false,false,true); |
| 12182 |
2/2✓ Branch 0 taken 539 times.
✓ Branch 1 taken 716 times.
|
1255 | if(paybook) |
| 12183 | 716 | magic->linkedItem = bookid; | |
| 12184 | //magic->dir = this->dir; //Save player dir for special weapons. | ||
| 12185 | 1255 | Lwpns.add(magic); | |
| 12186 | 1255 | } | |
| 12187 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1255 times.
|
1255 | if(!(misc_internal_hero_flags & LF_PAID_WAND_COST)) |
| 12188 | 1255 | paymagiccost(itemid); | |
| 12189 | ✗ | else misc_internal_hero_flags &= ~LF_PAID_WAND_COST; | |
| 12190 | |||
| 12191 |
2/2✓ Branch 0 taken 539 times.
✓ Branch 1 taken 716 times.
|
1255 | if(paybook) |
| 12192 | { | ||
| 12193 | 716 | paymagiccost(bookid); | |
| 12194 | 716 | start_cooldown(bookid); | |
| 12195 | 716 | } | |
| 12196 | |||
| 12197 | 1255 | start_cooldown(itemid); | |
| 12198 | |||
| 12199 |
2/2✓ Branch 0 taken 716 times.
✓ Branch 1 taken 539 times.
|
1255 | if(bookid != -1) |
| 12200 | { | ||
| 12201 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 716 times.
|
716 | if (( itemsbuf[bookid].flags & item_flag4 )) |
| 12202 | { | ||
| 12203 | ✗ | sfx(itemsbuf[bookid].misc2,pan(wx)); | |
| 12204 | ✗ | } | |
| 12205 | else | ||
| 12206 | { | ||
| 12207 | 716 | sfx(itm.usesound,pan(wx)); | |
| 12208 | } | ||
| 12209 | 716 | } | |
| 12210 | else | ||
| 12211 | 539 | sfx(itm.usesound,pan(wx)); | |
| 12212 | } | ||
| 12213 | /* | ||
| 12214 | // Fireball Wand | ||
| 12215 | Lwpns.add(new weapon((zfix)wx,(zfix)wy,(zfix)wz,wRefFireball,0,2*game->get_hero_dmgmult(),dir)); | ||
| 12216 | switch (dir) | ||
| 12217 | { | ||
| 12218 | case up: | ||
| 12219 | Lwpns.spr(Lwpns.Count()-1)->angle=-PI/2; | ||
| 12220 | Lwpns.spr(Lwpns.Count()-1)->dir=up; | ||
| 12221 | break; | ||
| 12222 | case down: | ||
| 12223 | Lwpns.spr(Lwpns.Count()-1)->angle=PI/2; | ||
| 12224 | Lwpns.spr(Lwpns.Count()-1)->dir=down; | ||
| 12225 | break; | ||
| 12226 | case left: | ||
| 12227 | Lwpns.spr(Lwpns.Count()-1)->angle=PI; | ||
| 12228 | Lwpns.spr(Lwpns.Count()-1)->dir=left; | ||
| 12229 | break; | ||
| 12230 | case right: | ||
| 12231 | Lwpns.spr(Lwpns.Count()-1)->angle=0; | ||
| 12232 | Lwpns.spr(Lwpns.Count()-1)->dir=right; | ||
| 12233 | break; | ||
| 12234 | } | ||
| 12235 | Lwpns.spr(Lwpns.Count()-1)->clk=16; | ||
| 12236 | ((weapon*)Lwpns.spr(Lwpns.Count()-1))->step=3.5; | ||
| 12237 | Lwpns.spr(Lwpns.Count()-1)->dummy_bool[0]=true; //homing | ||
| 12238 | */ | ||
| 12239 | 1255 | break; | |
| 12240 | |||
| 12241 | case itype_sword: | ||
| 12242 | { | ||
| 12243 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 20038 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
20038 | if(!(checkbunny(itemid) || !(misc_internal_hero_flags & LF_PAID_SWORD_COST || checkmagiccost(itemid)))) |
| 12244 | { | ||
| 12245 | ✗ | return item_error(); | |
| 12246 | } | ||
| 12247 | |||
| 12248 |
4/4✓ Branch 0 taken 4269 times.
✓ Branch 1 taken 15769 times.
✓ Branch 2 taken 4269 times.
✓ Branch 3 taken 15769 times.
|
20038 | if((Lwpns.idCount(wBeam) && spins==0)||Lwpns.idCount(wMagic)) |
| 12249 | { | ||
| 12250 | 4269 | misc_internal_hero_flags &= ~LF_PAID_SWORD_COST; | |
| 12251 | 4269 | return false; | |
| 12252 | } | ||
| 12253 | |||
| 12254 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 15769 times.
|
15769 | if(!(misc_internal_hero_flags & LF_PAID_SWORD_COST))//If already paid to use sword melee, don't charge again |
| 12255 | 15769 | paymagiccost(itemid); | |
| 12256 | ✗ | else misc_internal_hero_flags &= ~LF_PAID_SWORD_COST; | |
| 12257 | |||
| 12258 | 15769 | start_cooldown(itemid); | |
| 12259 | |||
| 12260 | int temppower; | ||
| 12261 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 15769 times.
|
15769 | if(itm.flags & item_flag2) |
| 12262 | { | ||
| 12263 | 15769 | temppower=game->get_hero_dmgmult()*itm.power; | |
| 12264 | 15769 | temppower=temppower*itm.misc2; | |
| 12265 | 15769 | temppower=temppower/100; | |
| 12266 | 15769 | } | |
| 12267 | else | ||
| 12268 | { | ||
| 12269 | ✗ | temppower = game->get_hero_dmgmult()*itm.misc2; | |
| 12270 | } | ||
| 12271 | |||
| 12272 |
5/10✓ Branch 0 taken 15769 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 15769 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 15769 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 15769 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 15769 times.
✗ Branch 9 not taken.
|
15769 | Lwpns.add(new weapon((zfix)wx,(zfix)wy,(zfix)wz,wBeam,itm.level,temppower,dir,itemid,getUID(),false,false,true)); |
| 12273 | 15769 | sfx(itm.usesound2, pan(wx)); | |
| 12274 | } | ||
| 12275 | 15769 | break; | |
| 12276 | |||
| 12277 | case itype_candle: | ||
| 12278 | { | ||
| 12279 | 2335 | int32_t countid = itemid; | |
| 12280 |
2/2✓ Branch 0 taken 619 times.
✓ Branch 1 taken 1716 times.
|
2335 | if(get_qr(qr_CANDLES_SHARED_LIMIT)) |
| 12281 | 1716 | countid = -itype_candle; | |
| 12282 |
5/6✓ Branch 0 taken 1939 times.
✓ Branch 1 taken 396 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 396 times.
✓ Branch 4 taken 19 times.
✓ Branch 5 taken 2316 times.
|
2335 | if(itm.flags&item_flag1 && usecounts[countid] >= zc_max(1, itm.misc3)) |
| 12283 | { | ||
| 12284 | 19 | return false; | |
| 12285 | } | ||
| 12286 | |||
| 12287 |
4/4✓ Branch 0 taken 540 times.
✓ Branch 1 taken 1776 times.
✓ Branch 2 taken 96 times.
✓ Branch 3 taken 2220 times.
|
2316 | if(Lwpns.idCount(wFire) >= (itm.misc2 < 1 ? 2 : itm.misc2)) |
| 12288 | { | ||
| 12289 | 96 | return false; | |
| 12290 | } | ||
| 12291 | |||
| 12292 |
3/4✓ Branch 0 taken 2220 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 25 times.
✓ Branch 3 taken 2195 times.
|
2220 | if(!(checkbunny(itemid) && checkmagiccost(itemid))) |
| 12293 | { | ||
| 12294 | 25 | return item_error(); | |
| 12295 | } | ||
| 12296 | |||
| 12297 | 2195 | paymagiccost(itemid); | |
| 12298 | 2195 | start_cooldown(itemid); | |
| 12299 | |||
| 12300 |
2/2✓ Branch 0 taken 369 times.
✓ Branch 1 taken 1826 times.
|
2195 | if(itm.flags&item_flag1) ++usecounts[countid]; |
| 12301 | |||
| 12302 |
4/8✓ Branch 0 taken 2195 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2195 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2195 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2195 times.
✗ Branch 7 not taken.
|
4390 | Lwpns.add(new weapon((zfix)wx,(zfix)wy,(zfix)wz,wFire, |
| 12303 | //(itm.fam_type > 1), //To do with combo flags ... Needs to be changed to fix ->Level for wFire | ||
| 12304 | 2195 | (itm.level), //To do with combo flags ... Needs to be changed to fix ->Level for wFire | |
| 12305 |
2/4✓ Branch 0 taken 2195 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2195 times.
✗ Branch 3 not taken.
|
2195 | itm.power*game->get_hero_dmgmult(),dir,itemid,getUID(),false,false,true)); |
| 12306 | 2195 | sfx(itm.usesound,pan(wx)); | |
| 12307 | 2195 | attack=wFire; | |
| 12308 | } | ||
| 12309 | 2195 | break; | |
| 12310 | |||
| 12311 | case itype_script1: case itype_script2: case itype_script3: case itype_script4: case itype_script5: | ||
| 12312 | case itype_script6: case itype_script7: case itype_script8: case itype_script9: case itype_script10: | ||
| 12313 | { | ||
| 12314 | ✗ | int32_t wtype = wScript1 + (itm.type-itype_script1); | |
| 12315 | ✗ | if(Lwpns.idCount(wtype)) | |
| 12316 | ✗ | return false; | |
| 12317 | |||
| 12318 | ✗ | if(!(checkbunny(itemid) && checkmagiccost(itemid))) | |
| 12319 | { | ||
| 12320 | ✗ | return item_error(); | |
| 12321 | } | ||
| 12322 | |||
| 12323 | ✗ | if(!get_qr(qr_CUSTOMWEAPON_IGNORE_COST)) | |
| 12324 | ✗ | paymagiccost(itemid); | |
| 12325 | ✗ | start_cooldown(itemid); | |
| 12326 | |||
| 12327 | ✗ | zfix wpnstep = zfix(itm.misc1)/100; | |
| 12328 | ✗ | if(replay_version_check(0,30)) | |
| 12329 | ✗ | wpnstep = itm.misc1/100; | |
| 12330 | |||
| 12331 | ✗ | Lwpns.add(new weapon((zfix)wx,(zfix)wy,(zfix)wz,wtype,itm.level,game->get_hero_dmgmult()*itm.power,dir,itemid,getUID(),false,false,true)); | |
| 12332 | ✗ | if(!(itm.weap_data.flags & wdata_set_step)) | |
| 12333 | ✗ | ((weapon*)Lwpns.spr(Lwpns.Count()-1))->step = wpnstep; | |
| 12334 | ✗ | sfx(itm.usesound,pan(wx)); | |
| 12335 | } | ||
| 12336 | ✗ | break; | |
| 12337 | |||
| 12338 | case itype_icerod: | ||
| 12339 | { | ||
| 12340 | ✗ | if(Lwpns.idCount(wIce)) | |
| 12341 | ✗ | return false; | |
| 12342 | |||
| 12343 | ✗ | if(!(checkbunny(itemid) && checkmagiccost(itemid))) | |
| 12344 | { | ||
| 12345 | ✗ | return item_error(); | |
| 12346 | } | ||
| 12347 | |||
| 12348 | ✗ | if(!get_qr(qr_CUSTOMWEAPON_IGNORE_COST)) | |
| 12349 | ✗ | paymagiccost(itemid); | |
| 12350 | ✗ | start_cooldown(itemid); | |
| 12351 | |||
| 12352 | ✗ | zfix wpnstep = zfix(itm.misc1)/100; | |
| 12353 | ✗ | if(replay_version_check(0,30)) | |
| 12354 | ✗ | wpnstep = itm.misc1/100; | |
| 12355 | |||
| 12356 | ✗ | Lwpns.add(new weapon((zfix)wx,(zfix)wy,(zfix)wz,wIce,itm.level,game->get_hero_dmgmult()*itm.power,dir,itemid,getUID(),false,false,true)); | |
| 12357 | ✗ | if(!(itm.weap_data.flags & wdata_set_step)) | |
| 12358 | ✗ | ((weapon*)Lwpns.spr(Lwpns.Count()-1))->step = wpnstep; | |
| 12359 | ✗ | sfx(itm.usesound,pan(wx)); | |
| 12360 | } | ||
| 12361 | ✗ | break; | |
| 12362 | |||
| 12363 | case itype_arrow: | ||
| 12364 | { | ||
| 12365 |
4/4✓ Branch 0 taken 245 times.
✓ Branch 1 taken 2357 times.
✓ Branch 2 taken 94 times.
✓ Branch 3 taken 2508 times.
|
2602 | if(Lwpns.idCount(wArrow) >= (itm.misc2 < 1 ? 1 : itm.misc2)) |
| 12366 | 94 | return false; | |
| 12367 | |||
| 12368 |
3/4✓ Branch 0 taken 2508 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 17 times.
✓ Branch 3 taken 2491 times.
|
2508 | if(!(checkbunny(itemid) && checkmagiccost(itemid))) |
| 12369 | { | ||
| 12370 | 17 | return item_error(); | |
| 12371 | } | ||
| 12372 | |||
| 12373 | 2491 | paymagiccost(itemid); | |
| 12374 | 2491 | start_cooldown(itemid); | |
| 12375 | |||
| 12376 |
6/12✓ Branch 0 taken 2491 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2491 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2491 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2491 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2491 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 2491 times.
✗ Branch 11 not taken.
|
2491 | Lwpns.add(new weapon((zfix)wx,(zfix)wy,(zfix)wz,wArrow,itm.level,game->get_hero_dmgmult()*itm.power,dir,itemid,getUID(),false,false,true)); |
| 12377 | 2491 | ((weapon*)Lwpns.spr(Lwpns.Count()-1))->step*=(current_item_power(itype_bow)+1)/2; | |
| 12378 | 2491 | sfx(itm.usesound,pan(wx)); | |
| 12379 | } | ||
| 12380 | 2491 | break; | |
| 12381 | |||
| 12382 | case itype_bait: | ||
| 12383 | { | ||
| 12384 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 20 times.
|
20 | if(Lwpns.idCount(wBait)) //TODO: More than one Bait per screen? |
| 12385 | ✗ | return false; | |
| 12386 | |||
| 12387 |
2/2✓ Branch 0 taken 17 times.
✓ Branch 1 taken 3 times.
|
20 | if(!checkbunny(itemid)) |
| 12388 | 3 | return item_error(); | |
| 12389 | |||
| 12390 |
4/6✓ Branch 0 taken 1 times.
✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 16 times.
✓ Branch 4 taken 16 times.
✗ Branch 5 not taken.
|
33 | bool grumble = (hero_scr->room==rGRUMBLE && (!getmapflag(hero_scr, (cur_screen < 128 && get_qr(qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM) || (hero_scr->flags9&fBELOWRETURN))); |
| 12391 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 1 times.
|
17 | bool checkcost = grumble || !(itm.flags & item_flag4); |
| 12392 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 1 times.
|
17 | bool paycost = grumble || !(itm.flags & (item_flag4|item_flag5)); |
| 12393 | |||
| 12394 |
3/4✓ Branch 0 taken 1 times.
✓ Branch 1 taken 16 times.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
|
17 | if(!grumble && (itm.flags & item_flag2)) |
| 12395 | ✗ | return item_error(); //Only usable for grumble rooms | |
| 12396 | |||
| 12397 |
2/4✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 17 times.
✗ Branch 3 not taken.
|
17 | if(checkcost && !checkmagiccost(itemid)) |
| 12398 | ✗ | return item_error(); | |
| 12399 | |||
| 12400 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 17 times.
|
17 | if(paycost) |
| 12401 | 17 | paymagiccost(itemid); | |
| 12402 | 17 | start_cooldown(itemid); | |
| 12403 | 17 | sfx(itm.usesound,pan(wx)); | |
| 12404 | |||
| 12405 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 1 times.
|
17 | if(grumble) |
| 12406 | { | ||
| 12407 |
4/8✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 16 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 16 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 16 times.
✗ Branch 7 not taken.
|
16 | items.add(new item((zfix)wx,(zfix)wy,(zfix)0,itemid,ipDUMMY+ipFADE,0)); |
| 12408 | 16 | fadeclk=66; | |
| 12409 | 16 | dismissmsg(); | |
| 12410 | 16 | clear_bitmap(pricesdisplaybuf); | |
| 12411 | 16 | set_clip_state(pricesdisplaybuf, 1); | |
| 12412 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
|
16 | setmapflag(hero_scr, (cur_screen < 128 && get_qr(qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM); |
| 12413 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
|
16 | if(!(itm.flags & item_flag3)) //"Don't remove when feeding" flag |
| 12414 | { | ||
| 12415 | 16 | removeItemsOfFamily(game,itemsbuf,itype_bait); | |
| 12416 | 16 | verifyBothWeapons(); | |
| 12417 | 16 | } | |
| 12418 | 16 | sfx(hero_scr->secretsfx); | |
| 12419 | 16 | return false; | |
| 12420 | } | ||
| 12421 | |||
| 12422 |
5/10✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
|
1 | Lwpns.add(new weapon((zfix)wx,(zfix)wy,(zfix)wz,wBait,0,0,dir,itemid,getUID(),false,false,true)); |
| 12423 | 1 | break; | |
| 12424 | } | ||
| 12425 | |||
| 12426 | case itype_brang: | ||
| 12427 | { | ||
| 12428 |
2/2✓ Branch 0 taken 327 times.
✓ Branch 1 taken 13763 times.
|
14090 | if(Lwpns.idCount(wBrang) > itm.misc2) |
| 12429 | 327 | return false; | |
| 12430 | |||
| 12431 |
2/4✓ Branch 0 taken 13763 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 13763 times.
|
13763 | if(!(checkbunny(itemid) && checkmagiccost(itemid))) |
| 12432 | { | ||
| 12433 | ✗ | return item_error(); | |
| 12434 | } | ||
| 12435 | |||
| 12436 | 13763 | paymagiccost(itemid); | |
| 12437 | 13763 | start_cooldown(itemid); | |
| 12438 | |||
| 12439 | 13763 | current_item_power(itype_brang); | |
| 12440 |
6/12✓ Branch 0 taken 13763 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 13763 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 13763 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 13763 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 13763 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 13763 times.
✗ Branch 11 not taken.
|
13763 | Lwpns.add(new weapon((zfix)wx,(zfix)wy,(zfix)wz,wBrang,itm.level,(itm.power*game->get_hero_dmgmult()),dir,itemid,getUID(),false,false,true)); |
| 12441 | } | ||
| 12442 | 13763 | break; | |
| 12443 | |||
| 12444 | case itype_hookshot: | ||
| 12445 | case itype_switchhook: | ||
| 12446 | { | ||
| 12447 |
3/4✓ Branch 0 taken 2489 times.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2489 times.
|
2490 | if(inlikelike || Lwpns.idCount(wHookshot)) |
| 12448 | 1 | return false; | |
| 12449 | |||
| 12450 |
2/4✓ Branch 0 taken 2489 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2489 times.
|
2489 | if(!(checkbunny(itemid) && checkmagiccost(itemid))) |
| 12451 | { | ||
| 12452 | ✗ | return item_error(); | |
| 12453 | } | ||
| 12454 | 2489 | bool sw = itm.type == itype_switchhook; | |
| 12455 | |||
| 12456 |
3/4✓ Branch 0 taken 2 times.
✓ Branch 1 taken 2487 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2489 | if(sw && (itm.flags&item_flag8)) |
| 12457 | ✗ | switchhook_cost_item = itemid; | |
| 12458 | 2489 | else paymagiccost(itemid); | |
| 12459 | |||
| 12460 | 2489 | start_cooldown(itemid); | |
| 12461 | |||
| 12462 | 2489 | bool use_hookshot=true; | |
| 12463 | 2489 | bool hit_hs = false, hit_solid = false, insta_switch = false; | |
| 12464 |
2/2✓ Branch 0 taken 105 times.
✓ Branch 1 taken 2384 times.
|
2489 | int32_t max_layer = get_qr(qr_HOOKSHOTALLLAYER) ? 6 : (get_qr(qr_HOOKSHOTLAYERFIX) ? 2 : 0); |
| 12465 | 2489 | rpos_t rpos = rpos_t::None; | |
| 12466 | 2489 | ffcdata* ffc = nullptr; | |
| 12467 |
4/4✓ Branch 0 taken 2455 times.
✓ Branch 1 taken 5800 times.
✓ Branch 2 taken 5766 times.
✓ Branch 3 taken 2489 times.
|
8255 | for(int32_t i=0; i<=max_layer && !hit_hs; ++i) |
| 12468 | { | ||
| 12469 |
2/2✓ Branch 0 taken 4747 times.
✓ Branch 1 taken 1019 times.
|
5766 | if(dir==up) |
| 12470 | { | ||
| 12471 |
2/2✓ Branch 0 taken 995 times.
✓ Branch 1 taken 24 times.
|
1019 | if(check_hshot(i,x+2,y-7,sw, &rpos, &ffc)) |
| 12472 | 24 | hit_hs = true; | |
| 12473 | 1019 | } | |
| 12474 |
2/2✓ Branch 0 taken 1046 times.
✓ Branch 1 taken 3701 times.
|
4747 | else if(dir==down) |
| 12475 | { | ||
| 12476 |
1/2✓ Branch 0 taken 1046 times.
✗ Branch 1 not taken.
|
1046 | if(check_hshot(i,x+12,y+23,sw, &rpos, &ffc)) |
| 12477 | ✗ | hit_hs = true; | |
| 12478 | 1046 | } | |
| 12479 |
2/2✓ Branch 0 taken 1843 times.
✓ Branch 1 taken 1858 times.
|
3701 | else if(dir==left) |
| 12480 | { | ||
| 12481 |
2/2✓ Branch 0 taken 1834 times.
✓ Branch 1 taken 9 times.
|
1843 | if(check_hshot(i,x-7,y+12,sw, &rpos, &ffc)) |
| 12482 | 9 | hit_hs = true; | |
| 12483 | 1843 | } | |
| 12484 |
1/2✓ Branch 0 taken 1858 times.
✗ Branch 1 not taken.
|
1858 | else if(dir==right) |
| 12485 | { | ||
| 12486 |
2/2✓ Branch 0 taken 1855 times.
✓ Branch 1 taken 3 times.
|
1858 | if(check_hshot(i,x+23,y+12,sw, &rpos, &ffc)) |
| 12487 | 3 | hit_hs = true; | |
| 12488 | 1858 | } | |
| 12489 | //Diagonal Hookshot (6) | ||
| 12490 | ✗ | else if(dir==r_down) | |
| 12491 | { | ||
| 12492 | ✗ | if(check_hshot(i,x+9,y+13,sw, &rpos, &ffc)) | |
| 12493 | ✗ | hit_hs = true; | |
| 12494 | ✗ | } | |
| 12495 | ✗ | else if(dir==l_down) | |
| 12496 | { | ||
| 12497 | ✗ | if(check_hshot(i,x+6,y+13,sw, &rpos, &ffc)) | |
| 12498 | ✗ | hit_hs = true; | |
| 12499 | ✗ | } | |
| 12500 | ✗ | else if(dir==r_up) | |
| 12501 | { | ||
| 12502 | ✗ | if(check_hshot(i,x+9,y+13,sw, &rpos, &ffc)) | |
| 12503 | ✗ | hit_hs = true; | |
| 12504 | ✗ | } | |
| 12505 | ✗ | else if(dir==l_up) | |
| 12506 | { | ||
| 12507 | ✗ | if(check_hshot(i,x+6,y+13,sw, &rpos, &ffc)) | |
| 12508 | ✗ | hit_hs = true; | |
| 12509 | ✗ | } | |
| 12510 | 5766 | } | |
| 12511 |
6/6✓ Branch 0 taken 418 times.
✓ Branch 1 taken 2071 times.
✓ Branch 2 taken 364 times.
✓ Branch 3 taken 54 times.
✓ Branch 4 taken 2460 times.
✓ Branch 5 taken 29 times.
|
2489 | if(dir==up && _walkflag(x+2,y+4,1,get_standing_z_state()) && !ishookshottable(x.getInt(),int32_t(y+4))) |
| 12512 | 29 | hit_solid = true; | |
| 12513 |
2/2✓ Branch 0 taken 2453 times.
✓ Branch 1 taken 36 times.
|
2489 | if(hit_hs) |
| 12514 | { | ||
| 12515 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 36 times.
|
36 | if(sw) |
| 12516 | ✗ | insta_switch = true; //switch immediately | |
| 12517 | 36 | else use_hookshot = false; //No hooking against grabbable | |
| 12518 | 36 | } | |
| 12519 |
3/4✓ Branch 0 taken 29 times.
✓ Branch 1 taken 2460 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 29 times.
|
2489 | if(hit_solid && !insta_switch) |
| 12520 | 29 | use_hookshot = false; | |
| 12521 |
2/2✓ Branch 0 taken 50 times.
✓ Branch 1 taken 2439 times.
|
2489 | if(use_hookshot) |
| 12522 | { | ||
| 12523 | 2439 | int32_t hookitem = itm.level; | |
| 12524 | 2439 | int32_t hookpower = itm.power; | |
| 12525 | 2439 | byte allow_diagonal = (itm.flags & item_flag2) ? 1 : 0; | |
| 12526 | |||
| 12527 |
1/2✓ Branch 0 taken 2439 times.
✗ Branch 1 not taken.
|
2439 | if(!Lwpns.has_space()) |
| 12528 | { | ||
| 12529 | ✗ | Lwpns.del(0); | |
| 12530 | ✗ | } | |
| 12531 | |||
| 12532 |
1/2✓ Branch 0 taken 2439 times.
✗ Branch 1 not taken.
|
2439 | if(!Lwpns.has_space(2)) |
| 12533 | { | ||
| 12534 | ✗ | Lwpns.del(0); | |
| 12535 | ✗ | } | |
| 12536 | |||
| 12537 |
4/9✗ Branch 0 not taken.
✓ Branch 1 taken 380 times.
✓ Branch 2 taken 440 times.
✓ Branch 3 taken 786 times.
✓ Branch 4 taken 833 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
|
2439 | switch(dir) |
| 12538 | { | ||
| 12539 | case up: | ||
| 12540 | { | ||
| 12541 | 380 | hookshot_used=true; | |
| 12542 | 380 | hs_switcher = sw; | |
| 12543 |
4/8✓ Branch 0 taken 380 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 380 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 380 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 380 times.
✗ Branch 7 not taken.
|
760 | Lwpns.add(new weapon((zfix)wx,(zfix)wy,(zfix)wz,wHSHandle,hookitem, |
| 12544 |
2/4✓ Branch 0 taken 380 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 380 times.
✗ Branch 3 not taken.
|
380 | hookpower*game->get_hero_dmgmult(),dir,itemid,getUID(),false,false,true)); |
| 12545 | 380 | ((weapon*)Lwpns.spr(Lwpns.Count()-1))->family_class = itm.type; | |
| 12546 |
5/10✓ Branch 0 taken 380 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 380 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 380 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 380 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 380 times.
✗ Branch 9 not taken.
|
760 | Lwpns.add(new weapon((zfix)wx,(zfix)wy-4,(zfix)wz,wHookshot,hookitem, |
| 12547 |
2/4✓ Branch 0 taken 380 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 380 times.
✗ Branch 3 not taken.
|
380 | hookpower*game->get_hero_dmgmult(),dir,itemid,getUID(),false,false,true)); |
| 12548 | 380 | ((weapon*)Lwpns.spr(Lwpns.Count()-1))->family_class = itm.type; | |
| 12549 | 380 | hs_startx=wx; | |
| 12550 | 380 | hs_starty=wy-4; | |
| 12551 | } | ||
| 12552 | 380 | break; | |
| 12553 | |||
| 12554 | case down: | ||
| 12555 | { | ||
| 12556 | 440 | int32_t offset=get_qr(qr_HOOKSHOTDOWNBUG)?4:0; | |
| 12557 | 440 | hookshot_used=true; | |
| 12558 | 440 | hs_switcher = sw; | |
| 12559 |
5/10✓ Branch 0 taken 440 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 440 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 440 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 440 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 440 times.
✗ Branch 9 not taken.
|
880 | Lwpns.add(new weapon((zfix)wx,(zfix)wy+offset,(zfix)wz,wHSHandle,hookitem, |
| 12560 |
2/4✓ Branch 0 taken 440 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 440 times.
✗ Branch 3 not taken.
|
440 | hookpower*game->get_hero_dmgmult(),dir,itemid,getUID(),false,false,true)); |
| 12561 | 440 | ((weapon*)Lwpns.spr(Lwpns.Count()-1))->family_class = itm.type; | |
| 12562 |
5/10✓ Branch 0 taken 440 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 440 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 440 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 440 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 440 times.
✗ Branch 9 not taken.
|
880 | Lwpns.add(new weapon((zfix)wx,(zfix)wy+offset,(zfix)wz,wHookshot,hookitem, |
| 12563 |
2/4✓ Branch 0 taken 440 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 440 times.
✗ Branch 3 not taken.
|
440 | hookpower*game->get_hero_dmgmult(),dir,itemid,getUID(),false,false,true)); |
| 12564 | 440 | ((weapon*)Lwpns.spr(Lwpns.Count()-1))->family_class = itm.type; | |
| 12565 | 440 | hs_startx=wx; | |
| 12566 | 440 | hs_starty=wy; | |
| 12567 | } | ||
| 12568 | 440 | break; | |
| 12569 | |||
| 12570 | case left: | ||
| 12571 | { | ||
| 12572 | 786 | hookshot_used=true; | |
| 12573 | 786 | hs_switcher = sw; | |
| 12574 |
4/8✓ Branch 0 taken 786 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 786 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 786 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 786 times.
✗ Branch 7 not taken.
|
1572 | Lwpns.add(new weapon((zfix)wx,(zfix)wy,(zfix)wz,wHSHandle,hookitem, |
| 12575 |
2/4✓ Branch 0 taken 786 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 786 times.
✗ Branch 3 not taken.
|
786 | hookpower*game->get_hero_dmgmult(),dir,itemid,getUID(),false,false,true)); |
| 12576 | 786 | ((weapon*)Lwpns.spr(Lwpns.Count()-1))->family_class = itm.type; | |
| 12577 |
4/8✓ Branch 0 taken 786 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 786 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 786 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 786 times.
✗ Branch 7 not taken.
|
1572 | Lwpns.add(new weapon((zfix)(wx-4),(zfix)wy,(zfix)wz,wHookshot,hookitem, |
| 12578 |
2/4✓ Branch 0 taken 786 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 786 times.
✗ Branch 3 not taken.
|
786 | hookpower*game->get_hero_dmgmult(),dir,itemid,getUID(),false,false,true)); |
| 12579 | 786 | ((weapon*)Lwpns.spr(Lwpns.Count()-1))->family_class = itm.type; | |
| 12580 | 786 | hs_startx=wx-4; | |
| 12581 | 786 | hs_starty=wy; | |
| 12582 | } | ||
| 12583 | 786 | break; | |
| 12584 | |||
| 12585 | case right: | ||
| 12586 | { | ||
| 12587 | 833 | hookshot_used=true; | |
| 12588 | 833 | hs_switcher = sw; | |
| 12589 | // TODO(crash): check that .add succeeds. | ||
| 12590 |
4/8✓ Branch 0 taken 833 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 833 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 833 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 833 times.
✗ Branch 7 not taken.
|
1666 | Lwpns.add(new weapon((zfix)wx,(zfix)wy,(zfix)wz,wHSHandle,hookitem, |
| 12591 |
2/4✓ Branch 0 taken 833 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 833 times.
✗ Branch 3 not taken.
|
833 | hookpower*game->get_hero_dmgmult(),dir,itemid,getUID(),false,false,true)); |
| 12592 | 833 | ((weapon*)Lwpns.spr(Lwpns.Count()-1))->family_class = itm.type; | |
| 12593 |
4/8✓ Branch 0 taken 833 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 833 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 833 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 833 times.
✗ Branch 7 not taken.
|
1666 | Lwpns.add(new weapon((zfix)(wx+4),(zfix)wy,(zfix)wz,wHookshot,hookitem, |
| 12594 |
2/4✓ Branch 0 taken 833 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 833 times.
✗ Branch 3 not taken.
|
833 | hookpower*game->get_hero_dmgmult(),dir,itemid,getUID(),false,false,true)); |
| 12595 | 833 | ((weapon*)Lwpns.spr(Lwpns.Count()-1))->family_class = itm.type; | |
| 12596 | 833 | hs_startx=wx+4; | |
| 12597 | 833 | hs_starty=wy; | |
| 12598 | } | ||
| 12599 | 833 | break; | |
| 12600 | //Diagonal Hookshot (7) | ||
| 12601 | case r_down: | ||
| 12602 | { | ||
| 12603 | ✗ | hookshot_used=true; | |
| 12604 | ✗ | hs_switcher = sw; | |
| 12605 | ✗ | int32_t offset=get_qr(qr_HOOKSHOTDOWNBUG)?4:0; | |
| 12606 | ✗ | Lwpns.add(new weapon((zfix)wx,(zfix)wy+offset,(zfix)wz,wHSHandle,hookitem, | |
| 12607 | ✗ | hookpower*game->get_hero_dmgmult(),dir,itemid,getUID(),false,false,true)); | |
| 12608 | ✗ | ((weapon*)Lwpns.spr(Lwpns.Count()-1))->family_class = itm.type; | |
| 12609 | ✗ | Lwpns.add(new weapon((zfix)(wx+4),(zfix)wy+offset,(zfix)wz,wHookshot,hookitem, | |
| 12610 | ✗ | hookpower*game->get_hero_dmgmult(),dir,itemid,getUID(),false,false,true)); | |
| 12611 | ✗ | ((weapon*)Lwpns.spr(Lwpns.Count()-1))->family_class = itm.type; | |
| 12612 | ✗ | hs_startx=wx+4; | |
| 12613 | ✗ | hs_starty=wy; | |
| 12614 | } | ||
| 12615 | ✗ | break; | |
| 12616 | |||
| 12617 | case r_up: | ||
| 12618 | { | ||
| 12619 | ✗ | hookshot_used=true; | |
| 12620 | ✗ | hs_switcher = sw; | |
| 12621 | ✗ | Lwpns.add(new weapon((zfix)wx,(zfix)wy,(zfix)wz,wHSHandle,hookitem, | |
| 12622 | ✗ | hookpower*game->get_hero_dmgmult(),dir,itemid,getUID(),false,false,true)); | |
| 12623 | ✗ | ((weapon*)Lwpns.spr(Lwpns.Count()-1))->family_class = itm.type; | |
| 12624 | ✗ | Lwpns.add(new weapon((zfix)(wx+4),(zfix)wy,(zfix)wz,wHookshot,hookitem, | |
| 12625 | ✗ | hookpower*game->get_hero_dmgmult(),dir,itemid,getUID(),false,false,true)); | |
| 12626 | ✗ | ((weapon*)Lwpns.spr(Lwpns.Count()-1))->family_class = itm.type; | |
| 12627 | ✗ | hs_startx=wx+4; | |
| 12628 | ✗ | hs_starty=wy; | |
| 12629 | } | ||
| 12630 | ✗ | break; | |
| 12631 | |||
| 12632 | case l_down: | ||
| 12633 | { | ||
| 12634 | ✗ | hookshot_used=true; | |
| 12635 | ✗ | hs_switcher = sw; | |
| 12636 | ✗ | int32_t offset=get_qr(qr_HOOKSHOTDOWNBUG)?4:0; | |
| 12637 | ✗ | Lwpns.add(new weapon((zfix)wx,(zfix)wy+offset,(zfix)wz,wHSHandle,hookitem, | |
| 12638 | ✗ | hookpower*game->get_hero_dmgmult(),dir,itemid,getUID(),false,false,true)); | |
| 12639 | ✗ | ((weapon*)Lwpns.spr(Lwpns.Count()-1))->family_class = itm.type; | |
| 12640 | ✗ | Lwpns.add(new weapon((zfix)(wx-4),(zfix)wy+offset,(zfix)wz,wHookshot,hookitem, | |
| 12641 | ✗ | hookpower*game->get_hero_dmgmult(),dir,itemid,getUID(),false,false,true)); | |
| 12642 | ✗ | ((weapon*)Lwpns.spr(Lwpns.Count()-1))->family_class = itm.type; | |
| 12643 | ✗ | hs_startx=wx+4; | |
| 12644 | ✗ | hs_starty=wy; | |
| 12645 | } | ||
| 12646 | ✗ | break; | |
| 12647 | |||
| 12648 | case l_up: | ||
| 12649 | { | ||
| 12650 | ✗ | hookshot_used=true; | |
| 12651 | ✗ | hs_switcher = sw; | |
| 12652 | ✗ | Lwpns.add(new weapon((zfix)wx,(zfix)wy,(zfix)wz,wHSHandle,hookitem, | |
| 12653 | ✗ | hookpower*game->get_hero_dmgmult(),dir,itemid,getUID(),false,false,true)); | |
| 12654 | ✗ | ((weapon*)Lwpns.spr(Lwpns.Count()-1))->family_class = itm.type; | |
| 12655 | ✗ | Lwpns.add(new weapon((zfix)(wx-4),(zfix)wy,(zfix)wz,wHookshot,hookitem, | |
| 12656 | ✗ | hookpower*game->get_hero_dmgmult(),dir,itemid,getUID(),false,false,true)); | |
| 12657 | ✗ | ((weapon*)Lwpns.spr(Lwpns.Count()-1))->family_class = itm.type; | |
| 12658 | ✗ | hs_startx=wx+4; | |
| 12659 | ✗ | hs_starty=wy; | |
| 12660 | } | ||
| 12661 | ✗ | break; | |
| 12662 | } | ||
| 12663 | 2439 | hookshot_frozen=true; | |
| 12664 | 2439 | } | |
| 12665 |
1/2✓ Branch 0 taken 2489 times.
✗ Branch 1 not taken.
|
2489 | if(insta_switch) |
| 12666 | { | ||
| 12667 | ✗ | weapon* w = (weapon*)Lwpns.spr(Lwpns.idFirst(wHookshot)); | |
| 12668 | ✗ | if (rpos != rpos_t::None) hooked_comborpos = rpos; | |
| 12669 | ✗ | if (ffc) | |
| 12670 | { | ||
| 12671 | ✗ | ffc->switch_hooked = true; | |
| 12672 | ✗ | switching_object = ffc; | |
| 12673 | ✗ | } | |
| 12674 | ✗ | w->misc=2; | |
| 12675 | ✗ | w->step=0; | |
| 12676 | ✗ | doSwitchHook(itm.misc5); | |
| 12677 | ✗ | if(itm.usesound2) | |
| 12678 | ✗ | sfx(itm.usesound2,pan(x)); | |
| 12679 | ✗ | else if(QMisc.miscsfx[sfxSWITCHED]) | |
| 12680 | ✗ | sfx(QMisc.miscsfx[sfxSWITCHED],pan(x)); | |
| 12681 | ✗ | stop_sfx(itm.usesound); | |
| 12682 | ✗ | } | |
| 12683 | } | ||
| 12684 | 2489 | break; | |
| 12685 | |||
| 12686 | case itype_divinefire: | ||
| 12687 |
3/12✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 12 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
12 | if(z!=0 || fakez!=0 || (isSideViewHero() && !(on_sideview_solid_oldpos(this) || getOnSideviewLadder() || IsSideSwim()))) |
| 12688 | ✗ | return false; | |
| 12689 | |||
| 12690 |
2/4✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 12 times.
|
12 | if(!(checkbunny(itemid) && checkmagiccost(itemid))) |
| 12691 | { | ||
| 12692 | ✗ | return item_error(); | |
| 12693 | } | ||
| 12694 | |||
| 12695 | 12 | paymagiccost(itemid); | |
| 12696 | 12 | start_cooldown(itemid); | |
| 12697 | |||
| 12698 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
|
12 | if (IsSideSwim()) {action=sideswimcasting; FFCore.setHeroAction(sideswimcasting);} |
| 12699 | 12 | else {action=casting; FFCore.setHeroAction(casting);} | |
| 12700 | 12 | magicitem=itemid; | |
| 12701 | 12 | break; | |
| 12702 | |||
| 12703 | case itype_divineescape: | ||
| 12704 |
3/12✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 8 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
8 | if(z!=0 || fakez!=0 || (isSideViewHero() && !(on_sideview_solid_oldpos(this) || getOnSideviewLadder() || IsSideSwim()))) |
| 12705 | ✗ | return false; | |
| 12706 | |||
| 12707 |
2/4✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 8 times.
|
8 | if(!(checkbunny(itemid) && checkmagiccost(itemid))) |
| 12708 | { | ||
| 12709 | ✗ | return item_error(); | |
| 12710 | } | ||
| 12711 | |||
| 12712 | 8 | paymagiccost(itemid); | |
| 12713 | 8 | start_cooldown(itemid); | |
| 12714 | |||
| 12715 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
|
8 | if (IsSideSwim()) {action=sideswimcasting; FFCore.setHeroAction(sideswimcasting);} |
| 12716 | 8 | else {action=casting; FFCore.setHeroAction(casting);} | |
| 12717 | 8 | magicitem=itemid; | |
| 12718 | 8 | break; | |
| 12719 | |||
| 12720 | case itype_divineprotection: | ||
| 12721 | ✗ | if(z!=0 || fakez!=0 || (isSideViewHero() && !(on_sideview_solid_oldpos(this) || getOnSideviewLadder() || IsSideSwim()))) | |
| 12722 | ✗ | return false; | |
| 12723 | |||
| 12724 | ✗ | if(!(checkbunny(itemid) && checkmagiccost(itemid))) | |
| 12725 | { | ||
| 12726 | ✗ | return item_error(); | |
| 12727 | } | ||
| 12728 | |||
| 12729 | ✗ | paymagiccost(itemid); | |
| 12730 | ✗ | start_cooldown(itemid); | |
| 12731 | |||
| 12732 | ✗ | if (IsSideSwim()) {action=sideswimcasting; FFCore.setHeroAction(sideswimcasting);} | |
| 12733 | ✗ | else {action=casting; FFCore.setHeroAction(casting);} | |
| 12734 | ✗ | magicitem=itemid; | |
| 12735 | ✗ | break; | |
| 12736 | |||
| 12737 | case itype_cbyrna: | ||
| 12738 | { | ||
| 12739 | //Beams already deployed | ||
| 12740 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 2 times.
|
4 | if(Lwpns.idCount(wCByrna)) |
| 12741 | { | ||
| 12742 | 2 | stopCaneOfByrna(); | |
| 12743 | 2 | return false; | |
| 12744 | } | ||
| 12745 | |||
| 12746 |
2/4✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
|
2 | if(!(checkbunny(itemid) && checkmagiccost(itemid))) |
| 12747 | { | ||
| 12748 | ✗ | stop_sfx(itm.usesound); //if we can't pay the cost, kill the sound. | |
| 12749 | //last_cane_of_byrna_item_id = -1; //no, we'd do this in a byrna cleanup function. | ||
| 12750 | ✗ | return false; | |
| 12751 | } | ||
| 12752 | |||
| 12753 | 2 | paymagiccost(itemid); | |
| 12754 | 2 | start_cooldown(itemid); | |
| 12755 | |||
| 12756 | 2 | last_cane_of_byrna_item_id = itemid; | |
| 12757 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 2 times.
|
4 | for(int32_t i=0; i<itm.misc3; i++) |
| 12758 | { | ||
| 12759 | //byrna weapons are added here | ||
| 12760 | //space them apart | ||
| 12761 | //the iterator isn passed to 'type'. weapons.cpp converts thisd to | ||
| 12762 | //'quantity_iterator' pn construction; and this is used for orbit initial spacing. | ||
| 12763 |
6/12✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 2 times.
✗ Branch 11 not taken.
|
2 | Lwpns.add(new weapon((zfix)wx,(zfix)wy,(zfix)wz,wCByrna,i,itm.power*game->get_hero_dmgmult(),dir,itemid,getUID(),false,false,true)); |
| 12764 | 2 | } | |
| 12765 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if(!(Lwpns.idCount(wCByrna))) |
| 12766 | ✗ | stop_sfx(itm.usesound); //If we can't create the beams, kill the sound. | |
| 12767 | } | ||
| 12768 | 2 | break; | |
| 12769 | |||
| 12770 | case itype_clock: | ||
| 12771 | { | ||
| 12772 | ✗ | ret = false; | |
| 12773 | ✗ | if(!(itm.flags & item_flag1)) | |
| 12774 | ✗ | break; //Passive clock, don't use | |
| 12775 | ✗ | if((itm.flags & item_flag2) && watch) //"Can't activate while clock active" | |
| 12776 | ✗ | break; | |
| 12777 | ✗ | if(!(checkbunny(itemid) && checkmagiccost(itemid))) //cost/bunny check | |
| 12778 | { | ||
| 12779 | ✗ | return item_error(); | |
| 12780 | } | ||
| 12781 | |||
| 12782 | ✗ | paymagiccost(itemid); | |
| 12783 | ✗ | start_cooldown(itemid); | |
| 12784 | |||
| 12785 | ✗ | setClock(watch=true); | |
| 12786 | |||
| 12787 | ✗ | clock_zoras.clear(); | |
| 12788 | |||
| 12789 | ✗ | clockclk=itm.misc1; | |
| 12790 | ✗ | sfx(itm.usesound); | |
| 12791 | ✗ | break; | |
| 12792 | } | ||
| 12793 | case itype_killem: | ||
| 12794 | { | ||
| 12795 | ✗ | ret = false; | |
| 12796 | ✗ | if(!(itm.flags & item_flag1)) | |
| 12797 | ✗ | break; //Passive killemall, don't use | |
| 12798 | |||
| 12799 | ✗ | if(!(checkbunny(itemid) && checkmagiccost(itemid)) | |
| 12800 | ✗ | || !can_kill_em_all()) //No enemies onscreen | |
| 12801 | { | ||
| 12802 | ✗ | return item_error(); | |
| 12803 | } | ||
| 12804 | |||
| 12805 | ✗ | paymagiccost(itemid); | |
| 12806 | ✗ | start_cooldown(itemid); | |
| 12807 | |||
| 12808 | ✗ | kill_em_all(); | |
| 12809 | ✗ | sfx(itm.usesound); | |
| 12810 | ✗ | break; | |
| 12811 | } | ||
| 12812 | case itype_refill: | ||
| 12813 | { | ||
| 12814 | ✗ | if(!(checkbunny(itemid) && checkmagiccost(itemid))) | |
| 12815 | { | ||
| 12816 | ✗ | return item_error(); | |
| 12817 | } | ||
| 12818 | |||
| 12819 | ✗ | bool did_something = false; | |
| 12820 | |||
| 12821 | ✗ | if(itm.flags & item_flag1) //Cure sword jinx | |
| 12822 | { | ||
| 12823 | ✗ | if(swordclk) | |
| 12824 | ✗ | did_something = true; | |
| 12825 | ✗ | swordclk = 0; | |
| 12826 | ✗ | verifyAWpn(); | |
| 12827 | ✗ | } | |
| 12828 | ✗ | for(auto q = 0; q < 5; ++q) | |
| 12829 | { | ||
| 12830 | ✗ | auto ctr = itm.misc(q); | |
| 12831 | ✗ | if(unsigned(ctr) >= MAX_COUNTERS) | |
| 12832 | ✗ | continue; | |
| 12833 | ✗ | int16_t amnt = vbound(itm.misc(q+5),-32768,32767); | |
| 12834 | ✗ | if(!amnt) continue; | |
| 12835 | ✗ | bool gradual = itm.flags & item_flag2; | |
| 12836 | ✗ | if(amnt > 0) | |
| 12837 | { | ||
| 12838 | ✗ | if(game->get_counter(ctr) + game->get_dcounter(ctr) >= game->get_maxcounter(ctr)) | |
| 12839 | { | ||
| 12840 | //Can't *do* anything... skip | ||
| 12841 | ✗ | continue; | |
| 12842 | } | ||
| 12843 | ✗ | if(game->get_counter(ctr) >= game->get_maxcounter(ctr)) | |
| 12844 | { | ||
| 12845 | //Can't do anything unless affecting dcounter | ||
| 12846 | ✗ | gradual = true; | |
| 12847 | ✗ | } | |
| 12848 | ✗ | } | |
| 12849 | else //Negative | ||
| 12850 | { | ||
| 12851 | ✗ | if(game->get_counter(ctr) + game->get_dcounter(ctr) <= 0) | |
| 12852 | { | ||
| 12853 | //Can't *do* anything... skip | ||
| 12854 | ✗ | continue; | |
| 12855 | } | ||
| 12856 | ✗ | if(game->get_counter(ctr) <= 0) | |
| 12857 | { | ||
| 12858 | //Can't do anything unless affecting dcounter | ||
| 12859 | ✗ | gradual = true; | |
| 12860 | ✗ | } | |
| 12861 | } | ||
| 12862 | ✗ | did_something = true; | |
| 12863 | ✗ | if(gradual) //Gradual | |
| 12864 | { | ||
| 12865 | ✗ | game->change_dcounter(amnt, ctr); | |
| 12866 | ✗ | } | |
| 12867 | else | ||
| 12868 | { | ||
| 12869 | ✗ | game->change_counter(amnt, ctr); | |
| 12870 | } | ||
| 12871 | ✗ | } | |
| 12872 | ✗ | if(!did_something) | |
| 12873 | { | ||
| 12874 | ✗ | return item_error(); | |
| 12875 | } | ||
| 12876 | ✗ | paymagiccost(itemid); | |
| 12877 | ✗ | start_cooldown(itemid); | |
| 12878 | ✗ | sfx(itm.usesound); | |
| 12879 | ✗ | ret = false; | |
| 12880 | ✗ | break; | |
| 12881 | } | ||
| 12882 | |||
| 12883 | case itype_lens: | ||
| 12884 | // don't start cooldown here, it's activated elsewhere | ||
| 12885 | 639 | ret = false; | |
| 12886 | 639 | break; | |
| 12887 | case itype_shield: | ||
| 12888 | ✗ | if (!(itm.flags & item_flag9)) // don't start cooldown here for active shields | |
| 12889 | ✗ | start_cooldown(itemid); | |
| 12890 | ✗ | ret = false; | |
| 12891 | ✗ | break; | |
| 12892 | default: | ||
| 12893 | 1174 | start_cooldown(itemid); | |
| 12894 | 1174 | ret = false; | |
| 12895 | 1174 | break; | |
| 12896 | } | ||
| 12897 | |||
| 12898 |
2/2✓ Branch 0 taken 41888 times.
✓ Branch 1 taken 35 times.
|
41923 | if(itm.flags & item_downgrade) |
| 12899 | { | ||
| 12900 | 35 | game->set_item(itemid,false); | |
| 12901 | |||
| 12902 | // Maybe Item Override has allowed the same item in both slots? | ||
| 12903 |
1/2✓ Branch 0 taken 35 times.
✗ Branch 1 not taken.
|
35 | if(Bwpn == itemid) |
| 12904 | { | ||
| 12905 | ✗ | Bwpn = -1; | |
| 12906 | ✗ | game->forced_bwpn = -1; | |
| 12907 | ✗ | verifyBWpn(); | |
| 12908 | ✗ | } | |
| 12909 | |||
| 12910 |
1/2✓ Branch 0 taken 35 times.
✗ Branch 1 not taken.
|
35 | if(Awpn == itemid) |
| 12911 | { | ||
| 12912 | ✗ | Awpn = -1; | |
| 12913 | ✗ | game->forced_awpn = -1; | |
| 12914 | ✗ | verifyAWpn(); | |
| 12915 | ✗ | } | |
| 12916 | |||
| 12917 |
1/2✓ Branch 0 taken 35 times.
✗ Branch 1 not taken.
|
35 | if(Xwpn == itemid) |
| 12918 | { | ||
| 12919 | ✗ | Xwpn = -1; | |
| 12920 | ✗ | game->forced_xwpn = -1; | |
| 12921 | ✗ | verifyXWpn(); | |
| 12922 | ✗ | } | |
| 12923 | |||
| 12924 |
1/2✓ Branch 0 taken 35 times.
✗ Branch 1 not taken.
|
35 | if(Ywpn == itemid) |
| 12925 | { | ||
| 12926 | ✗ | Ywpn = -1; | |
| 12927 | ✗ | game->forced_ywpn = -1; | |
| 12928 | ✗ | verifyYWpn(); | |
| 12929 | ✗ | } | |
| 12930 | 35 | } | |
| 12931 | |||
| 12932 | 41923 | return ret; | |
| 12933 | 47641 | } | |
| 12934 | 68359482 | bool HeroClass::on_cooldown(int32_t itemid) | |
| 12935 | { | ||
| 12936 |
3/4✓ Branch 0 taken 39100346 times.
✓ Branch 1 taken 29259136 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 39100346 times.
|
68359482 | if (itemid < 0 || itemid >= MAXITEMS) return false; |
| 12937 | 39100346 | return item_cooldown[itemid]; | |
| 12938 | 68359482 | } | |
| 12939 | 42435 | void HeroClass::start_cooldown(int32_t itemid) | |
| 12940 | { | ||
| 12941 |
2/4✓ Branch 0 taken 42435 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 42435 times.
|
42435 | if (itemid < 0 || itemid >= MAXITEMS) return; |
| 12942 |
1/2✓ Branch 0 taken 42435 times.
✗ Branch 1 not taken.
|
42435 | if (item_cooldown[itemid] < 0) return; // set to perma-cooldown (via script, presumably) |
| 12943 | 42435 | auto cd_data = calc_item_cooldown(itemid); | |
| 12944 |
1/2✓ Branch 0 taken 42435 times.
✗ Branch 1 not taken.
|
42435 | if(cd_data.max_cooldown <= 0) return; |
| 12945 | ✗ | if(cd_data.max_cooldown > item_cooldown[itemid]) | |
| 12946 | { | ||
| 12947 | ✗ | item_cooldown[itemid] = cd_data.max_cooldown; | |
| 12948 | ✗ | paymagiccost(cd_data.cooldown_ring_id); | |
| 12949 | ✗ | } | |
| 12950 | ✗ | else if(cd_data.base_cooldown > item_cooldown[itemid]) // cd ring still *did something*, so still pay | |
| 12951 | ✗ | paymagiccost(cd_data.cooldown_ring_id); | |
| 12952 | 42435 | } | |
| 12953 | |||
| 12954 | 1938697 | bool HeroClass::doattack() | |
| 12955 | { | ||
| 12956 |
3/4✓ Branch 0 taken 17 times.
✓ Branch 1 taken 1938680 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 17 times.
|
1938697 | if(lift_wpn && (liftflags & LIFTFL_DIS_ITEMS)) |
| 12957 | 17 | return false; | |
| 12958 | //int32_t s = BSZ ? 0 : 11; | ||
| 12959 | 1938680 | int32_t s = (zinit.heroAnimationStyle==las_bszelda) ? 0 : 11; | |
| 12960 | |||
| 12961 |
4/4✓ Branch 0 taken 557893 times.
✓ Branch 1 taken 1380787 times.
✓ Branch 2 taken 557749 times.
✓ Branch 3 taken 144 times.
|
1938680 | int32_t bugnetid = (directWpn>-1 && itemsbuf[directWpn].type==itype_bugnet) ? directWpn : current_item_id(itype_bugnet); |
| 12962 |
3/4✓ Branch 0 taken 144 times.
✓ Branch 1 taken 1938536 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 144 times.
|
1938680 | if(attack==wBugNet && bugnetid!=-1) |
| 12963 | { | ||
| 12964 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 138 times.
|
144 | if(++attackclk >= NET_CLK_TOTAL) |
| 12965 | 6 | return false; | |
| 12966 | |||
| 12967 | 138 | return true; | |
| 12968 | } | ||
| 12969 | |||
| 12970 | // Abort attack if attackclk has run out and: | ||
| 12971 | // * the attack is not Hammer, Sword with Spin Scroll, Candle, or Wand, OR | ||
| 12972 | // * you aren't holding down the A button, you're not charging, and/or you're still spinning | ||
| 12973 | |||
| 12974 |
6/6✓ Branch 0 taken 197753 times.
✓ Branch 1 taken 1740783 times.
✓ Branch 2 taken 159744 times.
✓ Branch 3 taken 38009 times.
✓ Branch 4 taken 59575 times.
✓ Branch 5 taken 21162 times.
|
2019273 | if(attackclk>=(spins>0?8:14) && attack!=wHammer && |
| 12975 |
12/12✓ Branch 0 taken 146986 times.
✓ Branch 1 taken 12758 times.
✓ Branch 2 taken 77523 times.
✓ Branch 3 taken 69463 times.
✓ Branch 4 taken 80428 times.
✓ Branch 5 taken 79316 times.
✓ Branch 6 taken 79007 times.
✓ Branch 7 taken 1421 times.
✓ Branch 8 taken 77480 times.
✓ Branch 9 taken 3257 times.
✓ Branch 10 taken 58922 times.
✓ Branch 11 taken 18558 times.
|
159744 | (((attack!=wSword || !current_item(itype_spinscroll) || inlikelike) && attack!=wWand && attack!=wFire && attack!=wCByrna) || !((attack==wSword && isWpnPressed(itype_sword) && spins==0) || charging>0))) |
| 12976 | { | ||
| 12977 | 100169 | tapping=false; | |
| 12978 | 100169 | return false; | |
| 12979 | } | ||
| 12980 | |||
| 12981 |
2/2✓ Branch 0 taken 2461 times.
✓ Branch 1 taken 1835906 times.
|
1838367 | if(attackclk>29) |
| 12982 | { | ||
| 12983 | 2461 | tapping=false; | |
| 12984 | 2461 | return false; | |
| 12985 | } | ||
| 12986 | |||
| 12987 |
4/4✓ Branch 0 taken 535975 times.
✓ Branch 1 taken 1299931 times.
✓ Branch 2 taken 507231 times.
✓ Branch 3 taken 28744 times.
|
1835906 | int32_t candleid = (directWpn>-1 && itemsbuf[directWpn].type==itype_candle) ? directWpn : current_item_id(itype_candle); |
| 12988 |
4/4✓ Branch 0 taken 535975 times.
✓ Branch 1 taken 1299931 times.
✓ Branch 2 taken 535945 times.
✓ Branch 3 taken 30 times.
|
1835906 | int32_t byrnaid = (directWpn>-1 && itemsbuf[directWpn].type==itype_cbyrna) ? directWpn : current_item_id(itype_cbyrna); |
| 12989 | // An attack can be "walked out-of" after 8 frames, unless it's: | ||
| 12990 | // * a sword stab | ||
| 12991 | // * a hammer pound | ||
| 12992 | // * a wand thrust | ||
| 12993 | // * a candle thrust | ||
| 12994 | // * a cane thrust | ||
| 12995 | // In which case it should continue. | ||
| 12996 |
8/8✓ Branch 0 taken 69920 times.
✓ Branch 1 taken 1765986 times.
✓ Branch 2 taken 205843 times.
✓ Branch 3 taken 135923 times.
✓ Branch 4 taken 1701148 times.
✓ Branch 5 taken 200761 times.
✓ Branch 6 taken 378167 times.
✓ Branch 7 taken 1322981 times.
|
2143257 | if((attack==wCatching && attackclk>4)||(attack!=wWand && attack!=wSword && attack!=wHammer |
| 12997 |
5/6✓ Branch 0 taken 308039 times.
✓ Branch 1 taken 70128 times.
✓ Branch 2 taken 27721 times.
✓ Branch 3 taken 280318 times.
✓ Branch 4 taken 27721 times.
✗ Branch 5 not taken.
|
378167 | && (attack!=wFire || (candleid!=-1 && !(itemsbuf[candleid].wpn))) |
| 12998 |
3/4✓ Branch 0 taken 30 times.
✓ Branch 1 taken 280288 times.
✓ Branch 2 taken 30 times.
✗ Branch 3 not taken.
|
308039 | && (attack!=wCByrna || (byrnaid!=-1 && !(itemsbuf[byrnaid].wpn))) |
| 12999 |
2/2✓ Branch 0 taken 307351 times.
✓ Branch 1 taken 27063 times.
|
280318 | && (attack != wBugNet) && attackclk>7)) |
| 13000 | { | ||
| 13001 |
8/8✓ Branch 0 taken 96525 times.
✓ Branch 1 taken 4983 times.
✓ Branch 2 taken 91777 times.
✓ Branch 3 taken 4748 times.
✓ Branch 4 taken 86421 times.
✓ Branch 5 taken 5356 times.
✓ Branch 6 taken 5838 times.
✓ Branch 7 taken 80583 times.
|
513194 | if (getInput(btnUp, INPUT_DRUNK | INPUT_HERO_ACTION) || getInput(btnDown, INPUT_DRUNK | INPUT_HERO_ACTION) || getInput(btnLeft, INPUT_DRUNK | INPUT_HERO_ACTION) || getInput(btnRight, INPUT_DRUNK | INPUT_HERO_ACTION)) |
| 13002 | { | ||
| 13003 | 20925 | lstep = s; | |
| 13004 | 20925 | return false; | |
| 13005 | } | ||
| 13006 | 80583 | } | |
| 13007 | |||
| 13008 |
2/2✓ Branch 0 taken 48853 times.
✓ Branch 1 taken 1680414 times.
|
1729267 | if(charging==0) |
| 13009 | { | ||
| 13010 | 1680414 | lstep=0; | |
| 13011 | 1680414 | } | |
| 13012 | |||
| 13013 | // Work out the sword charge-up delay | ||
| 13014 | 1729267 | int32_t magiccharge = 192, normalcharge = 64; | |
| 13015 | 1729267 | int32_t itemid = current_item_id(itype_chargering); | |
| 13016 | |||
| 13017 |
2/2✓ Branch 0 taken 1678071 times.
✓ Branch 1 taken 51196 times.
|
1729267 | if(itemid>=0) |
| 13018 | { | ||
| 13019 |
1/2✓ Branch 0 taken 51196 times.
✗ Branch 1 not taken.
|
51196 | normalcharge = (itemsbuf[itemid].misc1>0)?itemsbuf[itemid].misc1:64; |
| 13020 |
1/2✓ Branch 0 taken 51196 times.
✗ Branch 1 not taken.
|
51196 | magiccharge = (itemsbuf[itemid].misc2>normalcharge)?itemsbuf[itemid].misc2:192; |
| 13021 | 51196 | } | |
| 13022 | |||
| 13023 | 1729267 | int scrollid = current_item_id(attack==wHammer ? itype_quakescroll : itype_spinscroll); | |
| 13024 | 1729267 | int scroll2id = current_item_id(attack==wHammer ? itype_quakescroll2 : itype_spinscroll2); | |
| 13025 | |||
| 13026 | 1729267 | bool doCharge=true; | |
| 13027 |
3/4✓ Branch 0 taken 150 times.
✓ Branch 1 taken 1729117 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 150 times.
|
1729267 | if(z!=0 && fakez != 0) |
| 13028 | ✗ | doCharge=false; | |
| 13029 |
2/2✓ Branch 0 taken 1322981 times.
✓ Branch 1 taken 406286 times.
|
1729267 | if(attack==wSword) |
| 13030 | { | ||
| 13031 |
4/4✓ Branch 0 taken 40996 times.
✓ Branch 1 taken 1281985 times.
✓ Branch 2 taken 704 times.
✓ Branch 3 taken 40292 times.
|
1322981 | if(!(attackclk==SWORDCHARGEFRAME && isWpnPressed(itype_sword))) |
| 13032 | 1282689 | doCharge=false; | |
| 13033 |
2/2✓ Branch 0 taken 12092 times.
✓ Branch 1 taken 28200 times.
|
40292 | else if(charging<=normalcharge) |
| 13034 | { | ||
| 13035 |
3/6✓ Branch 0 taken 28200 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 28200 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 28200 times.
✗ Branch 5 not taken.
|
28200 | if(scrollid<0 || !(checkbunny(scrollid) && checkmagiccost(scrollid))) |
| 13036 | ✗ | doCharge=false; | |
| 13037 | 28200 | } | |
| 13038 | 1322981 | } | |
| 13039 |
2/2✓ Branch 0 taken 70128 times.
✓ Branch 1 taken 336158 times.
|
406286 | else if(attack==wHammer) |
| 13040 | { | ||
| 13041 |
4/4✓ Branch 0 taken 3511 times.
✓ Branch 1 taken 66617 times.
✓ Branch 2 taken 2101 times.
✓ Branch 3 taken 1410 times.
|
70128 | if(!(attackclk==HAMMERCHARGEFRAME && isWpnPressed(itype_hammer))) |
| 13042 | 68718 | doCharge=false; | |
| 13043 |
2/2✓ Branch 0 taken 214 times.
✓ Branch 1 taken 1196 times.
|
1410 | else if(charging<=normalcharge) |
| 13044 | { | ||
| 13045 |
4/6✓ Branch 0 taken 969 times.
✓ Branch 1 taken 227 times.
✓ Branch 2 taken 969 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 969 times.
✗ Branch 5 not taken.
|
1196 | if(scrollid<0 || !(checkbunny(scrollid) && checkmagiccost(scrollid))) |
| 13046 | 227 | doCharge=false; | |
| 13047 | 1196 | } | |
| 13048 | 70128 | } | |
| 13049 | else | ||
| 13050 | 336158 | doCharge=false; | |
| 13051 | |||
| 13052 | // charging up weapon... | ||
| 13053 |
2/2✓ Branch 0 taken 41475 times.
✓ Branch 1 taken 1687792 times.
|
1729267 | if(doCharge) |
| 13054 | { | ||
| 13055 | // Increase charging while holding down button. | ||
| 13056 |
3/4✓ Branch 0 taken 41475 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2732 times.
✓ Branch 3 taken 38743 times.
|
41475 | if(spins==0 && charging<magiccharge) |
| 13057 | 38743 | charging++; | |
| 13058 | |||
| 13059 | // Once a charging threshold is reached, play the sound. | ||
| 13060 |
2/2✓ Branch 0 taken 213 times.
✓ Branch 1 taken 41262 times.
|
41475 | if(charging==normalcharge) |
| 13061 | { | ||
| 13062 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 213 times.
|
213 | if(!(itemsbuf[scrollid].flags&item_flag1)) |
| 13063 | 213 | paymagiccost(scrollid); | |
| 13064 | 213 | sfx(itemsbuf[scrollid].usesound2,pan(x)); | |
| 13065 | 213 | } | |
| 13066 |
2/2✓ Branch 0 taken 38633 times.
✓ Branch 1 taken 2629 times.
|
41262 | else if(charging==magiccharge) |
| 13067 | { | ||
| 13068 |
4/6✓ Branch 0 taken 3 times.
✓ Branch 1 taken 2626 times.
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 3 times.
|
2629 | if(scroll2id>-1 && checkbunny(scroll2id) && checkmagiccost(scroll2id)) |
| 13069 | { | ||
| 13070 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | if(!(itemsbuf[scroll2id].flags&item_flag1)) |
| 13071 | 3 | paymagiccost(scroll2id); | |
| 13072 | 3 | charging++; // charging>magiccharge signifies a successful supercharge. | |
| 13073 | 3 | sfx(itemsbuf[scroll2id].usesound2,pan(x)); | |
| 13074 | 3 | } | |
| 13075 | 2629 | } | |
| 13076 | 41475 | } | |
| 13077 |
3/4✓ Branch 0 taken 30 times.
✓ Branch 1 taken 1687762 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 30 times.
|
1687792 | else if(attack==wCByrna && byrnaid!=-1) |
| 13078 | { | ||
| 13079 |
1/2✓ Branch 0 taken 30 times.
✗ Branch 1 not taken.
|
30 | if(!(itemsbuf[byrnaid].wpn)) |
| 13080 | { | ||
| 13081 | ✗ | attack = wNone; | |
| 13082 | ✗ | return startwpn(attackid); // Beam if the Byrna stab animation WASN'T used. | |
| 13083 | } | ||
| 13084 | |||
| 13085 | 30 | bool beamcount = false; | |
| 13086 | |||
| 13087 |
2/2✓ Branch 0 taken 26 times.
✓ Branch 1 taken 55 times.
|
81 | for(int32_t i=0; i<Lwpns.Count(); i++) |
| 13088 | { | ||
| 13089 | 55 | weapon *w = ((weapon*)Lwpns.spr(i)); | |
| 13090 | |||
| 13091 |
2/2✓ Branch 0 taken 51 times.
✓ Branch 1 taken 4 times.
|
55 | if(w->id==wCByrna) |
| 13092 | { | ||
| 13093 | 4 | beamcount = true; | |
| 13094 | 4 | break; | |
| 13095 | } | ||
| 13096 | 51 | } | |
| 13097 | |||
| 13098 | // If beams already deployed, remove them | ||
| 13099 |
4/4✓ Branch 0 taken 4 times.
✓ Branch 1 taken 26 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 2 times.
|
30 | if(!attackclk && beamcount) |
| 13100 | { | ||
| 13101 | 2 | return startwpn(attackid); // Remove beams instantly | |
| 13102 | } | ||
| 13103 | |||
| 13104 | // Otherwise, continue | ||
| 13105 | 28 | ++attackclk; | |
| 13106 | 28 | } | |
| 13107 | else | ||
| 13108 | { | ||
| 13109 | 1687762 | ++attackclk; | |
| 13110 | |||
| 13111 |
6/6✓ Branch 0 taken 4443 times.
✓ Branch 1 taken 1683319 times.
✓ Branch 2 taken 855 times.
✓ Branch 3 taken 3588 times.
✓ Branch 4 taken 512 times.
✓ Branch 5 taken 343 times.
|
1687762 | if(attackclk==SWORDCHARGEFRAME && charging>0 && !tapping) //Signifies a tapped enemy |
| 13112 | { | ||
| 13113 | 343 | ++attackclk; // Won't continue charging | |
| 13114 | 343 | charging=0; | |
| 13115 | 343 | } | |
| 13116 | |||
| 13117 | // Faster if spinning. | ||
| 13118 |
2/2✓ Branch 0 taken 1684537 times.
✓ Branch 1 taken 3225 times.
|
1687762 | if(spins>0) |
| 13119 | 3225 | ++attackclk; | |
| 13120 | |||
| 13121 | // Even faster if hurricane spinning. | ||
| 13122 |
2/2✓ Branch 0 taken 1687330 times.
✓ Branch 1 taken 432 times.
|
1687762 | if(spins>5) |
| 13123 | 432 | attackclk+=2; | |
| 13124 | |||
| 13125 | // If at a charging threshold, do a charged attack. | ||
| 13126 |
6/6✓ Branch 0 taken 2457 times.
✓ Branch 1 taken 1685305 times.
✓ Branch 2 taken 2445 times.
✓ Branch 3 taken 12 times.
✓ Branch 4 taken 2307 times.
✓ Branch 5 taken 150 times.
|
1687762 | if(charging>=normalcharge && (attack!=wSword || attackclk>=SWORDCHARGEFRAME) && !tapping) |
| 13127 | { | ||
| 13128 |
2/2✓ Branch 0 taken 138 times.
✓ Branch 1 taken 12 times.
|
150 | if(attack==wSword) |
| 13129 | { | ||
| 13130 |
2/2✓ Branch 0 taken 135 times.
✓ Branch 1 taken 3 times.
|
138 | bool super = charging>magiccharge && scroll2id > -1; |
| 13131 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 135 times.
|
138 | int id = super ? scroll2id : scrollid; |
| 13132 | 138 | itemdata const& spinscroll = itemsbuf[id]; | |
| 13133 | 138 | bool paid = !(spinscroll.flags&item_flag1); | |
| 13134 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 138 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
138 | if(!paid && checkbunny(id) && checkmagiccost(id)) |
| 13135 | { | ||
| 13136 | ✗ | paid = true; | |
| 13137 | ✗ | paymagiccost(id); | |
| 13138 | ✗ | } | |
| 13139 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 138 times.
|
138 | if(paid) |
| 13140 | { | ||
| 13141 | 138 | currentscroll = id; | |
| 13142 | 138 | spins=(spinscroll.misc1*4) + (super ? -3 : 1); | |
| 13143 | 138 | attackclk=1; | |
| 13144 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 114 times.
|
138 | if(!get_qr(qr_BROKEN_SWORD_SPIN_TRIGGERS)) |
| 13145 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24 times.
|
48 | if(weapon* w = find_first_wtype(wSword)) |
| 13146 | 24 | w->reset_wgrids(); | |
| 13147 | 138 | sfx(spinscroll.usesound,pan(x)); | |
| 13148 |
1/2✓ Branch 0 taken 138 times.
✗ Branch 1 not taken.
|
138 | if(spinscroll.flags&item_flag1) |
| 13149 | ✗ | paymagiccost(id); | |
| 13150 | 138 | } | |
| 13151 | 138 | } | |
| 13152 |
2/4✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 12 times.
|
12 | else if(attack==wHammer && sideviewhammerpound()) |
| 13153 | { | ||
| 13154 |
1/2✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
|
12 | bool super = charging>magiccharge && scroll2id > -1; |
| 13155 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
|
12 | int id = super ? scroll2id : scrollid; |
| 13156 | 12 | itemdata const& quakescroll = itemsbuf[id]; | |
| 13157 | 12 | bool paid = !(quakescroll.flags&item_flag1); | |
| 13158 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
12 | if(!paid && checkbunny(id) && checkmagiccost(id)) |
| 13159 | { | ||
| 13160 | ✗ | paid = true; | |
| 13161 | ✗ | paymagiccost(id); | |
| 13162 | ✗ | } | |
| 13163 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
|
12 | if(paid) |
| 13164 | { | ||
| 13165 | 12 | currentscroll = id; | |
| 13166 | 12 | spins = super ? 2 : 1; | |
| 13167 | 12 | sfx(quakescroll.usesound,pan(x)); | |
| 13168 | 12 | quakeclk=quakescroll.misc1; | |
| 13169 | |||
| 13170 | // general area stun | ||
| 13171 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 12 times.
|
36 | for(int32_t i=0; i<GuyCount(); i++) |
| 13172 | { | ||
| 13173 |
2/2✓ Branch 0 taken 11 times.
✓ Branch 1 taken 13 times.
|
24 | if(!isflier(GuyID(i))) |
| 13174 | { | ||
| 13175 | 13 | StunGuy(i,quakescroll.misc2-distance(x,y,GuyX(i),GuyY(i))); | |
| 13176 | 13 | } | |
| 13177 | 24 | } | |
| 13178 | |||
| 13179 |
2/4✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 12 times.
|
12 | int hmrid = (directWpn>-1 && itemsbuf[directWpn].type==itype_hammer) ? directWpn : current_item_id(itype_hammer); |
| 13180 |
1/2✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
|
12 | int hmrlvl = hmrid < 0 ? 1 : itemsbuf[hmrid].level; |
| 13181 |
1/2✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
|
12 | if(hmrlvl < 1) hmrlvl = 1; |
| 13182 | 12 | int rad = quakescroll.misc2; | |
| 13183 | 10581 | for_every_combo([&](const auto& handle) { | |
| 13184 | 31707 | auto [cx, cy] = handle.xy(); | |
| 13185 |
9/12✓ Branch 0 taken 8065 times.
✓ Branch 1 taken 2495 times.
✓ Branch 2 taken 8065 times.
✓ Branch 3 taken 2495 times.
✓ Branch 4 taken 8065 times.
✓ Branch 5 taken 2495 times.
✓ Branch 6 taken 9 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 9 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 9 times.
✗ Branch 11 not taken.
|
31707 | if (distance(x, y, cx, cy) > rad) |
| 13186 | 8074 | return; | |
| 13187 | |||
| 13188 |
1/4✓ Branch 0 taken 2495 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
2495 | vector<int> trigflags = {TRIGFLAG_QUAKESTUN}; |
| 13189 |
1/8✓ Branch 0 taken 2495 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
2495 | if(super) trigflags.push_back(TRIGFLAG_SQUAKESTUN); |
| 13190 |
1/4✓ Branch 0 taken 2495 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
2654 | trig_each_combo_trigger(handle, [&](combo_trigger const& trig){ |
| 13191 |
2/4✓ Branch 0 taken 11 times.
✓ Branch 1 taken 148 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
159 | if(!trig.trigger_flags.any(trigflags)) return false; |
| 13192 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 148 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
148 | return (trig.trigger_flags.get(TRIGFLAG_INVERTMINMAX) |
| 13193 | 148 | ? hmrlvl <= trig.triggerlevel : hmrlvl >= trig.triggerlevel); | |
| 13194 | 159 | }); | |
| 13195 | 10569 | }); | |
| 13196 | 12 | } | |
| 13197 | 12 | } | |
| 13198 | 150 | } | |
| 13199 |
6/6✓ Branch 0 taken 4318 times.
✓ Branch 1 taken 1683294 times.
✓ Branch 2 taken 3806 times.
✓ Branch 3 taken 512 times.
✓ Branch 4 taken 347 times.
✓ Branch 5 taken 3459 times.
|
1687612 | else if(tapping && attackclk<SWORDCHARGEFRAME && charging<magiccharge) |
| 13200 | 3459 | charging++; | |
| 13201 | |||
| 13202 |
7/8✓ Branch 0 taken 26954 times.
✓ Branch 1 taken 1660808 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1660808 times.
✓ Branch 4 taken 25736 times.
✓ Branch 5 taken 1635072 times.
✓ Branch 6 taken 950327 times.
✓ Branch 7 taken 737435 times.
|
1687762 | if(!isWpnPressed(attack==wFire ? itype_candle : attack==wCByrna ? itype_cbyrna : attack==wWand ? itype_wand : attack==wHammer ? itype_hammer : itype_sword)) |
| 13203 | 737435 | charging=0; | |
| 13204 | |||
| 13205 |
2/2✓ Branch 0 taken 1657837 times.
✓ Branch 1 taken 29925 times.
|
1687762 | if(attackclk>=SWORDCHARGEFRAME) |
| 13206 | 29925 | tapping = false; | |
| 13207 | } | ||
| 13208 | |||
| 13209 |
7/8✓ Branch 0 taken 131155 times.
✓ Branch 1 taken 1598110 times.
✓ Branch 2 taken 2345 times.
✓ Branch 3 taken 128810 times.
✓ Branch 4 taken 2345 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 47 times.
✓ Branch 7 taken 2298 times.
|
1729265 | if(attackclk==1 && attack==wFire && candleid!=-1 && !(itemsbuf[candleid].wpn)) |
| 13210 | { | ||
| 13211 | 2298 | return startwpn(attackid); // Flame if the Candle stab animation WASN'T used. | |
| 13212 | } | ||
| 13213 | |||
| 13214 | 1726967 | int32_t crossid = current_item_id(itype_crossscroll); //has Cross Beams scroll | |
| 13215 | |||
| 13216 |
11/14✓ Branch 0 taken 1622559 times.
✓ Branch 1 taken 104408 times.
✓ Branch 2 taken 119582 times.
✓ Branch 3 taken 1502977 times.
✓ Branch 4 taken 538 times.
✓ Branch 5 taken 119044 times.
✓ Branch 6 taken 538 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 20 times.
✓ Branch 9 taken 518 times.
✓ Branch 10 taken 20 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 20 times.
✗ Branch 13 not taken.
|
1726967 | if(attackclk==13 || (attackclk==7 && spins>1 && attack != wHammer && crossid >=0 && checkbunny(crossid) && checkmagiccost(crossid))) |
| 13217 | { | ||
| 13218 | |||
| 13219 |
4/4✓ Branch 0 taken 22596 times.
✓ Branch 1 taken 81832 times.
✓ Branch 2 taken 15443 times.
✓ Branch 3 taken 7153 times.
|
104428 | int32_t wpnid = (directWpn>-1 && itemsbuf[directWpn].type==itype_sword) ? directWpn : current_item_id(itype_sword); |
| 13220 |
2/2✓ Branch 0 taken 104025 times.
✓ Branch 1 taken 403 times.
|
104428 | int64_t templife = wpnid>=0? itemsbuf[wpnid].misc1 : 0; |
| 13221 | |||
| 13222 |
4/4✓ Branch 0 taken 104025 times.
✓ Branch 1 taken 403 times.
✓ Branch 2 taken 27092 times.
✓ Branch 3 taken 76933 times.
|
104428 | if(wpnid>=0 && itemsbuf[wpnid].flags & item_flag1) |
| 13223 | { | ||
| 13224 | 76933 | templife=templife*game->get_maxlife(); | |
| 13225 | 76933 | templife=templife/100; | |
| 13226 | 76933 | } | |
| 13227 | else | ||
| 13228 | { | ||
| 13229 | 27495 | templife*=game->get_hp_per_heart(); | |
| 13230 | } | ||
| 13231 | |||
| 13232 |
2/2✓ Branch 0 taken 41239 times.
✓ Branch 1 taken 63189 times.
|
104428 | bool normalbeam = (int64_t(game->get_life())+(get_qr(qr_QUARTERHEART)?((game->get_hp_per_heart()/4)-1):((game->get_hp_per_heart()/2)-1))>=templife); |
| 13233 | 104428 | int32_t perilid = current_item_id(itype_perilscroll); | |
| 13234 |
3/4✓ Branch 0 taken 7608 times.
✓ Branch 1 taken 96820 times.
✓ Branch 2 taken 7608 times.
✗ Branch 3 not taken.
|
104499 | bool perilbeam = (perilid>=0 && wpnid>=0 && game->get_life()<=itemsbuf[perilid].misc1*game->get_hp_per_heart() |
| 13235 |
3/4✓ Branch 0 taken 71 times.
✓ Branch 1 taken 7537 times.
✓ Branch 2 taken 71 times.
✗ Branch 3 not taken.
|
7608 | && checkbunny(perilid) && checkmagiccost(perilid) |
| 13236 | // Must actually be able to shoot sword beams | ||
| 13237 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 71 times.
|
71 | && ((itemsbuf[wpnid].flags & item_flag1) |
| 13238 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 70 times.
|
71 | || itemsbuf[wpnid].misc1 <= game->get_maxlife()/game->get_hp_per_heart())); |
| 13239 | |||
| 13240 |
4/4✓ Branch 0 taken 88821 times.
✓ Branch 1 taken 15607 times.
✓ Branch 2 taken 565 times.
✓ Branch 3 taken 88256 times.
|
104428 | if(attack==wSword && !tapping) |
| 13241 | { | ||
| 13242 |
4/4✓ Branch 0 taken 88187 times.
✓ Branch 1 taken 69 times.
✓ Branch 2 taken 20024 times.
✓ Branch 3 taken 68163 times.
|
88256 | if(perilbeam || normalbeam) |
| 13243 | { | ||
| 13244 |
1/2✓ Branch 0 taken 20093 times.
✗ Branch 1 not taken.
|
20093 | if(attackclk==7) |
| 13245 | ✗ | paymagiccost(crossid); // Pay the Cross Beams magic cost. | |
| 13246 | |||
| 13247 |
3/4✓ Branch 0 taken 69 times.
✓ Branch 1 taken 20024 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 69 times.
|
20093 | if(perilbeam && !normalbeam) |
| 13248 | 69 | paymagiccost(perilid); // Pay the Peril Beam magic cost. | |
| 13249 | |||
| 13250 | // TODO: Something that would be cheap but disgraceful to hack in at this point is | ||
| 13251 | // a way to make the peril/cross beam item's power stat influence the strength | ||
| 13252 | // of the peril/cross beam... | ||
| 13253 | 20093 | startwpn(attackid); | |
| 13254 | 20093 | } | |
| 13255 | 68163 | else misc_internal_hero_flags &= ~LF_PAID_SWORD_COST; | |
| 13256 | 88256 | } | |
| 13257 | |||
| 13258 |
2/2✓ Branch 0 taken 102591 times.
✓ Branch 1 taken 1837 times.
|
104428 | if(attack==wWand) |
| 13259 | 1837 | startwpn(attackid); // Flame if the Wand stab animation WAS used (it always is). | |
| 13260 | |||
| 13261 |
5/6✓ Branch 0 taken 1470 times.
✓ Branch 1 taken 102958 times.
✓ Branch 2 taken 1470 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1423 times.
✓ Branch 5 taken 47 times.
|
104428 | if(attack==wFire && candleid!=-1 && itemsbuf[candleid].wpn) // Flame if the Candle stab animation WAS used. |
| 13262 | 47 | startwpn(attackid); | |
| 13263 | |||
| 13264 |
4/6✓ Branch 0 taken 2 times.
✓ Branch 1 taken 104426 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
|
104428 | if(attack==wCByrna && byrnaid!=-1 && itemsbuf[byrnaid].wpn) // Beam if the Byrna stab animation WAS used. |
| 13265 | 2 | startwpn(attackid); | |
| 13266 | 104428 | } | |
| 13267 | |||
| 13268 |
2/2✓ Branch 0 taken 1623488 times.
✓ Branch 1 taken 103479 times.
|
1726967 | if(attackclk==14) |
| 13269 | 103479 | lstep = s; | |
| 13270 | |||
| 13271 | 1726967 | return true; | |
| 13272 | 1852983 | } | |
| 13273 | |||
| 13274 | 28163496 | bool HeroClass::can_attack() | |
| 13275 | { | ||
| 13276 |
4/4✓ Branch 0 taken 10820 times.
✓ Branch 1 taken 28152676 times.
✓ Branch 2 taken 2880 times.
✓ Branch 3 taken 7940 times.
|
28163496 | if(lift_wpn && (liftflags & LIFTFL_DIS_ITEMS)) |
| 13277 | 7940 | return false; | |
| 13278 |
4/4✓ Branch 0 taken 27831178 times.
✓ Branch 1 taken 324378 times.
✓ Branch 2 taken 18846558 times.
✓ Branch 3 taken 8984620 times.
|
28155556 | int32_t currentSwordOrWand = (itemsbuf[dowpn].type == itype_wand || itemsbuf[dowpn].type == itype_sword)?dowpn:-1; |
| 13279 |
4/6✓ Branch 0 taken 28155556 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 27888462 times.
✓ Branch 3 taken 267094 times.
✓ Branch 4 taken 27888462 times.
✗ Branch 5 not taken.
|
29625462 | if(action==hopping || action==swimming || action==freeze || action==sideswimfreeze |
| 13280 |
5/8✓ Branch 0 taken 27888462 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 27888462 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 27888462 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 27880220 times.
✓ Branch 7 taken 8242 times.
|
27888462 | || lstunclock > 0 || is_conveyor_stunned || spins>0 || usingActiveShield() |
| 13281 |
3/4✓ Branch 0 taken 27880220 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 24383351 times.
✓ Branch 3 taken 3496869 times.
|
27880220 | || ((action==attacking||action==sideswimattacking) |
| 13282 |
2/2✓ Branch 0 taken 775132 times.
✓ Branch 1 taken 27105088 times.
|
27880220 | && ((attack!=wSword && attack!=wWand) || !(itemsbuf[currentSwordOrWand].flags & item_flag5)) |
| 13283 |
2/2✓ Branch 0 taken 27799862 times.
✓ Branch 1 taken 694774 times.
|
27880220 | && charging!=0)) |
| 13284 | { | ||
| 13285 | 1745242 | return false; | |
| 13286 | } | ||
| 13287 | |||
| 13288 | 27799862 | int32_t r = (isdungeon()) ? 16 : 0; | |
| 13289 | 27799862 | int32_t r2 = get_qr(qr_NOBORDER) ? 0 : 8; | |
| 13290 | |||
| 13291 |
4/5✓ Branch 0 taken 8568748 times.
✓ Branch 1 taken 19231114 times.
✓ Branch 2 taken 8488934 times.
✓ Branch 3 taken 10742180 times.
✗ Branch 4 not taken.
|
27799862 | if(!get_qr(qr_ITEMSONEDGES)) switch(dir) |
| 13292 | { | ||
| 13293 | case up: | ||
| 13294 | case down: | ||
| 13295 |
2/2✓ Branch 0 taken 8188910 times.
✓ Branch 1 taken 300024 times.
|
8488934 | return !(y<(r2+r) || y>(world_h-16-r-r2)); |
| 13296 | |||
| 13297 | case left: | ||
| 13298 | case right: | ||
| 13299 |
2/2✓ Branch 0 taken 10453168 times.
✓ Branch 1 taken 289012 times.
|
10742180 | return !(x<(r2+r) || x>(world_w-16-r-r2)); |
| 13300 | ✗ | } | |
| 13301 | |||
| 13302 | 8568748 | return true; | |
| 13303 | 29553044 | } | |
| 13304 | |||
| 13305 | 17070 | bool isRaftFlag(int32_t flag) | |
| 13306 | { | ||
| 13307 |
4/4✓ Branch 0 taken 8825 times.
✓ Branch 1 taken 8245 times.
✓ Branch 2 taken 255 times.
✓ Branch 3 taken 8570 times.
|
17070 | return (flag==mfRAFT || flag==mfRAFT_BRANCH || flag==mfRAFT_BOUNCE); |
| 13308 | } | ||
| 13309 | |||
| 13310 | 8149944 | void handle_lens_triggers(int32_t l_id) | |
| 13311 | { | ||
| 13312 |
2/2✓ Branch 0 taken 8143661 times.
✓ Branch 1 taken 6283 times.
|
8149944 | bool enabled = l_id >= 0 && (itemsbuf[l_id].flags & item_flag6); |
| 13313 | 8149944 | auto& combo_cache = combo_caches::lens; | |
| 13314 | 3693659501 | for_every_combo([&](const auto& handle) { | |
| 13315 | 3685509557 | auto cid = handle.data(); | |
| 13316 | 3685509557 | auto& mini_cmb = combo_cache.minis[cid]; | |
| 13317 |
7/8✓ Branch 0 taken 120384 times.
✓ Branch 1 taken 3682074000 times.
✓ Branch 2 taken 3682194198 times.
✓ Branch 3 taken 186 times.
✓ Branch 4 taken 1596 times.
✓ Branch 5 taken 3313577 times.
✓ Branch 6 taken 3315173 times.
✗ Branch 7 not taken.
|
3685509557 | if (!(enabled ? mini_cmb.on : mini_cmb.off)) |
| 13318 | 3685509371 | return; | |
| 13319 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 186 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
372 | trig_each_combo_trigger(handle, [&](combo_trigger const& trig){ |
| 13320 | 186 | return trig.trigger_flags.get(enabled ? TRIGFLAG_LENSON : TRIGFLAG_LENSOFF); | |
| 13321 | }); | ||
| 13322 | 3685509557 | }); | |
| 13323 | 8149944 | } | |
| 13324 | |||
| 13325 | 14213469 | void do_lens() | |
| 13326 | { | ||
| 13327 |
2/2✓ Branch 0 taken 6063525 times.
✓ Branch 1 taken 8149944 times.
|
14213469 | if ( FFCore.getQuestHeaderInfo(vZelda) < 0x250 ) //2.10 or earlier |
| 13328 | { | ||
| 13329 | 6063525 | do_210_lens(); | |
| 13330 | 6063525 | return; | |
| 13331 | } | ||
| 13332 | |||
| 13333 | 8149944 | int32_t wpnPressed = getWpnPressed(itype_lens); | |
| 13334 |
6/6✓ Branch 0 taken 6280 times.
✓ Branch 1 taken 8143664 times.
✓ Branch 2 taken 376 times.
✓ Branch 3 taken 8143288 times.
✓ Branch 4 taken 391205 times.
✓ Branch 5 taken 7752083 times.
|
8149944 | int32_t itemid = lensid >= 0 ? lensid : wpnPressed>0 ? wpnPressed : Hero.getLastLensID()>0 ? Hero.getLastLensID() : current_item_id(itype_lens); |
| 13335 |
3/4✓ Branch 0 taken 8143664 times.
✓ Branch 1 taken 6280 times.
✓ Branch 2 taken 8143664 times.
✗ Branch 3 not taken.
|
8149944 | if (lensid < 0 && Hero.on_cooldown(itemid)) |
| 13336 | ✗ | itemid = -1; | |
| 13337 |
2/2✓ Branch 0 taken 6581368 times.
✓ Branch 1 taken 1568576 times.
|
8149944 | if(itemid >= 0) |
| 13338 | { | ||
| 13339 |
8/10✓ Branch 0 taken 5364 times.
✓ Branch 1 taken 1563212 times.
✓ Branch 2 taken 5364 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 695 times.
✓ Branch 5 taken 4669 times.
✓ Branch 6 taken 695 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 166 times.
✓ Branch 9 taken 529 times.
|
1568576 | if(isWpnPressed(itype_lens) && checkitem_jinx(itemid) && !lensclk && checkbunny(itemid) && checkmagiccost(itemid)) |
| 13340 | { | ||
| 13341 |
2/2✓ Branch 0 taken 319 times.
✓ Branch 1 taken 210 times.
|
529 | if(lensid<0) |
| 13342 | { | ||
| 13343 | 210 | lensid = itemid; | |
| 13344 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 210 times.
|
210 | if(itemsbuf[itemid].type == itype_lens) |
| 13345 | 210 | Hero.setLastLensID(itemid); | |
| 13346 |
2/2✓ Branch 0 taken 197 times.
✓ Branch 1 taken 13 times.
|
210 | if(get_qr(qr_MORESOUNDS)) sfx(itemsbuf[itemid].usesound); |
| 13347 | 210 | } | |
| 13348 | |||
| 13349 | 529 | paymagiccost(itemid, true); //Needs to ignore timer cause lensclk is our timer. | |
| 13350 | |||
| 13351 |
2/10✓ Branch 0 taken 529 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 529 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
529 | if(itemid>=0 && itemsbuf[itemid].script != 0 && !did_scriptl && !(FFCore.doscript(ScriptType::Item, itemid) && get_qr(qr_ITEMSCRIPTSKEEPRUNNING))) |
| 13352 | { | ||
| 13353 | //clear the item script stack for a new script | ||
| 13354 | ✗ | int i = itemid; | |
| 13355 | ✗ | FFCore.reset_script_engine_data(ScriptType::Item, i); | |
| 13356 | ✗ | ZScriptVersion::RunScript(ScriptType::Item, itemsbuf[i].script, i); | |
| 13357 | ✗ | did_scriptl=true; | |
| 13358 | ✗ | } | |
| 13359 | |||
| 13360 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 529 times.
|
529 | if (itemsbuf[itemid].magiccosttimer[0]) lensclk = itemsbuf[itemid].magiccosttimer[0]; |
| 13361 | 529 | else lensclk = 12; | |
| 13362 | 529 | } | |
| 13363 | else | ||
| 13364 | { | ||
| 13365 | 1568047 | did_scriptl=false; | |
| 13366 |
2/2✓ Branch 0 taken 1562293 times.
✓ Branch 1 taken 5754 times.
|
1568047 | if(!lensclk) |
| 13367 | { | ||
| 13368 | |||
| 13369 |
2/2✓ Branch 0 taken 1562086 times.
✓ Branch 1 taken 207 times.
|
1562293 | if(lensid > -1) |
| 13370 | { | ||
| 13371 | 207 | Hero.start_cooldown(lensid); | |
| 13372 | 207 | lensid = -1; | |
| 13373 | 207 | lensclk = 0; | |
| 13374 | |||
| 13375 |
2/2✓ Branch 0 taken 195 times.
✓ Branch 1 taken 12 times.
|
207 | if(get_qr(qr_MORESOUNDS)) sfx(WAV_ZN1LENSOFF); |
| 13376 | 207 | } | |
| 13377 | 1562293 | } | |
| 13378 | } | ||
| 13379 | 1568576 | } | |
| 13380 | 8149944 | handle_lens_triggers(lensid); | |
| 13381 | 14213469 | } | |
| 13382 | |||
| 13383 | 6063525 | void do_210_lens() | |
| 13384 | { | ||
| 13385 | 6063525 | int32_t wpnPressed = getWpnPressed(itype_lens); | |
| 13386 |
4/4✓ Branch 0 taken 3334 times.
✓ Branch 1 taken 6060191 times.
✓ Branch 2 taken 487 times.
✓ Branch 3 taken 6059704 times.
|
6063525 | int32_t itemid = lensid >= 0 ? lensid : wpnPressed>-1 ? wpnPressed : current_item_id(itype_lens); |
| 13387 |
2/2✓ Branch 0 taken 1226986 times.
✓ Branch 1 taken 4836539 times.
|
6063525 | if(itemid<0) |
| 13388 | 4836539 | return; | |
| 13389 | |||
| 13390 |
7/8✓ Branch 0 taken 3343 times.
✓ Branch 1 taken 1223643 times.
✓ Branch 2 taken 3343 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 522 times.
✓ Branch 5 taken 2821 times.
✓ Branch 6 taken 7 times.
✓ Branch 7 taken 515 times.
|
1226986 | if(isWpnPressed(itype_lens) && checkitem_jinx(itemid) && !lensclk && checkmagiccost(itemid)) |
| 13391 | { | ||
| 13392 |
2/2✓ Branch 0 taken 35 times.
✓ Branch 1 taken 480 times.
|
515 | if(lensid<0) |
| 13393 | { | ||
| 13394 | 480 | lensid=itemid; | |
| 13395 | |||
| 13396 |
1/2✓ Branch 0 taken 480 times.
✗ Branch 1 not taken.
|
480 | if(get_qr(qr_MORESOUNDS)) sfx(itemsbuf[itemid].usesound); |
| 13397 | 480 | } | |
| 13398 | |||
| 13399 | 515 | paymagiccost(itemid, true); | |
| 13400 | |||
| 13401 |
2/10✓ Branch 0 taken 515 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 515 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
515 | if(itemid>=0 && itemsbuf[itemid].script != 0 && !did_scriptl && !(FFCore.doscript(ScriptType::Item, itemid) && get_qr(qr_ITEMSCRIPTSKEEPRUNNING))) |
| 13402 | { | ||
| 13403 | //clear the item script stack for a new script | ||
| 13404 | ✗ | int i = itemid; | |
| 13405 | ✗ | FFCore.reset_script_engine_data(ScriptType::Item, i); | |
| 13406 | ✗ | ZScriptVersion::RunScript(ScriptType::Item, itemsbuf[i].script, i); | |
| 13407 | ✗ | did_scriptl=true; | |
| 13408 | ✗ | } | |
| 13409 | |||
| 13410 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 515 times.
|
515 | if (itemsbuf[itemid].magiccosttimer[0]) lensclk = itemsbuf[itemid].magiccosttimer[0]; |
| 13411 | 515 | else lensclk = 12; | |
| 13412 | 515 | } | |
| 13413 | else | ||
| 13414 | { | ||
| 13415 | 1226471 | did_scriptl=false; | |
| 13416 | |||
| 13417 |
7/8✓ Branch 0 taken 3299 times.
✓ Branch 1 taken 1223172 times.
✓ Branch 2 taken 2821 times.
✓ Branch 3 taken 478 times.
✓ Branch 4 taken 2821 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2820 times.
✓ Branch 7 taken 1 times.
|
1226471 | if(lensid>-1 && !(isWpnPressed(itype_lens) && checkitem_jinx(itemid) && checkmagiccost(itemid))) |
| 13418 | { | ||
| 13419 | 479 | lensid=-1; | |
| 13420 | 479 | lensclk = 0; | |
| 13421 | |||
| 13422 |
1/2✓ Branch 0 taken 479 times.
✗ Branch 1 not taken.
|
479 | if(get_qr(qr_MORESOUNDS)) sfx(WAV_ZN1LENSOFF); |
| 13423 | 479 | } | |
| 13424 | } | ||
| 13425 | 6063525 | } | |
| 13426 | |||
| 13427 | 14199587 | void HeroClass::tick_diving() | |
| 13428 | { | ||
| 13429 |
3/6✓ Branch 0 taken 14749 times.
✓ Branch 1 taken 14184838 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 14749 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
14199587 | if (diveclk && isSideViewHero() && get_qr(qr_SIDESWIM)) |
| 13430 | ✗ | set_dive(0); | |
| 13431 | 14199587 | int32_t flippers_id = current_item_id(itype_flippers); | |
| 13432 | 14199587 | itemdata const& itm = itemsbuf[flippers_id]; | |
| 13433 | 14199587 | byte intbtn = byte(itm.misc3&0xFF); | |
| 13434 | 14199587 | bool dive_pressed = getIntBtnInput(intbtn, INPUT_PRESS | INPUT_DRUNK | INPUT_PEEK); | |
| 13435 | 14199587 | bool eatdive = false; | |
| 13436 |
2/2✓ Branch 0 taken 10001 times.
✓ Branch 1 taken 14189586 times.
|
14199587 | if (diveclk > 0) |
| 13437 | { | ||
| 13438 | 10001 | set_dive(diveclk - 1); | |
| 13439 | 10001 | bool cool_down = (diveclk == 0); | |
| 13440 |
4/8✓ Branch 0 taken 9832 times.
✓ Branch 1 taken 169 times.
✓ Branch 2 taken 9832 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 9832 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
10001 | if (!cool_down && (flippers_id > -1 && (itm.flags & item_flag2) && dive_pressed)) // cancel dive |
| 13441 | { | ||
| 13442 | ✗ | cool_down = true; | |
| 13443 | ✗ | eatdive = true; | |
| 13444 | ✗ | } | |
| 13445 |
2/2✓ Branch 0 taken 9832 times.
✓ Branch 1 taken 169 times.
|
10001 | if (cool_down) |
| 13446 |
1/2✓ Branch 0 taken 169 times.
✗ Branch 1 not taken.
|
169 | set_dive(flippers_id < 0 ? -30 : -itemsbuf[flippers_id].misc2); // start cooldown |
| 13447 | 10001 | } | |
| 13448 |
2/2✓ Branch 0 taken 14184838 times.
✓ Branch 1 taken 4748 times.
|
14189586 | else if (diveclk < 0) |
| 13449 | { | ||
| 13450 | 4748 | set_dive(diveclk + 1); | |
| 13451 | 4748 | } | |
| 13452 |
4/4✓ Branch 0 taken 14065083 times.
✓ Branch 1 taken 119755 times.
✓ Branch 2 taken 14184598 times.
✓ Branch 3 taken 240 times.
|
14184838 | else if ((action == swimming || action == hopping) && dive_pressed) |
| 13453 | { | ||
| 13454 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 240 times.
|
240 | bool global_diving = (flippers_id > -1 && (itm.flags & item_flag1)); |
| 13455 | 240 | bool screen_diving = (hero_scr->flags5 & fTOGGLEDIVING) != 0; | |
| 13456 | |||
| 13457 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 240 times.
|
240 | if (global_diving == screen_diving) |
| 13458 | { | ||
| 13459 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 240 times.
|
240 | diveclk = (flippers_id < 0 ? 50 : itm.misc1); |
| 13460 | 240 | eatdive = true; | |
| 13461 | 240 | } | |
| 13462 | 240 | } | |
| 13463 |
2/2✓ Branch 0 taken 14199347 times.
✓ Branch 1 taken 240 times.
|
14199587 | if(eatdive) |
| 13464 | 240 | getIntBtnInput(intbtn, INPUT_PRESS | INPUT_DRUNK); | |
| 13465 | 14199587 | } | |
| 13466 | |||
| 13467 | 14081 | void HeroClass::do_hopping() | |
| 13468 | { | ||
| 13469 | 14081 | do_lens(); | |
| 13470 | |||
| 13471 |
2/2✓ Branch 0 taken 554 times.
✓ Branch 1 taken 13527 times.
|
14081 | if(hopclk==0xFF) //|| (diagonalMovement && hopclk >= 0xFF) )) // swimming |
| 13472 | //Possible fix for exiting water in diagonal movement. -Z | ||
| 13473 | { | ||
| 13474 | 554 | tick_diving(); | |
| 13475 | |||
| 13476 |
6/8✓ Branch 0 taken 427 times.
✓ Branch 1 taken 127 times.
✓ Branch 2 taken 156 times.
✓ Branch 3 taken 398 times.
✓ Branch 4 taken 156 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 156 times.
|
554 | if((!(x.getInt()&7) && !(y.getInt()&7)) || (diagonalMovement||NO_GRIDLOCK)) |
| 13477 | { | ||
| 13478 | 398 | SetSwim(); | |
| 13479 | 398 | hopclk = 0; | |
| 13480 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 398 times.
|
398 | if (!IsSideSwim()) |
| 13481 | { | ||
| 13482 | 398 | charging = attackclk = 0; | |
| 13483 | 398 | tapping = false; | |
| 13484 | 398 | } | |
| 13485 | 398 | } | |
| 13486 | else | ||
| 13487 | { | ||
| 13488 | 156 | herostep(); | |
| 13489 | |||
| 13490 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 156 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
156 | if(!isDiving() || (frame&1)) |
| 13491 | { | ||
| 13492 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 42 times.
✓ Branch 2 taken 7 times.
✓ Branch 3 taken 30 times.
✓ Branch 4 taken 77 times.
|
156 | switch(dir) |
| 13493 | { | ||
| 13494 | case up: | ||
| 13495 | 42 | y -= 1; | |
| 13496 | 42 | break; | |
| 13497 | |||
| 13498 | case down: | ||
| 13499 | 7 | y += 1; | |
| 13500 | 7 | break; | |
| 13501 | |||
| 13502 | case left: | ||
| 13503 | 30 | x -= 1; | |
| 13504 | 30 | break; | |
| 13505 | |||
| 13506 | case right: | ||
| 13507 | 77 | x += 1; | |
| 13508 | 77 | break; | |
| 13509 | } | ||
| 13510 | 156 | } | |
| 13511 | } | ||
| 13512 | 554 | } | |
| 13513 | else // hopping in or out (need to separate the cases...) | ||
| 13514 | { | ||
| 13515 |
4/6✓ Branch 0 taken 12509 times.
✓ Branch 1 taken 1018 times.
✓ Branch 2 taken 12509 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 12509 times.
|
13527 | if((diagonalMovement||NO_GRIDLOCK)) |
| 13516 | { | ||
| 13517 |
2/2✓ Branch 0 taken 643 times.
✓ Branch 1 taken 375 times.
|
1018 | if(hopclk==1) //hopping out |
| 13518 | //>= 1 possible fix for getting stuck on land edges. | ||
| 13519 | //No, this is not a clock. it's a type. 1 == out, 2 == in. | ||
| 13520 | { | ||
| 13521 |
1/2✓ Branch 0 taken 375 times.
✗ Branch 1 not taken.
|
375 | if(hopdir!=-1) dir=hopdir; |
| 13522 | |||
| 13523 | 375 | landswim=0; | |
| 13524 | |||
| 13525 |
2/2✓ Branch 0 taken 274 times.
✓ Branch 1 taken 101 times.
|
375 | if(dir==up) |
| 13526 | { | ||
| 13527 | 101 | herostep(); | |
| 13528 | 101 | herostep(); | |
| 13529 | 101 | int32_t sidestep=0; | |
| 13530 | |||
| 13531 |
2/6✗ Branch 0 not taken.
✓ Branch 1 taken 101 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 101 times.
|
101 | if(iswaterex_z3(MAPCOMBO(x,y+(bigHitbox?0:8)-1), -1, x,y+(bigHitbox?0:8)-1, true, false) && !iswaterex_z3(MAPCOMBO(x+8,y+(bigHitbox?0:8)-1), -1, x+8,y+(bigHitbox?0:8)-1, true, false) && !iswaterex_z3(MAPCOMBO(x+15,y+(bigHitbox?0:8)-1), -1, x+15,y+(bigHitbox?0:8)-1, true, false)) |
| 13532 | ✗ | sidestep=1; | |
| 13533 |
3/6✓ Branch 0 taken 101 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 101 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 101 times.
✗ Branch 5 not taken.
|
101 | else if(!iswaterex_z3(MAPCOMBO(x,y+(bigHitbox?0:8)-1), -1, x,y+(bigHitbox?0:8)-1, true, false) && !iswaterex_z3(MAPCOMBO(x+7,y+(bigHitbox?0:8)-1), -1, x+7,y+(bigHitbox?0:8)-1, true, false) && iswaterex_z3(MAPCOMBO(x+15,y+(bigHitbox?0:8)-1), -1, x+15,y+(bigHitbox?0:8)-1, true, false)) |
| 13534 | ✗ | sidestep=2; | |
| 13535 | |||
| 13536 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 101 times.
|
101 | if(sidestep==1) x++; |
| 13537 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 101 times.
|
101 | else if(sidestep==2) x--; |
| 13538 | 101 | else y--; | |
| 13539 | |||
| 13540 |
3/4✓ Branch 0 taken 101 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 93 times.
✓ Branch 3 taken 8 times.
|
101 | if(!iswaterex_z3(MAPCOMBO(x.getInt(),y.getInt()+(bigHitbox?0:8)), -1, x.getInt(),y.getInt()+(bigHitbox?0:8), true, false)&&!iswaterex_z3(MAPCOMBO(x.getInt(),y.getInt()+15), -1, x.getInt(),y.getInt()+15, true, false)) |
| 13541 | { | ||
| 13542 | 8 | hopclk=0; | |
| 13543 | 8 | set_dive(0); | |
| 13544 | 8 | action=none; FFCore.setHeroAction(none); | |
| 13545 | 8 | hopdir=-1; | |
| 13546 | 8 | } | |
| 13547 | 101 | } | |
| 13548 | |||
| 13549 |
2/2✓ Branch 0 taken 303 times.
✓ Branch 1 taken 72 times.
|
375 | if(dir==down) |
| 13550 | { | ||
| 13551 | 72 | herostep(); | |
| 13552 | 72 | herostep(); | |
| 13553 | 72 | int32_t sidestep=0; | |
| 13554 | |||
| 13555 |
2/6✗ Branch 0 not taken.
✓ Branch 1 taken 72 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 72 times.
|
72 | if(iswaterex_z3(MAPCOMBO(x,y+16), -1, x,y+16, true, false) && !iswaterex_z3(MAPCOMBO(x+8,y+16), -1, x+8,y+16, true, false) && !iswaterex_z3(MAPCOMBO(x+15,y+16), -1, x+15,y+16, true, false)) |
| 13556 | ✗ | sidestep=1; | |
| 13557 |
3/6✓ Branch 0 taken 72 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 72 times.
✓ Branch 4 taken 72 times.
✗ Branch 5 not taken.
|
72 | else if(!iswaterex_z3(MAPCOMBO(x,y+16), -1, x,y+16, true, false) && !iswaterex_z3(MAPCOMBO(x+8,y+16), -1, x+8,y+16, true, false) && iswaterex_z3(MAPCOMBO(x+15,y+16), -1, x+15,y+16, true, false)) |
| 13558 | ✗ | sidestep=2; | |
| 13559 | |||
| 13560 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 72 times.
|
72 | if(sidestep==1) x++; |
| 13561 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 72 times.
|
72 | else if(sidestep==2) x--; |
| 13562 | 72 | else y++; | |
| 13563 | |||
| 13564 |
3/4✓ Branch 0 taken 6 times.
✓ Branch 1 taken 66 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
|
72 | if(!iswaterex_z3(MAPCOMBO(x.getInt(),y.getInt()+(bigHitbox?0:8)), -1, x.getInt(),y.getInt()+(bigHitbox?0:8), true, false)&&!iswaterex_z3(MAPCOMBO(x.getInt(),y.getInt()+15), -1, x.getInt(),y.getInt()+15, true, false)) |
| 13565 | { | ||
| 13566 | 6 | hopclk=0; | |
| 13567 | 6 | set_dive(0); | |
| 13568 | 6 | action=none; FFCore.setHeroAction(none); | |
| 13569 | 6 | hopdir=-1; | |
| 13570 | 6 | } | |
| 13571 | 72 | } | |
| 13572 | |||
| 13573 |
2/2✓ Branch 0 taken 318 times.
✓ Branch 1 taken 57 times.
|
375 | if(dir==left) |
| 13574 | { | ||
| 13575 | 57 | herostep(); | |
| 13576 | 57 | herostep(); | |
| 13577 | 57 | int32_t sidestep=0; | |
| 13578 | |||
| 13579 |
2/6✗ Branch 0 not taken.
✓ Branch 1 taken 57 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 57 times.
|
57 | if(iswaterex_z3(MAPCOMBO(x-1,y+(bigHitbox?0:8)), -1, x-1,y+(bigHitbox?0:8), true, false) && !iswaterex_z3(MAPCOMBO(x-1,y+(bigHitbox?8:12)), -1, x-1,y+(bigHitbox?8:12), true, false) && !iswaterex_z3(MAPCOMBO(x-1,y+15), -1, x-1,y+15, true, false)) |
| 13580 | ✗ | sidestep=1; | |
| 13581 |
3/6✓ Branch 0 taken 57 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 57 times.
✓ Branch 4 taken 57 times.
✗ Branch 5 not taken.
|
57 | else if(!iswaterex_z3(MAPCOMBO(x-1,y+(bigHitbox?0:8)), -1, x-1,y+(bigHitbox?0:8), true, false) && !iswaterex_z3(MAPCOMBO(x-1,y+(bigHitbox?7:11)), -1, x-1,y+(bigHitbox?7:11), true, false) && iswaterex_z3(MAPCOMBO(x-1,y+15), -1, x-1,y+15, true, false)) |
| 13582 | ✗ | sidestep=2; | |
| 13583 | |||
| 13584 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 57 times.
|
57 | if(sidestep==1) y++; |
| 13585 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 57 times.
|
57 | else if(sidestep==2) y--; |
| 13586 | 57 | else x--; | |
| 13587 | |||
| 13588 |
3/4✓ Branch 0 taken 57 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 53 times.
✓ Branch 3 taken 4 times.
|
57 | if(!iswaterex_z3(MAPCOMBO(x.getInt(),y.getInt()+(bigHitbox?0:8)), -1, x.getInt(),y.getInt()+(bigHitbox?0:8), true, false)&&!iswaterex_z3(MAPCOMBO(x.getInt()+15,y.getInt()+8), -1, x.getInt()+15,y.getInt()+8, true, false)) |
| 13589 | { | ||
| 13590 | 4 | hopclk=0; | |
| 13591 | 4 | set_dive(0); | |
| 13592 | 4 | action=none; FFCore.setHeroAction(none); | |
| 13593 | 4 | hopdir=-1; | |
| 13594 | 4 | } | |
| 13595 | 57 | } | |
| 13596 | |||
| 13597 |
2/2✓ Branch 0 taken 230 times.
✓ Branch 1 taken 145 times.
|
375 | if(dir==right) |
| 13598 | { | ||
| 13599 | 145 | herostep(); | |
| 13600 | 145 | herostep(); | |
| 13601 | 145 | int32_t sidestep=0; | |
| 13602 | |||
| 13603 |
2/6✗ Branch 0 not taken.
✓ Branch 1 taken 145 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 145 times.
|
145 | if(iswaterex_z3(MAPCOMBO(x+16,y+(bigHitbox?0:8)), -1, x+16,y+(bigHitbox?0:8), true, false) && !iswaterex_z3(MAPCOMBO(x+16,y+(bigHitbox?8:12)), -1, x+16,y+(bigHitbox?8:12), true, false) && !iswaterex_z3(MAPCOMBO(x+16,y+15), -1, x+16,y+15, true, false)) |
| 13604 | ✗ | sidestep=1; | |
| 13605 |
3/6✓ Branch 0 taken 145 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 145 times.
✓ Branch 4 taken 145 times.
✗ Branch 5 not taken.
|
145 | else if(!iswaterex_z3(MAPCOMBO(x+16,y+(bigHitbox?0:8)), -1, x+16,y+(bigHitbox?0:8), true, false) && !iswaterex_z3(MAPCOMBO(x+16,y+(bigHitbox?7:11)), -1, x+16,y+(bigHitbox?7:11), true, false) && iswaterex_z3(MAPCOMBO(x+16,y+15), -1, x+16,y+15, true, false)) |
| 13606 | ✗ | sidestep=2; | |
| 13607 | |||
| 13608 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 145 times.
|
145 | if(sidestep==1) y++; |
| 13609 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 145 times.
|
145 | else if(sidestep==2) y--; |
| 13610 | 145 | else x++; | |
| 13611 | |||
| 13612 |
3/4✓ Branch 0 taken 11 times.
✓ Branch 1 taken 134 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 11 times.
|
145 | if(!iswaterex_z3(MAPCOMBO(x.getInt(),y.getInt()+(bigHitbox?0:8)), -1, x.getInt(),y.getInt()+(bigHitbox?0:8), true, false)&&!iswaterex_z3(MAPCOMBO(x.getInt()+15,y.getInt()+8), -1, x.getInt()+15,y.getInt()+8, true, false)) |
| 13613 | { | ||
| 13614 | 11 | hopclk=0; | |
| 13615 | 11 | set_dive(0); | |
| 13616 | 11 | action=none; FFCore.setHeroAction(none); | |
| 13617 | 11 | hopdir=-1; | |
| 13618 | 11 | } | |
| 13619 | 145 | } | |
| 13620 | 375 | } | |
| 13621 | |||
| 13622 |
2/2✓ Branch 0 taken 375 times.
✓ Branch 1 taken 643 times.
|
1018 | if(hopclk==2) //hopping in |
| 13623 | { | ||
| 13624 | 643 | landswim=0; | |
| 13625 | |||
| 13626 |
2/2✓ Branch 0 taken 554 times.
✓ Branch 1 taken 89 times.
|
643 | if(dir==up) |
| 13627 | { | ||
| 13628 | 89 | herostep(); | |
| 13629 | 89 | herostep(); | |
| 13630 | 89 | int32_t sidestep=0; | |
| 13631 | |||
| 13632 |
6/6✓ Branch 0 taken 40 times.
✓ Branch 1 taken 49 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 39 times.
✓ Branch 4 taken 1 times.
✓ Branch 5 taken 88 times.
|
89 | if(!iswaterex_z3(MAPCOMBO(x,y+(bigHitbox?0:8)-1), -1, x,y+(bigHitbox?0:8)-1, true, false) && iswaterex_z3(MAPCOMBO(x+8,y+(bigHitbox?0:8)-1), -1, x+8,y+(bigHitbox?0:8)-1, true, false) && iswaterex_z3(MAPCOMBO(x+15,y+(bigHitbox?0:8)-1), -1, x+15,y+(bigHitbox?0:8)-1, true, false)) |
| 13633 | 1 | sidestep=1; | |
| 13634 |
4/6✓ Branch 0 taken 49 times.
✓ Branch 1 taken 39 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 49 times.
✓ Branch 4 taken 88 times.
✗ Branch 5 not taken.
|
88 | else if(iswaterex_z3(MAPCOMBO(x,y+(bigHitbox?0:8)-1), -1, x,y+(bigHitbox?0:8)-1, true, false) && iswaterex_z3(MAPCOMBO(x+7,y+(bigHitbox?0:8)-1), -1, x+7,y+(bigHitbox?0:8)-1, true, false) && !iswaterex_z3(MAPCOMBO(x+15,y+(bigHitbox?0:8)-1), -1, x+15,y+(bigHitbox?0:8)-1, true, false)) |
| 13635 | ✗ | sidestep=2; | |
| 13636 | |||
| 13637 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 88 times.
|
89 | if(sidestep==1) x++; |
| 13638 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 88 times.
|
88 | else if(sidestep==2) x--; |
| 13639 | 88 | else y--; | |
| 13640 | |||
| 13641 |
4/4✓ Branch 0 taken 50 times.
✓ Branch 1 taken 39 times.
✓ Branch 2 taken 46 times.
✓ Branch 3 taken 4 times.
|
89 | if(iswaterex_z3(MAPCOMBO(x.getInt(),y.getInt()+(bigHitbox?0:8)), -1, x.getInt(),y.getInt()+(bigHitbox?0:8), true, false)&&iswaterex_z3(MAPCOMBO(x.getInt(),y.getInt()+15), -1, x.getInt(),y.getInt()+15, true, false)) |
| 13642 | { | ||
| 13643 | 4 | hopclk=0xFF; | |
| 13644 | 4 | set_dive(0); | |
| 13645 | 4 | SetSwim(); | |
| 13646 | 4 | } | |
| 13647 | 89 | } | |
| 13648 | |||
| 13649 |
2/2✓ Branch 0 taken 501 times.
✓ Branch 1 taken 142 times.
|
643 | if(dir==down) |
| 13650 | { | ||
| 13651 | 142 | herostep(); | |
| 13652 | 142 | herostep(); | |
| 13653 | 142 | int32_t sidestep=0; | |
| 13654 | |||
| 13655 |
3/6✓ Branch 0 taken 142 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 142 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 142 times.
|
142 | if(!iswaterex_z3(MAPCOMBO(x,y+16), -1, x,y+16, true, false) && iswaterex_z3(MAPCOMBO(x+8,y+16), -1, x+8,y+16, true, false) && iswaterex_z3(MAPCOMBO(x+15,y+16), -1, x+15,y+16, true, false)) |
| 13656 | ✗ | sidestep=1; | |
| 13657 |
2/6✗ Branch 0 not taken.
✓ Branch 1 taken 142 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 142 times.
✗ Branch 5 not taken.
|
142 | else if(iswaterex_z3(MAPCOMBO(x,y+16), -1, x,y+16, true, false) && iswaterex_z3(MAPCOMBO(x+8,y+16), -1, x+8,y+16, true, false) && !iswaterex_z3(MAPCOMBO(x+15,y+16), -1, x+15,y+16, true, false)) |
| 13658 | ✗ | sidestep=2; | |
| 13659 | |||
| 13660 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 142 times.
|
142 | if(sidestep==1) x++; |
| 13661 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 142 times.
|
142 | else if(sidestep==2) x--; |
| 13662 | 142 | else y++; | |
| 13663 | |||
| 13664 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 142 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
142 | if(iswaterex_z3(MAPCOMBO(x.getInt(),y.getInt()+(bigHitbox?0:8)), -1, x.getInt(),y.getInt()+(bigHitbox?0:8), true, false)&&iswaterex_z3(MAPCOMBO(x.getInt(),y.getInt()+15), -1, x.getInt(),y.getInt()+15, true, false)) |
| 13665 | { | ||
| 13666 | ✗ | hopclk=0xFF; | |
| 13667 | ✗ | set_dive(0); | |
| 13668 | ✗ | SetSwim(); | |
| 13669 | ✗ | if (!IsSideSwim()) reset_swordcharge(); | |
| 13670 | ✗ | } | |
| 13671 | 142 | } | |
| 13672 | |||
| 13673 |
2/2✓ Branch 0 taken 510 times.
✓ Branch 1 taken 133 times.
|
643 | if(dir==left) |
| 13674 | { | ||
| 13675 | 133 | herostep(); | |
| 13676 | 133 | herostep(); | |
| 13677 | 133 | int32_t sidestep=0; | |
| 13678 | |||
| 13679 |
4/6✓ Branch 0 taken 31 times.
✓ Branch 1 taken 102 times.
✓ Branch 2 taken 31 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 133 times.
|
133 | if(!iswaterex_z3(MAPCOMBO(x-1,y+(bigHitbox?0:8)), -1, x-1,y+(bigHitbox?0:8), true, false) && iswaterex_z3(MAPCOMBO(x-1,y+(bigHitbox?8:12)), -1, x-1,y+(bigHitbox?8:12), true, false) && iswaterex_z3(MAPCOMBO(x-1,y+15), -1, x-1,y+15, true, false)) |
| 13680 | ✗ | sidestep=1; | |
| 13681 |
4/6✓ Branch 0 taken 102 times.
✓ Branch 1 taken 31 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 102 times.
✓ Branch 4 taken 133 times.
✗ Branch 5 not taken.
|
133 | else if(iswaterex_z3(MAPCOMBO(x-1,y+(bigHitbox?0:8)), -1, x-1,y+(bigHitbox?0:8), true, false) && iswaterex_z3(MAPCOMBO(x-1,y+(bigHitbox?7:11)), -1, x-1,y+(bigHitbox?7:11), true, false) && !iswaterex_z3(MAPCOMBO(x-1,y+15), -1, x-1,y+15, true, false)) |
| 13682 | ✗ | sidestep=2; | |
| 13683 | |||
| 13684 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 133 times.
|
133 | if(sidestep==1) y++; |
| 13685 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 133 times.
|
133 | else if(sidestep==2) y--; |
| 13686 | 133 | else x--; | |
| 13687 | |||
| 13688 |
4/4✓ Branch 0 taken 102 times.
✓ Branch 1 taken 31 times.
✓ Branch 2 taken 7 times.
✓ Branch 3 taken 95 times.
|
133 | if(iswaterex_z3(MAPCOMBO(x.getInt(),y.getInt()+(bigHitbox?0:8)), -1, x.getInt(),y.getInt()+(bigHitbox?0:8), true, false)&&iswaterex_z3(MAPCOMBO(x.getInt()+15,y.getInt()+8), -1, x.getInt()+15,y.getInt()+8, true, false)) |
| 13689 | { | ||
| 13690 | 7 | hopclk=0xFF; | |
| 13691 | 7 | set_dive(0); | |
| 13692 | 7 | SetSwim(); | |
| 13693 | 7 | } | |
| 13694 | 133 | } | |
| 13695 | |||
| 13696 |
2/2✓ Branch 0 taken 364 times.
✓ Branch 1 taken 279 times.
|
643 | if(dir==right) |
| 13697 | { | ||
| 13698 | 279 | herostep(); | |
| 13699 | 279 | herostep(); | |
| 13700 | |||
| 13701 | 279 | int32_t sidestep=0; | |
| 13702 | |||
| 13703 |
4/6✓ Branch 0 taken 207 times.
✓ Branch 1 taken 72 times.
✓ Branch 2 taken 207 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 279 times.
|
279 | if(!iswaterex_z3(MAPCOMBO(x+16,y+(bigHitbox?0:8)), -1, x+16,y+(bigHitbox?0:8), true, false) && iswaterex_z3(MAPCOMBO(x+16,y+(bigHitbox?8:12)), -1, x+16,y+(bigHitbox?8:12), true, false) && iswaterex_z3(MAPCOMBO(x+16,y+15), -1, x+16,y+15, true, false)) |
| 13704 | ✗ | sidestep=1; | |
| 13705 |
4/6✓ Branch 0 taken 72 times.
✓ Branch 1 taken 207 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 72 times.
✓ Branch 4 taken 279 times.
✗ Branch 5 not taken.
|
279 | else if(iswaterex_z3(MAPCOMBO(x+16,y+(bigHitbox?0:8)), -1, x+16,y+(bigHitbox?0:8), true, false) && iswaterex_z3(MAPCOMBO(x+16,y+(bigHitbox?7:11)), -1, x+16,y+(bigHitbox?7:11), true, false) && !iswaterex_z3(MAPCOMBO(x+16,y+15), -1, x+16,y+15, true, false)) |
| 13706 | ✗ | sidestep=2; | |
| 13707 | |||
| 13708 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 279 times.
|
279 | if(sidestep==1) y++; |
| 13709 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 279 times.
|
279 | else if(sidestep==2) y--; |
| 13710 | 279 | else x++; | |
| 13711 | |||
| 13712 |
3/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 274 times.
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
|
279 | if(iswaterex_z3(MAPCOMBO(x.getInt(),y.getInt()+(bigHitbox?0:8)), -1, x.getInt(),y.getInt()+(bigHitbox?0:8), true, false)&&iswaterex_z3(MAPCOMBO(x.getInt()+15,y.getInt()+8), -1, x.getInt()+15,y.getInt()+8, true, false)) |
| 13713 | { | ||
| 13714 | 5 | hopclk=0xFF; | |
| 13715 | 5 | set_dive(0); | |
| 13716 | 5 | SetSwim(); | |
| 13717 | 5 | } | |
| 13718 | 279 | } | |
| 13719 | 643 | } | |
| 13720 | |||
| 13721 | 1018 | } | |
| 13722 | else | ||
| 13723 | { | ||
| 13724 |
7/8✓ Branch 0 taken 4823 times.
✓ Branch 1 taken 7686 times.
✓ Branch 2 taken 4823 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3622 times.
✓ Branch 5 taken 1201 times.
✓ Branch 6 taken 640 times.
✓ Branch 7 taken 7046 times.
|
12509 | if((dir<left ? !(x.getInt()&7) && !(y.getInt()&15) : !(x.getInt()&15) && !(y.getInt()&7))) |
| 13725 | { | ||
| 13726 | 1201 | action=none; FFCore.setHeroAction(none); | |
| 13727 | 1201 | hopclk = 0; | |
| 13728 | 1201 | set_dive(0); | |
| 13729 | |||
| 13730 |
2/2✓ Branch 0 taken 576 times.
✓ Branch 1 taken 625 times.
|
1201 | if(iswaterex_z3(MAPCOMBO(x.getInt(),y.getInt()+8), -1, x.getInt(),y.getInt()+8, true, false)) |
| 13731 | { | ||
| 13732 | // hopped in | ||
| 13733 | 625 | SetSwim(); | |
| 13734 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 625 times.
|
625 | if (!IsSideSwim()) attackclk = charging = spins = 0; |
| 13735 | 625 | } | |
| 13736 | 1201 | } | |
| 13737 | else | ||
| 13738 | { | ||
| 13739 | 11308 | herostep(); | |
| 13740 | 11308 | herostep(); | |
| 13741 | |||
| 13742 |
2/2✓ Branch 0 taken 10642 times.
✓ Branch 1 taken 666 times.
|
11308 | if(++hero_count>(16*hero_animation_speed)) |
| 13743 | 666 | hero_count=0; | |
| 13744 | |||
| 13745 | 11308 | int32_t xofs2 = x.getInt()&15; | |
| 13746 | 11308 | int32_t yofs2 = y.getInt()&15; | |
| 13747 | 11308 | int32_t s = 1 + (frame&1); | |
| 13748 | |||
| 13749 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 1656 times.
✓ Branch 2 taken 2606 times.
✓ Branch 3 taken 3402 times.
✓ Branch 4 taken 3644 times.
|
11308 | switch(dir) |
| 13750 | { | ||
| 13751 | case up: | ||
| 13752 |
4/4✓ Branch 0 taken 1173 times.
✓ Branch 1 taken 483 times.
✓ Branch 2 taken 1167 times.
✓ Branch 3 taken 6 times.
|
1656 | if(yofs2<3 || yofs2>13) --y; |
| 13753 | 1167 | else y-=s; | |
| 13754 | |||
| 13755 | 1656 | break; | |
| 13756 | |||
| 13757 | case down: | ||
| 13758 |
4/4✓ Branch 0 taken 2152 times.
✓ Branch 1 taken 454 times.
✓ Branch 2 taken 356 times.
✓ Branch 3 taken 1796 times.
|
2606 | if(yofs2<3 || yofs2>13) ++y; |
| 13759 | 1796 | else y+=s; | |
| 13760 | |||
| 13761 | 2606 | break; | |
| 13762 | |||
| 13763 | case left: | ||
| 13764 |
4/4✓ Branch 0 taken 2966 times.
✓ Branch 1 taken 436 times.
✓ Branch 2 taken 598 times.
✓ Branch 3 taken 2368 times.
|
3402 | if(xofs2<3 || xofs2>13) --x; |
| 13765 | 2368 | else x-=s; | |
| 13766 | |||
| 13767 | 3402 | break; | |
| 13768 | |||
| 13769 | case right: | ||
| 13770 |
4/4✓ Branch 0 taken 3009 times.
✓ Branch 1 taken 635 times.
✓ Branch 2 taken 492 times.
✓ Branch 3 taken 2517 times.
|
3644 | if(xofs2<3 || xofs2>13) ++x; |
| 13771 | 2517 | else x+=s; | |
| 13772 | |||
| 13773 | 3644 | break; | |
| 13774 | } | ||
| 13775 | } | ||
| 13776 | } | ||
| 13777 | } | ||
| 13778 | 14081 | } | |
| 13779 | |||
| 13780 | 113670 | void HeroClass::do_rafting() | |
| 13781 | { | ||
| 13782 | |||
| 13783 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 113670 times.
|
113670 | if(walk_through_walls) |
| 13784 | { | ||
| 13785 | ✗ | action=none; FFCore.setHeroAction(none); | |
| 13786 | ✗ | return; | |
| 13787 | } | ||
| 13788 | |||
| 13789 | 113670 | FFCore.setHeroAction(rafting); | |
| 13790 | |||
| 13791 | 113670 | do_lens(); | |
| 13792 | |||
| 13793 | 113670 | herostep(); | |
| 13794 | |||
| 13795 | //Calculate rafting speed | ||
| 13796 | 113670 | int32_t raft_item = current_item_id(itype_raft); | |
| 13797 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 113670 times.
|
113670 | int32_t raft_step = (raft_item < 0 ? 1 : itemsbuf[raft_item].misc1); |
| 13798 | 113670 | raft_step = vbound(raft_step, -8, 5); | |
| 13799 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 113670 times.
|
113670 | int32_t raft_time = raft_step < 0 ? 1<<(-raft_step) : 1; |
| 13800 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 113670 times.
|
113670 | if(raft_step < 0) raft_step = 1; |
| 13801 | 113670 | int32_t step_inc = 1 << (raft_step - 1); | |
| 13802 | // Fix position | ||
| 13803 |
1/2✓ Branch 0 taken 113670 times.
✗ Branch 1 not taken.
|
113670 | if(raft_step > 1) |
| 13804 | { | ||
| 13805 | ✗ | if(x.getInt() & (step_inc-1)) | |
| 13806 | { | ||
| 13807 | ✗ | x = x.getInt() & ~(step_inc-1); | |
| 13808 | ✗ | } | |
| 13809 | ✗ | if(y.getInt() & (step_inc-1)) | |
| 13810 | { | ||
| 13811 | ✗ | y = y.getInt() & ~(step_inc-1); | |
| 13812 | ✗ | } | |
| 13813 | ✗ | } | |
| 13814 | // Inc clock, check if we need to move this frame | ||
| 13815 | 113670 | ++raftclk; | |
| 13816 |
2/4✓ Branch 0 taken 113670 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 113670 times.
|
113670 | if((raftclk % raft_time) || raft_step == 0) return; //No movement this frame |
| 13817 | |||
| 13818 |
4/4✓ Branch 0 taken 54653 times.
✓ Branch 1 taken 59017 times.
✓ Branch 2 taken 46790 times.
✓ Branch 3 taken 7863 times.
|
121390 | if(!(x.getInt()&15) && !(y.getInt()&15)) |
| 13819 | { | ||
| 13820 | // this sections handles switching to raft branches | ||
| 13821 |
3/4✓ Branch 0 taken 7609 times.
✓ Branch 1 taken 254 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 7609 times.
|
7863 | if((MAPFLAG(x,y)==mfRAFT_BRANCH||MAPCOMBOFLAG(x,y)==mfRAFT_BRANCH)) |
| 13822 | { | ||
| 13823 |
7/8✓ Branch 0 taken 177 times.
✓ Branch 1 taken 77 times.
✓ Branch 2 taken 38 times.
✓ Branch 3 taken 139 times.
✓ Branch 4 taken 3 times.
✓ Branch 5 taken 35 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 3 times.
|
254 | if (dir != down && getInput(btnUp, INPUT_DRUNK | INPUT_HERO_ACTION) && (isRaftFlag(nextflag(x, y, up, false)) || isRaftFlag(nextflag(x, y, up, true)))) |
| 13824 | { | ||
| 13825 | 35 | dir = up; | |
| 13826 | 35 | goto skip; | |
| 13827 | } | ||
| 13828 | |||
| 13829 |
7/8✓ Branch 0 taken 175 times.
✓ Branch 1 taken 44 times.
✓ Branch 2 taken 63 times.
✓ Branch 3 taken 112 times.
✓ Branch 4 taken 15 times.
✓ Branch 5 taken 48 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 15 times.
|
219 | if (dir != up && getInput(btnDown, INPUT_DRUNK | INPUT_HERO_ACTION) && (isRaftFlag(nextflag(x, y, down, false)) || isRaftFlag(nextflag(x, y, down, true)))) |
| 13830 | { | ||
| 13831 | 48 | dir = down; | |
| 13832 | 48 | goto skip; | |
| 13833 | } | ||
| 13834 | |||
| 13835 |
7/8✓ Branch 0 taken 134 times.
✓ Branch 1 taken 37 times.
✓ Branch 2 taken 36 times.
✓ Branch 3 taken 98 times.
✓ Branch 4 taken 5 times.
✓ Branch 5 taken 31 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 5 times.
|
171 | if (dir != right && getInput(btnLeft, INPUT_DRUNK | INPUT_HERO_ACTION) && (isRaftFlag(nextflag(x, y, left, false)) || isRaftFlag(nextflag(x, y, left, true)))) |
| 13836 | { | ||
| 13837 | 31 | dir = left; | |
| 13838 | 31 | goto skip; | |
| 13839 | } | ||
| 13840 | |||
| 13841 |
7/8✓ Branch 0 taken 126 times.
✓ Branch 1 taken 14 times.
✓ Branch 2 taken 41 times.
✓ Branch 3 taken 85 times.
✓ Branch 4 taken 12 times.
✓ Branch 5 taken 29 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 12 times.
|
140 | if (dir != left && getInput(btnRight, INPUT_DRUNK | INPUT_HERO_ACTION) && (isRaftFlag(nextflag(x, y, right, false)) || isRaftFlag(nextflag(x, y, right, true)))) |
| 13842 | { | ||
| 13843 | 29 | dir = right; | |
| 13844 | 29 | goto skip; | |
| 13845 | } | ||
| 13846 | 111 | } | |
| 13847 |
2/4✓ Branch 0 taken 7609 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 7609 times.
|
7609 | else if((MAPFLAG(x,y)==mfRAFT_BOUNCE||MAPCOMBOFLAG(x,y)==mfRAFT_BOUNCE)) |
| 13848 | { | ||
| 13849 | ✗ | if(dir == left) dir = right; | |
| 13850 | ✗ | else if(dir == right) dir = left; | |
| 13851 | ✗ | else if(dir == up) dir = down; | |
| 13852 | ✗ | else if(dir == down) dir = up; | |
| 13853 | ✗ | } | |
| 13854 | |||
| 13855 |
4/4✓ Branch 0 taken 1385 times.
✓ Branch 1 taken 6335 times.
✓ Branch 2 taken 11 times.
✓ Branch 3 taken 1374 times.
|
7720 | if(!isRaftFlag(nextflag(x,y,dir,false))&&!isRaftFlag(nextflag(x,y,dir,true))) |
| 13856 | { | ||
| 13857 |
2/2✓ Branch 0 taken 741 times.
✓ Branch 1 taken 633 times.
|
1374 | if(dir<left) //going up or down |
| 13858 | { | ||
| 13859 |
3/4✓ Branch 0 taken 472 times.
✓ Branch 1 taken 269 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 472 times.
|
741 | if((isRaftFlag(nextflag(x,y,right,false))||isRaftFlag(nextflag(x,y,right,true)))) |
| 13860 | 269 | dir=right; | |
| 13861 |
3/4✓ Branch 0 taken 241 times.
✓ Branch 1 taken 231 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 241 times.
|
472 | else if((isRaftFlag(nextflag(x,y,left,false))||isRaftFlag(nextflag(x,y,left,true)))) |
| 13862 | 231 | dir=left; | |
| 13863 |
4/4✓ Branch 0 taken 226 times.
✓ Branch 1 taken 15 times.
✓ Branch 2 taken 210 times.
✓ Branch 3 taken 16 times.
|
241 | else if(y>0 && y<world_h-16) |
| 13864 | { | ||
| 13865 | 210 | action=none; FFCore.setHeroAction(none); | |
| 13866 | 210 | x = x.getInt(); | |
| 13867 | 210 | y = y.getInt(); | |
| 13868 | 210 | } | |
| 13869 | 741 | } | |
| 13870 | else //going left or right | ||
| 13871 | { | ||
| 13872 |
3/4✓ Branch 0 taken 389 times.
✓ Branch 1 taken 244 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 389 times.
|
633 | if((isRaftFlag(nextflag(x,y,down,false))||isRaftFlag(nextflag(x,y,down,true)))) |
| 13873 | 244 | dir=down; | |
| 13874 |
3/4✓ Branch 0 taken 147 times.
✓ Branch 1 taken 242 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 147 times.
|
389 | else if((isRaftFlag(nextflag(x,y,up,false))||isRaftFlag(nextflag(x,y,up,true)))) |
| 13875 | 242 | dir=up; | |
| 13876 |
4/4✓ Branch 0 taken 146 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 145 times.
|
147 | else if(x>0 && x<world_w-16) |
| 13877 | { | ||
| 13878 | 145 | action=none; FFCore.setHeroAction(none); | |
| 13879 | 145 | x = x.getInt(); | |
| 13880 | 145 | y = y.getInt(); | |
| 13881 | 145 | } | |
| 13882 | } | ||
| 13883 | 1374 | } | |
| 13884 | 7720 | } | |
| 13885 | |||
| 13886 | skip: | ||
| 13887 | |||
| 13888 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 25101 times.
✓ Branch 2 taken 25265 times.
✓ Branch 3 taken 29690 times.
✓ Branch 4 taken 33614 times.
|
113670 | switch(dir) |
| 13889 | { | ||
| 13890 | case up: | ||
| 13891 |
2/2✓ Branch 0 taken 9 times.
✓ Branch 1 taken 25092 times.
|
25101 | if(x.getInt()&15) |
| 13892 | { | ||
| 13893 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
|
9 | if(x.getInt()&8) |
| 13894 | ✗ | x++; | |
| 13895 | 9 | else x--; | |
| 13896 | 9 | } | |
| 13897 | 25092 | else y -= step_inc; | |
| 13898 | |||
| 13899 | 25101 | break; | |
| 13900 | |||
| 13901 | case down: | ||
| 13902 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 25265 times.
|
25265 | if(x.getInt()&15) |
| 13903 | { | ||
| 13904 | ✗ | if(x.getInt()&8) | |
| 13905 | ✗ | x++; | |
| 13906 | ✗ | else x--; | |
| 13907 | ✗ | } | |
| 13908 | 25265 | else y += step_inc; | |
| 13909 | |||
| 13910 | 25265 | break; | |
| 13911 | |||
| 13912 | case left: | ||
| 13913 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 29684 times.
|
29690 | if(y.getInt()&15) |
| 13914 | { | ||
| 13915 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
|
6 | if (get_qr(qr_BETTER_RAFT_2)) |
| 13916 | { | ||
| 13917 | ✗ | if ((y.getInt() % 16) < 4) y--; | |
| 13918 | ✗ | else y++; | |
| 13919 | ✗ | } | |
| 13920 | else | ||
| 13921 | { | ||
| 13922 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | if(y.getInt()&8) |
| 13923 | 6 | y++; | |
| 13924 | ✗ | else y--; | |
| 13925 | } | ||
| 13926 | 6 | } | |
| 13927 | 29684 | else x -= step_inc; | |
| 13928 | |||
| 13929 | 29690 | break; | |
| 13930 | |||
| 13931 | case right: | ||
| 13932 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 33614 times.
|
33614 | if(y.getInt()&15) |
| 13933 | { | ||
| 13934 | ✗ | if (get_qr(qr_BETTER_RAFT_2)) | |
| 13935 | { | ||
| 13936 | ✗ | if ((y.getInt() % 16) <= 4) y--; | |
| 13937 | ✗ | else y++; | |
| 13938 | ✗ | } | |
| 13939 | else | ||
| 13940 | { | ||
| 13941 | ✗ | if(y.getInt()&8) | |
| 13942 | ✗ | y++; | |
| 13943 | ✗ | else y--; | |
| 13944 | } | ||
| 13945 | ✗ | } | |
| 13946 | 33614 | else x += step_inc; | |
| 13947 | |||
| 13948 | 33614 | break; | |
| 13949 | } | ||
| 13950 | 113670 | } | |
| 13951 | |||
| 13952 | 6348 | bool HeroClass::tick_hover() | |
| 13953 | { | ||
| 13954 |
2/2✓ Branch 0 taken 6331 times.
✓ Branch 1 taken 17 times.
|
6348 | if(hoverclk > 0) |
| 13955 | { | ||
| 13956 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 17 times.
|
17 | if(hoverflags&HOV_INF) return false; |
| 13957 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 17 times.
|
17 | if(is_autowalking()) return false; |
| 13958 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 17 times.
|
17 | if(!--hoverclk) |
| 13959 | { | ||
| 13960 | ✗ | hoverflags |= HOV_OUT | HOV_PITFALL_OUT; | |
| 13961 | ✗ | return true; | |
| 13962 | } | ||
| 13963 | 17 | } | |
| 13964 | 6348 | return false; | |
| 13965 | 6348 | } | |
| 13966 | |||
| 13967 | 60757 | bool HeroClass::try_hover() | |
| 13968 | { | ||
| 13969 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 60757 times.
|
60757 | if(hoverclk > 0) return false; |
| 13970 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 60757 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
60757 | if(!(is_autowalking() && check_pitslide() != -1)) |
| 13971 | { | ||
| 13972 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 60755 times.
|
60757 | if(!can_use_item(itype_hoverboots,i_hoverboots)) return false; |
| 13973 |
2/4✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
|
2 | if(ladderx || laddery) return false; |
| 13974 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | if(hoverflags & HOV_OUT) return false; |
| 13975 | 2 | } | |
| 13976 | 2 | int32_t itemid = current_item_id(itype_hoverboots); | |
| 13977 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if(hoverclk < 0) |
| 13978 | ✗ | hoverclk = -hoverclk; | |
| 13979 | else | ||
| 13980 | { | ||
| 13981 | 2 | fall = fakefall = jumping = 0; | |
| 13982 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | if(itemsbuf[itemid].misc1) |
| 13983 | 2 | hoverclk = itemsbuf[itemid].misc1; | |
| 13984 | else | ||
| 13985 | { | ||
| 13986 | ✗ | hoverclk = 1; | |
| 13987 | ✗ | hoverflags |= HOV_INF; | |
| 13988 | } | ||
| 13989 | |||
| 13990 | 2 | sfx(itemsbuf[itemid].usesound,pan(x)); | |
| 13991 | } | ||
| 13992 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | if(itemsbuf[itemid].wpn) |
| 13993 |
3/6✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
2 | decorations.add(new dHover(x, y, dHOVER, 0)); |
| 13994 | 2 | return true; | |
| 13995 | 60757 | } | |
| 13996 | |||
| 13997 | //Returns bitwise; lower 8 are dir pulled in, next 16 are combo ID, 25th bit is bool for if can be resisted | ||
| 13998 | //Returns '-1' if not being pulled | ||
| 13999 | //Returns '-2' if should be falling in | ||
| 14000 | static const int32_t flag_pit_irresistable = (1<<24); | ||
| 14001 | 41875841 | int32_t HeroClass::check_pitslide(bool ignore_hover) | |
| 14002 | { | ||
| 14003 | //Pitfall todo -Emily | ||
| 14004 | //Iron boots; can't fight slipping, 2px/frame | ||
| 14005 | //Scripted variables to read pull dir/clk (clk only for non-hero) | ||
| 14006 | //Implement falling for all sprite types (npc AI) | ||
| 14007 | // Fall/slipping tiles for enemies | ||
| 14008 | // Fall/slipping SFX for enemies | ||
| 14009 | // Fall SFX for items/weapons | ||
| 14010 | // Weapons/Misc sprite shared for falling items/weapons | ||
| 14011 | //Maybe slip SFX for Hero? | ||
| 14012 | // Weapons/Misc sprite override for falling sprite? | ||
| 14013 | //Update std.zh with relevant new stuff | ||
| 14014 |
2/2✓ Branch 0 taken 1238105 times.
✓ Branch 1 taken 40637736 times.
|
41875841 | if(can_pitfall(ignore_hover)) |
| 14015 | { | ||
| 14016 | 40637736 | const int sens_offs = get_qr(qr_OLD_PIT_SENSITIVITY) ? 0 : 1; | |
| 14017 |
3/4✓ Branch 0 taken 14077118 times.
✓ Branch 1 taken 26560618 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 26560618 times.
|
40637736 | bool can_diag = (diagonalMovement || NO_GRIDLOCK); |
| 14018 | 40637736 | int32_t ispitul = getpitfall(x+sens_offs,y+(bigHitbox?0:8)+sens_offs); | |
| 14019 | 40637736 | int32_t ispitbl = getpitfall(x+sens_offs,y+15-sens_offs); | |
| 14020 | 40637736 | int32_t ispitur = getpitfall(x+15-sens_offs,y+(bigHitbox?0:8)+sens_offs); | |
| 14021 | 40637736 | int32_t ispitbr = getpitfall(x+15-sens_offs,y+15-sens_offs); | |
| 14022 | 40637736 | int32_t ispitul_50 = getpitfall(x+8,y+(bigHitbox?8:12)); | |
| 14023 | 40637736 | int32_t ispitbl_50 = getpitfall(x+8,y+(bigHitbox?7:11)); | |
| 14024 | 40637736 | int32_t ispitur_50 = getpitfall(x+7,y+(bigHitbox?8:12)); | |
| 14025 | 40637736 | int32_t ispitbr_50 = getpitfall(x+7,y+(bigHitbox?7:11)); | |
| 14026 | 40637736 | int32_t ispitul_75 = getpitfall(x+12,y+(bigHitbox?12:14)); | |
| 14027 | 40637736 | int32_t ispitbl_75 = getpitfall(x+12,y+(bigHitbox?3:9)); | |
| 14028 | 40637736 | int32_t ispitur_75 = getpitfall(x+3,y+(bigHitbox?12:14)); | |
| 14029 | 40637736 | int32_t ispitbr_75 = getpitfall(x+3,y+(bigHitbox?3:9)); | |
| 14030 |
5/5✓ Branch 0 taken 40581821 times.
✓ Branch 1 taken 5992 times.
✓ Branch 2 taken 672 times.
✓ Branch 3 taken 29959 times.
✓ Branch 4 taken 19292 times.
|
40637736 | switch((ispitul?1:0) + (ispitur?1:0) + (ispitbl?1:0) + (ispitbr?1:0)) |
| 14031 | { | ||
| 14032 | 5992 | case 4: return -2; //Fully over pit; fall in | |
| 14033 | case 3: | ||
| 14034 | { | ||
| 14035 |
6/6✓ Branch 0 taken 342 times.
✓ Branch 1 taken 330 times.
✓ Branch 2 taken 224 times.
✓ Branch 3 taken 118 times.
✓ Branch 4 taken 202 times.
✓ Branch 5 taken 22 times.
|
672 | if(ispitul && ispitur && ispitbl) //UL_3 |
| 14036 | { | ||
| 14037 |
1/2✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
|
22 | if(ispitul_50) |
| 14038 | { | ||
| 14039 |
5/6✓ Branch 0 taken 16 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 13 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 3 times.
|
22 | if (!ispitul_75 && (getInput(btnDown, INPUT_DRUNK | INPUT_HERO_ACTION) || getInput(btnRight, INPUT_DRUNK | INPUT_HERO_ACTION))) return -1; |
| 14040 | 9 | return (can_diag ? l_up : left) | (ispitul_75 ? flag_pit_irresistable : 0) | (ispitul << 8); | |
| 14041 | } | ||
| 14042 | ✗ | } | |
| 14043 |
5/6✓ Branch 0 taken 320 times.
✓ Branch 1 taken 330 times.
✓ Branch 2 taken 202 times.
✓ Branch 3 taken 118 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 202 times.
|
650 | else if(ispitul && ispitur && ispitbr) //UR_3 |
| 14044 | { | ||
| 14045 |
2/2✓ Branch 0 taken 30 times.
✓ Branch 1 taken 172 times.
|
202 | if(ispitur_50) |
| 14046 | { | ||
| 14047 |
5/6✓ Branch 0 taken 20 times.
✓ Branch 1 taken 10 times.
✓ Branch 2 taken 8 times.
✓ Branch 3 taken 12 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 8 times.
|
30 | if (!ispitur_75 && (getInput(btnDown, INPUT_DRUNK | INPUT_HERO_ACTION) || getInput(btnLeft, INPUT_DRUNK | INPUT_HERO_ACTION))) return -1; |
| 14048 | 18 | return (can_diag ? r_up : right) | (ispitur_75 ? flag_pit_irresistable : 0) | (ispitur << 8); | |
| 14049 | } | ||
| 14050 | 172 | } | |
| 14051 |
4/6✓ Branch 0 taken 118 times.
✓ Branch 1 taken 330 times.
✓ Branch 2 taken 118 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 118 times.
|
448 | else if(ispitul && ispitbl && ispitbr) //BL_3 |
| 14052 | { | ||
| 14053 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 108 times.
|
118 | if(ispitbl_50) |
| 14054 | { | ||
| 14055 |
4/6✓ Branch 0 taken 5 times.
✓ Branch 1 taken 5 times.
✓ Branch 2 taken 5 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 5 times.
|
10 | if (!ispitbl_75 && (getInput(btnUp, INPUT_DRUNK | INPUT_HERO_ACTION) || getInput(btnRight, INPUT_DRUNK | INPUT_HERO_ACTION))) return -1; |
| 14056 | 10 | return (can_diag ? l_down : left) | (ispitbl_75 ? flag_pit_irresistable : 0) | (ispitbl << 8); | |
| 14057 | } | ||
| 14058 | 108 | } | |
| 14059 |
3/6✓ Branch 0 taken 330 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 330 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 330 times.
|
330 | else if(ispitbl && ispitur && ispitbr) //BR_3 |
| 14060 | { | ||
| 14061 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 328 times.
|
330 | if(ispitbr_50) |
| 14062 | { | ||
| 14063 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
2 | if (!ispitbr_75 && (getInput(btnUp, INPUT_DRUNK | INPUT_HERO_ACTION) || getInput(btnLeft, INPUT_DRUNK | INPUT_HERO_ACTION))) return -1; |
| 14064 | 2 | return (can_diag ? r_down : right) | (ispitbr_75 ? flag_pit_irresistable : 0) | (ispitbr << 8); | |
| 14065 | } | ||
| 14066 | 328 | } | |
| 14067 | 608 | break; | |
| 14068 | } | ||
| 14069 | case 2: | ||
| 14070 | { | ||
| 14071 |
4/4✓ Branch 0 taken 15284 times.
✓ Branch 1 taken 14675 times.
✓ Branch 2 taken 13081 times.
✓ Branch 3 taken 2203 times.
|
29959 | if(ispitul && ispitur) //Up |
| 14072 | { | ||
| 14073 |
2/2✓ Branch 0 taken 96 times.
✓ Branch 1 taken 2107 times.
|
2203 | if (getInput(btnDown, INPUT_DRUNK | INPUT_HERO_ACTION)) |
| 14074 | { | ||
| 14075 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 96 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
96 | if(ispitul_75 && ispitur_75) //Straight up |
| 14076 | { | ||
| 14077 | ✗ | return up | flag_pit_irresistable | (ispitul << 8); | |
| 14078 | } | ||
| 14079 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 96 times.
|
96 | else if(ispitul_75) |
| 14080 | { | ||
| 14081 | ✗ | return (can_diag ? l_up : left) | flag_pit_irresistable | (ispitul << 8); | |
| 14082 | } | ||
| 14083 |
1/2✓ Branch 0 taken 96 times.
✗ Branch 1 not taken.
|
96 | else if(ispitur_75) |
| 14084 | { | ||
| 14085 | ✗ | return (can_diag ? r_up : right) | flag_pit_irresistable | (ispitur << 8); | |
| 14086 | } | ||
| 14087 | 96 | else return -1; | |
| 14088 | } | ||
| 14089 | else | ||
| 14090 | { | ||
| 14091 |
3/4✓ Branch 0 taken 179 times.
✓ Branch 1 taken 1928 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 179 times.
|
2107 | if(ispitul_50 && ispitur_50) //Straight up |
| 14092 | { | ||
| 14093 |
2/2✓ Branch 0 taken 67 times.
✓ Branch 1 taken 112 times.
|
179 | return up | ((ispitul_75 || ispitur_75) ? flag_pit_irresistable : 0) | (ispitul << 8); |
| 14094 | } | ||
| 14095 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1928 times.
|
1928 | else if(ispitul_50) |
| 14096 | { | ||
| 14097 | ✗ | if (getInput(btnRight, INPUT_DRUNK | INPUT_HERO_ACTION) && !ispitul_75) return -1; | |
| 14098 | ✗ | return (can_diag ? l_up : left) | (ispitul_75 ? flag_pit_irresistable : 0) | (ispitul << 8); | |
| 14099 | } | ||
| 14100 |
1/2✓ Branch 0 taken 1928 times.
✗ Branch 1 not taken.
|
1928 | else if(ispitur_50) |
| 14101 | { | ||
| 14102 | ✗ | if (getInput(btnLeft, INPUT_DRUNK | INPUT_HERO_ACTION) && !ispitur_75) return -1; | |
| 14103 | ✗ | return (can_diag ? r_up : right) | (ispitur_75 ? flag_pit_irresistable : 0) | (ispitur << 8); | |
| 14104 | } | ||
| 14105 | } | ||
| 14106 | 1928 | } | |
| 14107 |
4/4✓ Branch 0 taken 15745 times.
✓ Branch 1 taken 12011 times.
✓ Branch 2 taken 12967 times.
✓ Branch 3 taken 2778 times.
|
27756 | else if(ispitbl && ispitbr) //Down |
| 14108 | { | ||
| 14109 |
2/2✓ Branch 0 taken 63 times.
✓ Branch 1 taken 2715 times.
|
2778 | if (getInput(btnUp, INPUT_DRUNK | INPUT_HERO_ACTION)) |
| 14110 | { | ||
| 14111 |
3/4✓ Branch 0 taken 3 times.
✓ Branch 1 taken 60 times.
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
|
63 | if(ispitbl_75 && ispitbr_75) //Straight down |
| 14112 | { | ||
| 14113 | 3 | return down | flag_pit_irresistable | (ispitbl << 8); | |
| 14114 | } | ||
| 14115 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 60 times.
|
60 | else if(ispitbl_75) |
| 14116 | { | ||
| 14117 | ✗ | return (can_diag ? l_down : left) | flag_pit_irresistable | (ispitbl << 8); | |
| 14118 | } | ||
| 14119 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 60 times.
|
60 | else if(ispitbr_75) |
| 14120 | { | ||
| 14121 | ✗ | return (can_diag ? r_down : right) | flag_pit_irresistable | (ispitbr << 8); | |
| 14122 | } | ||
| 14123 | 60 | else return -1; | |
| 14124 | } | ||
| 14125 | else | ||
| 14126 | { | ||
| 14127 |
3/4✓ Branch 0 taken 59 times.
✓ Branch 1 taken 2656 times.
✓ Branch 2 taken 59 times.
✗ Branch 3 not taken.
|
2715 | if(ispitbl_50 && ispitbr_50) //Straight down |
| 14128 | { | ||
| 14129 |
2/2✓ Branch 0 taken 14 times.
✓ Branch 1 taken 45 times.
|
59 | return down | ((ispitbl_75 || ispitbr_75) ? flag_pit_irresistable : 0) | (ispitbl << 8); |
| 14130 | } | ||
| 14131 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2656 times.
|
2656 | else if(ispitbl_50) |
| 14132 | { | ||
| 14133 | ✗ | if (getInput(btnRight, INPUT_DRUNK | INPUT_HERO_ACTION) && !ispitbl_75) return -1; | |
| 14134 | ✗ | return (can_diag ? l_down : left) | (ispitbl_75 ? flag_pit_irresistable : 0) | (ispitbl << 8); | |
| 14135 | } | ||
| 14136 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2656 times.
|
2656 | else if(ispitbr_50) |
| 14137 | { | ||
| 14138 | ✗ | if (getInput(btnLeft, INPUT_DRUNK | INPUT_HERO_ACTION) && !ispitbr_75) return -1; | |
| 14139 | ✗ | return (can_diag ? r_down : right) | (ispitbr_75 ? flag_pit_irresistable : 0) | (ispitbr << 8); | |
| 14140 | } | ||
| 14141 | } | ||
| 14142 | 2656 | } | |
| 14143 |
4/4✓ Branch 0 taken 12967 times.
✓ Branch 1 taken 12011 times.
✓ Branch 2 taken 114 times.
✓ Branch 3 taken 12853 times.
|
24978 | else if(ispitbl && ispitul) //Left |
| 14144 | { | ||
| 14145 |
2/2✓ Branch 0 taken 720 times.
✓ Branch 1 taken 12133 times.
|
12853 | if (getInput(btnRight, INPUT_DRUNK | INPUT_HERO_ACTION)) |
| 14146 | { | ||
| 14147 |
3/4✓ Branch 0 taken 6 times.
✓ Branch 1 taken 714 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
|
720 | if(ispitul_75 && ispitbl_75) //Straight left |
| 14148 | { | ||
| 14149 | 6 | return left | flag_pit_irresistable | (ispitul << 8); | |
| 14150 | } | ||
| 14151 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 714 times.
|
714 | else if(ispitul_75) |
| 14152 | { | ||
| 14153 | ✗ | return (can_diag ? l_up : up) | flag_pit_irresistable | (ispitul << 8); | |
| 14154 | } | ||
| 14155 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 714 times.
|
714 | else if(ispitbl_75) |
| 14156 | { | ||
| 14157 | ✗ | return (can_diag ? l_down : down) | flag_pit_irresistable | (ispitbl << 8); | |
| 14158 | } | ||
| 14159 | 714 | else return -1; | |
| 14160 | } | ||
| 14161 | else | ||
| 14162 | { | ||
| 14163 |
3/4✓ Branch 0 taken 393 times.
✓ Branch 1 taken 11740 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 393 times.
|
12133 | if(ispitul_50 && ispitbl_50) //Straight left |
| 14164 | { | ||
| 14165 |
2/2✓ Branch 0 taken 132 times.
✓ Branch 1 taken 261 times.
|
393 | return left | ((ispitul_75 || ispitbl_75) ? flag_pit_irresistable : 0) | (ispitul << 8); |
| 14166 | } | ||
| 14167 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11740 times.
|
11740 | else if(ispitul_50) |
| 14168 | { | ||
| 14169 | ✗ | if (getInput(btnDown, INPUT_DRUNK | INPUT_HERO_ACTION) && !ispitul_75) return -1; | |
| 14170 | ✗ | return (can_diag ? l_up : up) | (ispitul_75 ? flag_pit_irresistable : 0) | (ispitul << 8); | |
| 14171 | } | ||
| 14172 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11740 times.
|
11740 | else if(ispitbl_50) |
| 14173 | { | ||
| 14174 | ✗ | if (getInput(btnUp, INPUT_DRUNK | INPUT_HERO_ACTION) && !ispitbl_75) return -1; | |
| 14175 | ✗ | return (can_diag ? l_down : down) | (ispitbl_75 ? flag_pit_irresistable : 0) | (ispitbl << 8); | |
| 14176 | } | ||
| 14177 | } | ||
| 14178 | 11740 | } | |
| 14179 |
4/4✓ Branch 0 taken 12011 times.
✓ Branch 1 taken 114 times.
✓ Branch 2 taken 228 times.
✓ Branch 3 taken 11783 times.
|
12125 | else if(ispitbr && ispitur) //Right |
| 14180 | { | ||
| 14181 |
2/2✓ Branch 0 taken 717 times.
✓ Branch 1 taken 11066 times.
|
11783 | if (getInput(btnLeft, INPUT_DRUNK | INPUT_HERO_ACTION)) |
| 14182 | { | ||
| 14183 |
3/4✓ Branch 0 taken 13 times.
✓ Branch 1 taken 704 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 13 times.
|
717 | if(ispitur_75 && ispitbr_75) //Straight right |
| 14184 | { | ||
| 14185 | 13 | return right | flag_pit_irresistable | (ispitur << 8); | |
| 14186 | } | ||
| 14187 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 704 times.
|
704 | else if(ispitur_75) |
| 14188 | { | ||
| 14189 | ✗ | return (can_diag ? r_up : up) | flag_pit_irresistable | (ispitur << 8); | |
| 14190 | } | ||
| 14191 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 704 times.
|
704 | else if(ispitbr_75) |
| 14192 | { | ||
| 14193 | ✗ | return (can_diag ? r_down : down) | flag_pit_irresistable | (ispitbr << 8); | |
| 14194 | } | ||
| 14195 | 704 | else return -1; | |
| 14196 | } | ||
| 14197 | else | ||
| 14198 | { | ||
| 14199 |
3/4✓ Branch 0 taken 468 times.
✓ Branch 1 taken 10598 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 468 times.
|
11066 | if(ispitur_50 && ispitbr_50) //Straight right |
| 14200 | { | ||
| 14201 |
2/2✓ Branch 0 taken 282 times.
✓ Branch 1 taken 186 times.
|
468 | return right | ((ispitur_75 || ispitbr_75) ? flag_pit_irresistable : 0) | (ispitur << 8); |
| 14202 | } | ||
| 14203 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10598 times.
|
10598 | else if(ispitur_50) |
| 14204 | { | ||
| 14205 | ✗ | if (getInput(btnDown, INPUT_DRUNK | INPUT_HERO_ACTION) && !ispitur_75) return -1; | |
| 14206 | ✗ | return (can_diag ? r_up : up) | (ispitur_75 ? flag_pit_irresistable : 0) | (ispitur << 8); | |
| 14207 | } | ||
| 14208 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10598 times.
|
10598 | else if(ispitbr_50) |
| 14209 | { | ||
| 14210 | ✗ | if (getInput(btnUp, INPUT_DRUNK | INPUT_HERO_ACTION) && !ispitbr_75) return -1; | |
| 14211 | ✗ | return (can_diag ? r_down : down) | (ispitbr_75 ? flag_pit_irresistable : 0) | (ispitbr << 8); | |
| 14212 | } | ||
| 14213 | } | ||
| 14214 | 10598 | } | |
| 14215 | 27264 | break; | |
| 14216 | } | ||
| 14217 | case 1: | ||
| 14218 | { | ||
| 14219 |
4/4✓ Branch 0 taken 5795 times.
✓ Branch 1 taken 13497 times.
✓ Branch 2 taken 5792 times.
✓ Branch 3 taken 3 times.
|
19292 | if(ispitul && ispitul_50) //UL_1 |
| 14220 | { | ||
| 14221 |
3/6✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 3 times.
|
3 | if (!ispitul_75 && (getInput(btnDown, INPUT_DRUNK | INPUT_HERO_ACTION) || getInput(btnRight, INPUT_DRUNK | INPUT_HERO_ACTION))) return -1; |
| 14222 | 3 | return (can_diag ? l_up : left) | (ispitul_75 ? flag_pit_irresistable : 0) | (ispitul << 8); | |
| 14223 | } | ||
| 14224 |
4/4✓ Branch 0 taken 4496 times.
✓ Branch 1 taken 14793 times.
✓ Branch 2 taken 4423 times.
✓ Branch 3 taken 73 times.
|
19289 | if(ispitur && ispitur_50) //UR_1 |
| 14225 | { | ||
| 14226 |
6/6✓ Branch 0 taken 70 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 57 times.
✓ Branch 3 taken 13 times.
✓ Branch 4 taken 30 times.
✓ Branch 5 taken 27 times.
|
73 | if (!ispitur_75 && (getInput(btnDown, INPUT_DRUNK | INPUT_HERO_ACTION) || getInput(btnLeft, INPUT_DRUNK | INPUT_HERO_ACTION))) return -1; |
| 14227 | 30 | return (can_diag ? r_up : right) | (ispitur_75 ? flag_pit_irresistable : 0) | (ispitur << 8); | |
| 14228 | } | ||
| 14229 |
4/4✓ Branch 0 taken 3757 times.
✓ Branch 1 taken 15459 times.
✓ Branch 2 taken 3749 times.
✓ Branch 3 taken 8 times.
|
19216 | if(ispitbl && ispitbl_50) //BL_1 |
| 14230 | { | ||
| 14231 |
4/6✓ Branch 0 taken 8 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2 times.
✓ Branch 5 taken 6 times.
|
8 | if (!ispitbl_75 && (getInput(btnUp, INPUT_DRUNK | INPUT_HERO_ACTION) || getInput(btnRight, INPUT_DRUNK | INPUT_HERO_ACTION))) return -1; |
| 14232 | 6 | return (can_diag ? l_down : left) | (ispitbl_75 ? flag_pit_irresistable : 0) | (ispitbl << 8); | |
| 14233 | } | ||
| 14234 |
4/4✓ Branch 0 taken 5244 times.
✓ Branch 1 taken 13964 times.
✓ Branch 2 taken 5187 times.
✓ Branch 3 taken 57 times.
|
19208 | if(ispitbr && ispitbr_50) //BR_1 |
| 14235 | { | ||
| 14236 |
5/6✓ Branch 0 taken 57 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 34 times.
✓ Branch 3 taken 23 times.
✓ Branch 4 taken 21 times.
✓ Branch 5 taken 13 times.
|
57 | if (!ispitbr_75 && (getInput(btnUp, INPUT_DRUNK | INPUT_HERO_ACTION) || getInput(btnLeft, INPUT_DRUNK | INPUT_HERO_ACTION))) return -1; |
| 14237 | 13 | return (can_diag ? r_down : right) | (ispitbr_75 ? flag_pit_irresistable : 0) | (ispitbr << 8); | |
| 14238 | } | ||
| 14239 | 19151 | break; | |
| 14240 | } | ||
| 14241 | } | ||
| 14242 | 40628844 | } | |
| 14243 | 41866949 | return -1; | |
| 14244 | 41875841 | } | |
| 14245 | |||
| 14246 | 1075368 | static bool replay_compat_check_zc_version_2_55_11() | |
| 14247 | { | ||
| 14248 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1075368 times.
|
1075368 | if (!replay_is_active()) |
| 14249 | ✗ | return false; | |
| 14250 | |||
| 14251 | 1075368 | auto zc_version_created = replay_get_zc_version_created(); | |
| 14252 |
2/2✓ Branch 0 taken 55 times.
✓ Branch 1 taken 1075313 times.
|
1075368 | if (zc_version_created.well_formed) |
| 14253 | { | ||
| 14254 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1075313 times.
|
1075313 | if (zc_version_created.major < 2) |
| 14255 | ✗ | return true; // Replays didn't exist at this point ... but whatever. | |
| 14256 |
3/4✓ Branch 0 taken 724141 times.
✓ Branch 1 taken 351172 times.
✓ Branch 2 taken 724141 times.
✗ Branch 3 not taken.
|
1075313 | if (zc_version_created.major == 2 && zc_version_created.minor < 55) |
| 14257 | ✗ | return true; // Replays didn't exist at this point ... but whatever. | |
| 14258 |
4/6✓ Branch 0 taken 724141 times.
✓ Branch 1 taken 351172 times.
✓ Branch 2 taken 724141 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 724141 times.
✗ Branch 5 not taken.
|
1075313 | if (zc_version_created.major == 2 && zc_version_created.minor == 55 && zc_version_created.patch < 11) |
| 14259 | 724141 | return true; | |
| 14260 | 351172 | } | |
| 14261 | |||
| 14262 | 351227 | return replay_version_check(45); | |
| 14263 | 1075368 | } | |
| 14264 | |||
| 14265 | 1075364 | static bool replay_compat_pitslide_bug() | |
| 14266 | { | ||
| 14267 |
2/2✓ Branch 0 taken 726071 times.
✓ Branch 1 taken 349293 times.
|
1075364 | if (replay_compat_check_zc_version_2_55_11()) |
| 14268 | 726071 | return true; | |
| 14269 | |||
| 14270 | 349293 | return !replay_version_check(45); | |
| 14271 | 1075364 | } | |
| 14272 | |||
| 14273 | 4 | static bool replay_compat_held_items_only_held_always_bug() | |
| 14274 | { | ||
| 14275 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | if (replay_compat_check_zc_version_2_55_11()) |
| 14276 | 4 | return true; | |
| 14277 | |||
| 14278 | ✗ | return !replay_version_check(44); | |
| 14279 | 4 | } | |
| 14280 | |||
| 14281 | 12412901 | bool HeroClass::pitslide() //Runs pitslide movement; returns true if pit is irresistable | |
| 14282 | { | ||
| 14283 | 12412901 | pitfall(); | |
| 14284 |
2/2✓ Branch 0 taken 34 times.
✓ Branch 1 taken 12412867 times.
|
12412901 | if(fallclk) return true; |
| 14285 | 12412867 | int32_t val = check_pitslide(); | |
| 14286 | //Val should not be -2 here; if -2 would have been returned, the 'return true' above should have triggered! | ||
| 14287 |
2/2✓ Branch 0 taken 292 times.
✓ Branch 1 taken 12412575 times.
|
12412867 | if(val == -1) |
| 14288 | { | ||
| 14289 | 12412575 | pit_pulldir = -1; | |
| 14290 | 12412575 | pit_pullclk = 0; | |
| 14291 | 12412575 | return false; | |
| 14292 | } | ||
| 14293 | 292 | bool irresistable = val & (replay_compat_pitslide_bug() ? 0x100 : flag_pit_irresistable); | |
| 14294 | 292 | int32_t dir = val&0xFF; | |
| 14295 | 292 | int32_t cmbid = (val&0xFFFF00)>>8; | |
| 14296 | 292 | int32_t sensitivity = combobuf[cmbid].attribytes[2]; | |
| 14297 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 292 times.
|
292 | if(combobuf[cmbid].usrflags&cflag5) //No pull at all |
| 14298 | { | ||
| 14299 | ✗ | pit_pulldir = -1; | |
| 14300 | ✗ | pit_pullclk = 0; | |
| 14301 | ✗ | return false; | |
| 14302 | } | ||
| 14303 |
4/6✓ Branch 0 taken 292 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 292 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 290 times.
✓ Branch 5 taken 2 times.
|
292 | if(dir > -1 && !(hoverflags & HOV_PITFALL_OUT) && try_hover()) //Engage hovers |
| 14304 | { | ||
| 14305 | 2 | pit_pulldir = -1; | |
| 14306 | 2 | pit_pullclk = 0; | |
| 14307 | 2 | return false; | |
| 14308 | } | ||
| 14309 | 290 | pit_pulldir = dir; | |
| 14310 | 290 | int32_t step = 1; | |
| 14311 |
2/2✓ Branch 0 taken 242 times.
✓ Branch 1 taken 48 times.
|
290 | if(sensitivity == 0) |
| 14312 | { | ||
| 14313 | 48 | step = 2; | |
| 14314 | 48 | sensitivity = 1; | |
| 14315 | 48 | } | |
| 14316 |
2/2✓ Branch 0 taken 69 times.
✓ Branch 1 taken 221 times.
|
290 | if(pit_pullclk++ % sensitivity) //No pull this frame |
| 14317 | 69 | return irresistable; | |
| 14318 |
4/4✓ Branch 0 taken 212 times.
✓ Branch 1 taken 269 times.
✓ Branch 2 taken 260 times.
✓ Branch 3 taken 221 times.
|
481 | for(; step > 0 && !fallclk; --step) |
| 14319 | { | ||
| 14320 |
3/3✓ Branch 0 taken 81 times.
✓ Branch 1 taken 116 times.
✓ Branch 2 taken 63 times.
|
260 | switch(dir) |
| 14321 | { | ||
| 14322 | case l_up: case l_down: case left: | ||
| 14323 | 81 | --x; break; | |
| 14324 | case r_up: case r_down: case right: | ||
| 14325 | 116 | ++x; break; | |
| 14326 | } | ||
| 14327 |
3/3✓ Branch 0 taken 52 times.
✓ Branch 1 taken 35 times.
✓ Branch 2 taken 173 times.
|
260 | switch(dir) |
| 14328 | { | ||
| 14329 | case l_up: case r_up: case up: | ||
| 14330 | 52 | --y; break; | |
| 14331 | case l_down: case r_down: case down: | ||
| 14332 | 35 | ++y; break; | |
| 14333 | } | ||
| 14334 | 260 | pitfall(); | |
| 14335 | 260 | } | |
| 14336 |
2/2✓ Branch 0 taken 171 times.
✓ Branch 1 taken 50 times.
|
221 | return fallclk || irresistable; |
| 14337 | 12412901 | } | |
| 14338 | |||
| 14339 | 12419041 | bool HeroClass::pitfall() | |
| 14340 | { | ||
| 14341 | 12419041 | const int sens_offs = get_qr(qr_OLD_PIT_SENSITIVITY) ? 0 : 1; | |
| 14342 | 12419041 | zfix x1 = x + sens_offs, x2 = x + 15 - sens_offs; | |
| 14343 | 12419041 | zfix y1 = y + (bigHitbox?0:8) + sens_offs, y2 = y + 15 - sens_offs; | |
| 14344 | 12419041 | zfix cx = x + 8, cy = y + (bigHitbox?8:12); | |
| 14345 |
2/2✓ Branch 0 taken 5880 times.
✓ Branch 1 taken 12413161 times.
|
12419041 | if(fallclk) |
| 14346 | { | ||
| 14347 | 5880 | drop_liftwpn(); | |
| 14348 |
3/4✓ Branch 0 taken 84 times.
✓ Branch 1 taken 5796 times.
✓ Branch 2 taken 84 times.
✗ Branch 3 not taken.
|
5880 | if(fallclk == PITFALL_FALL_FRAMES && fallCombo) sfx(combobuf[fallCombo].attribytes[0], pan(x)); |
| 14349 | //Handle falling | ||
| 14350 |
2/2✓ Branch 0 taken 5796 times.
✓ Branch 1 taken 84 times.
|
5880 | if(!--fallclk) |
| 14351 | { | ||
| 14352 | 84 | optional<combined_handle_t> comb_handle; | |
| 14353 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 84 times.
✓ Branch 2 taken 80 times.
✓ Branch 3 taken 4 times.
|
84 | if((comb_handle = get_pitfall_handle(cx, cy)) && comb_handle->data() == fallCombo) /*nil*/; |
| 14354 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
|
4 | else if((comb_handle = get_pitfall_handle(x1, y1)) && comb_handle->data() == fallCombo) /*nil*/; |
| 14355 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
|
4 | else if((comb_handle = get_pitfall_handle(x2, y1)) && comb_handle->data() == fallCombo) /*nil*/; |
| 14356 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 3 times.
|
4 | else if((comb_handle = get_pitfall_handle(x1, y2)) && comb_handle->data() == fallCombo) /*nil*/; |
| 14357 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
|
3 | else if((comb_handle = get_pitfall_handle(x2, y2)) && comb_handle->data() == fallCombo) /*nil*/; |
| 14358 | ✗ | else comb_handle = nullopt; // nothing found, no `CType Causes->` | |
| 14359 | |||
| 14360 | 84 | std::vector<int32_t> &ev = FFCore.eventData; | |
| 14361 | 84 | ev.clear(); | |
| 14362 | 84 | ev.push_back(fallCombo*10000); | |
| 14363 | |||
| 14364 | 84 | throwGenScriptEvent(GENSCR_EVENT_PLAYER_FALL); | |
| 14365 | |||
| 14366 | 84 | fallCombo = ev[0]/10000; | |
| 14367 |
2/4✓ Branch 0 taken 84 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 84 times.
|
84 | if(fallCombo < 0 || fallCombo >= MAXCOMBOS) |
| 14368 | ✗ | fallCombo = 0; | |
| 14369 | |||
| 14370 | 84 | int32_t dmg = game->get_hp_per_heart()/4; | |
| 14371 | 84 | bool dmg_perc = false; | |
| 14372 | 84 | bool warp = false; | |
| 14373 | |||
| 14374 | 84 | action=none; FFCore.setHeroAction(none); | |
| 14375 |
1/2✓ Branch 0 taken 84 times.
✗ Branch 1 not taken.
|
84 | newcombo* cmb = fallCombo ? &combobuf[fallCombo] : NULL; |
| 14376 |
1/2✓ Branch 0 taken 84 times.
✗ Branch 1 not taken.
|
84 | if(cmb) |
| 14377 | { | ||
| 14378 | 84 | dmg = cmb->attributes[0]/10000L; | |
| 14379 | 84 | dmg_perc = cmb->usrflags&cflag3; | |
| 14380 | 84 | warp = cmb->usrflags&cflag1; | |
| 14381 | 84 | } | |
| 14382 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 84 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
84 | if(cheat_superman && dmg > 0) |
| 14383 | ✗ | dmg = 0; | |
| 14384 |
2/2✓ Branch 0 taken 35 times.
✓ Branch 1 taken 49 times.
|
84 | if(dmg) //Damage |
| 14385 | { | ||
| 14386 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 49 times.
|
49 | if(dmg > 0) |
| 14387 | { | ||
| 14388 | 49 | hclk=48; //IFrames only if damaged, not if healed | |
| 14389 | 49 | check_on_hit(); | |
| 14390 | 49 | } | |
| 14391 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 49 times.
|
49 | game->set_life(vbound(int32_t(dmg_perc ? game->get_life() - ((vbound(dmg,-100,100)/100.0)*game->get_maxlife()) : (game->get_life()-int64_t(dmg))),0,game->get_maxlife())); |
| 14392 | 49 | } | |
| 14393 | |||
| 14394 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 84 times.
|
84 | if(comb_handle) |
| 14395 | 84 | do_trigger_ctype_causes(*comb_handle); | |
| 14396 | |||
| 14397 |
2/2✓ Branch 0 taken 26 times.
✓ Branch 1 taken 58 times.
|
84 | if(warp) //Warp |
| 14398 | { | ||
| 14399 | 26 | sdir = dir; | |
| 14400 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 21 times.
|
26 | if(cmb->usrflags&cflag2) //Direct Warp |
| 14401 | { | ||
| 14402 | 21 | setpit(); | |
| 14403 | 21 | } | |
| 14404 | 26 | dowarp(hero_scr, 0, vbound(cmb->attribytes[1],0,3), 0); | |
| 14405 | 26 | } | |
| 14406 | else //Reset to screen entry | ||
| 14407 | { | ||
| 14408 | 58 | go_respawn_point(); | |
| 14409 | } | ||
| 14410 | 84 | } | |
| 14411 | 5880 | return true; | |
| 14412 | } | ||
| 14413 |
2/2✓ Branch 0 taken 447854 times.
✓ Branch 1 taken 11965307 times.
|
12413161 | else if(can_pitfall()) |
| 14414 | { | ||
| 14415 | 11965307 | bool ispitul = ispitfall(x1,y1); | |
| 14416 | 11965307 | bool ispitbl = ispitfall(x1,y2); | |
| 14417 | 11965307 | bool ispitur = ispitfall(x2,y1); | |
| 14418 | 11965307 | bool ispitbr = ispitfall(x2,y2); | |
| 14419 | 11965307 | int32_t pitctr = getpitfall(cx,cy); | |
| 14420 |
9/10✓ Branch 0 taken 5128 times.
✓ Branch 1 taken 11960179 times.
✓ Branch 2 taken 3156 times.
✓ Branch 3 taken 1972 times.
✓ Branch 4 taken 91 times.
✓ Branch 5 taken 3065 times.
✓ Branch 6 taken 84 times.
✓ Branch 7 taken 7 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 84 times.
|
11965307 | if(ispitul && ispitbl && ispitur && ispitbr && pitctr) |
| 14421 | { | ||
| 14422 |
2/4✓ Branch 0 taken 84 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 84 times.
✗ Branch 3 not taken.
|
84 | if(!(hoverflags & HOV_PITFALL_OUT) && try_hover()) return false; |
| 14423 |
1/2✓ Branch 0 taken 84 times.
✗ Branch 1 not taken.
|
84 | if(get_qr(qr_OLD_PIT_SENSITIVITY)) |
| 14424 | { | ||
| 14425 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 84 times.
✓ Branch 2 taken 53 times.
✓ Branch 3 taken 31 times.
|
84 | if(!bigHitbox && !ispitfall(x+8,y)) //Make the falling sprite fully over the pit |
| 14426 | 31 | y = (y.getInt() + 8 - (y.getInt() % 8)); | |
| 14427 | 84 | } | |
| 14428 | else | ||
| 14429 | { | ||
| 14430 | ✗ | if (!ispitfall(x+8, y)) | |
| 14431 | { | ||
| 14432 | ✗ | for(int q = 1; q < (bigHitbox ? 8 : 12); ++q) | |
| 14433 | ✗ | if(ispitfall(x+8, y+q)) | |
| 14434 | { | ||
| 14435 | ✗ | y += q; //Make the falling sprite fully over the pit | |
| 14436 | ✗ | break; | |
| 14437 | } | ||
| 14438 | ✗ | } | |
| 14439 | ✗ | if (!ispitfall(x+8, y+15)) | |
| 14440 | { | ||
| 14441 | ✗ | for(int q = 1; q < 8; ++q) | |
| 14442 | ✗ | if(ispitfall(x+8, y+15-q)) | |
| 14443 | { | ||
| 14444 | ✗ | y -= q; //Make the falling sprite fully over the pit | |
| 14445 | ✗ | break; | |
| 14446 | } | ||
| 14447 | ✗ | } | |
| 14448 | ✗ | if (!ispitfall(x, y+8)) | |
| 14449 | { | ||
| 14450 | ✗ | for(int q = 1; q < 8; ++q) | |
| 14451 | ✗ | if(ispitfall(x+q, y+8)) | |
| 14452 | { | ||
| 14453 | ✗ | x += q; //Make the falling sprite fully over the pit | |
| 14454 | ✗ | break; | |
| 14455 | } | ||
| 14456 | ✗ | } | |
| 14457 | ✗ | if (!ispitfall(x+15, y+8)) | |
| 14458 | { | ||
| 14459 | ✗ | for(int q = 1; q < 8; ++q) | |
| 14460 | ✗ | if(ispitfall(x+15-q, y+8)) | |
| 14461 | { | ||
| 14462 | ✗ | x -= q; //Make the falling sprite fully over the pit | |
| 14463 | ✗ | break; | |
| 14464 | } | ||
| 14465 | ✗ | } | |
| 14466 | } | ||
| 14467 | 84 | fallclk = PITFALL_FALL_FRAMES; | |
| 14468 | 84 | fallCombo = pitctr; | |
| 14469 | 84 | action=falling; FFCore.setHeroAction(falling); | |
| 14470 | 84 | spins = 0; | |
| 14471 | 84 | charging = 0; | |
| 14472 | 84 | drop_liftwpn(); | |
| 14473 | 84 | return true; | |
| 14474 | } | ||
| 14475 | 11965223 | } | |
| 14476 | 12413077 | return false; | |
| 14477 | 12419041 | } | |
| 14478 | |||
| 14479 | ✗ | bool HeroClass::try_drown() | |
| 14480 | { | ||
| 14481 | ✗ | if(ladderx || laddery) return false; | |
| 14482 | ✗ | if(action == drowning || action == lavadrowning) return true; | |
| 14483 | ✗ | int water = onWater(true); | |
| 14484 | ✗ | if(!water) return false; | |
| 14485 | ✗ | drownCombo = water; | |
| 14486 | ✗ | if (combobuf[water].usrflags&cflag1) | |
| 14487 | ✗ | Drown(1); | |
| 14488 | ✗ | else Drown(); | |
| 14489 | ✗ | if(byte drown_sfx = combobuf[water].attribytes[4]) | |
| 14490 | ✗ | sfx(drown_sfx, pan(x)); | |
| 14491 | ✗ | return true; | |
| 14492 | ✗ | } | |
| 14493 | |||
| 14494 | 160 | void HeroClass::handle_slide(newcombo const& icecmb, zfix& dx, zfix& dy) | |
| 14495 | { | ||
| 14496 |
1/2✓ Branch 0 taken 160 times.
✗ Branch 1 not taken.
|
160 | bool is_inair = z || fakez; |
| 14497 | 160 | zfix odx = dx, ody = dy; | |
| 14498 |
3/4✓ Branch 0 taken 155 times.
✓ Branch 1 taken 5 times.
✓ Branch 2 taken 155 times.
✗ Branch 3 not taken.
|
160 | if(sliding == 2 && !is_inair) //landed from air-sliding |
| 14499 | { | ||
| 14500 | ✗ | if((ice_vx+odx).sign() != ice_vx.sign()) | |
| 14501 | ✗ | ice_vx = 0; | |
| 14502 | ✗ | if((ice_vy+ody).sign() != ice_vy.sign()) | |
| 14503 | ✗ | ice_vy = 0; | |
| 14504 | ✗ | sliding = 1; | |
| 14505 | ✗ | } | |
| 14506 |
1/2✓ Branch 0 taken 160 times.
✗ Branch 1 not taken.
|
160 | if(!sliding) //just hit the ice |
| 14507 | { | ||
| 14508 | ✗ | if(is_inair) | |
| 14509 | ✗ | return; | |
| 14510 | ✗ | sliding = 1; | |
| 14511 | ✗ | zfix start_perc = icecmb.attribytes[0] / 100_zf; | |
| 14512 | ✗ | ice_vx = dx * start_perc; | |
| 14513 | ✗ | ice_vy = dy * start_perc; | |
| 14514 | ✗ | ice_entry_count = ice_entry_mcount = icecmb.attribytes[1]; | |
| 14515 | ✗ | } | |
| 14516 | else //not the first frame sliding | ||
| 14517 | { | ||
| 14518 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 160 times.
|
160 | if(is_inair) |
| 14519 | 160 | sliding = 2; | |
| 14520 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 160 times.
|
160 | zfix accel = zslongToFix(zc_max(1,icecmb.attributes[0])); |
| 14521 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 160 times.
|
160 | zfix decel = zslongToFix(zc_max(1,icecmb.attributes[1])); |
| 14522 | |||
| 14523 |
1/2✓ Branch 0 taken 160 times.
✗ Branch 1 not taken.
|
160 | if(ice_entry_count) |
| 14524 | { | ||
| 14525 | ✗ | if(--ice_entry_count) | |
| 14526 | { | ||
| 14527 | ✗ | zfix perc = zfix(ice_entry_count)/ice_entry_mcount; | |
| 14528 | ✗ | perc *= perc; //square the portion, for a better transition | |
| 14529 | ✗ | zfix normal_rate = zfix(steprate)/100/2; | |
| 14530 | ✗ | decel = (perc*normal_rate)+((1-perc)*decel); | |
| 14531 | ✗ | } | |
| 14532 | ✗ | } | |
| 14533 | //!TODO Traction Boots can be added here, with a multiplier on accel/decel | ||
| 14534 | //Accelerate in the pushed direction | ||
| 14535 |
1/2✓ Branch 0 taken 160 times.
✗ Branch 1 not taken.
|
160 | if(is_inair) |
| 14536 | { | ||
| 14537 | static const int air_accel = 100; | ||
| 14538 | 160 | accel = abs(odx)/air_accel; | |
| 14539 |
1/2✓ Branch 0 taken 160 times.
✗ Branch 1 not taken.
|
160 | if(accel) |
| 14540 | { | ||
| 14541 | ✗ | if(odx < 0) | |
| 14542 | { | ||
| 14543 | ✗ | if(ice_vx - accel < odx) | |
| 14544 | { | ||
| 14545 | ✗ | if(ice_vx > odx) | |
| 14546 | ✗ | ice_vx = odx; | |
| 14547 | ✗ | else odx = 0; //allow decel | |
| 14548 | ✗ | } | |
| 14549 | ✗ | else ice_vx -= accel; | |
| 14550 | ✗ | } | |
| 14551 | else //if(odx > 0) | ||
| 14552 | { | ||
| 14553 | ✗ | if(ice_vx + accel > odx) | |
| 14554 | { | ||
| 14555 | ✗ | if(ice_vx < odx) | |
| 14556 | ✗ | ice_vx = odx; | |
| 14557 | ✗ | else odx = 0; //allow decel | |
| 14558 | ✗ | } | |
| 14559 | ✗ | else ice_vx += accel; | |
| 14560 | } | ||
| 14561 | ✗ | } | |
| 14562 | 160 | accel = abs(ody)/air_accel; | |
| 14563 |
1/2✓ Branch 0 taken 160 times.
✗ Branch 1 not taken.
|
160 | if(accel) |
| 14564 | { | ||
| 14565 | ✗ | if(ody < 0) | |
| 14566 | { | ||
| 14567 | ✗ | if(ice_vy - accel < ody) | |
| 14568 | { | ||
| 14569 | ✗ | if(ice_vy > ody) | |
| 14570 | ✗ | ice_vy = ody; | |
| 14571 | ✗ | else ody = 0; //allow decel | |
| 14572 | ✗ | } | |
| 14573 | ✗ | else ice_vy -= accel; | |
| 14574 | ✗ | } | |
| 14575 | else //if(ody > 0) | ||
| 14576 | { | ||
| 14577 | ✗ | if(ice_vy + accel > ody) | |
| 14578 | { | ||
| 14579 | ✗ | if(ice_vy < ody) | |
| 14580 | ✗ | ice_vy = ody; | |
| 14581 | ✗ | else ody = 0; //allow decel | |
| 14582 | ✗ | } | |
| 14583 | ✗ | else ice_vy += accel; | |
| 14584 | } | ||
| 14585 | ✗ | } | |
| 14586 | 160 | } | |
| 14587 | ✗ | else if(accel) | |
| 14588 | { | ||
| 14589 | ✗ | if(odx > 0) | |
| 14590 | ✗ | ice_vx += accel; | |
| 14591 | ✗ | else if(odx < 0) | |
| 14592 | ✗ | ice_vx -= accel; | |
| 14593 | ✗ | if(ody > 0) | |
| 14594 | ✗ | ice_vy += accel; | |
| 14595 | ✗ | else if(ody < 0) | |
| 14596 | ✗ | ice_vy -= accel; | |
| 14597 | ✗ | } | |
| 14598 | //Decelerate in non-pushed direction | ||
| 14599 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 160 times.
|
160 | if(is_inair) |
| 14600 | 160 | decel = zinit.air_drag; | |
| 14601 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 160 times.
|
160 | if(decel) |
| 14602 | { | ||
| 14603 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 160 times.
|
160 | if(ice_vx) |
| 14604 | { | ||
| 14605 |
2/4✓ Branch 0 taken 160 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 160 times.
✗ Branch 3 not taken.
|
160 | if(!odx && abs(ice_vx) < decel) |
| 14606 | ✗ | ice_vx = 0; | |
| 14607 |
3/4✓ Branch 0 taken 96 times.
✓ Branch 1 taken 64 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 96 times.
|
160 | else if(ice_vx > 0 && odx <= 0) |
| 14608 | 96 | ice_vx -= decel; | |
| 14609 |
2/4✓ Branch 0 taken 64 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 64 times.
|
64 | else if(ice_vx < 0 && odx >= 0) |
| 14610 | 64 | ice_vx += decel; | |
| 14611 | 160 | } | |
| 14612 |
1/2✓ Branch 0 taken 160 times.
✗ Branch 1 not taken.
|
160 | if(ice_vy) |
| 14613 | { | ||
| 14614 | ✗ | if(!ody && abs(ice_vy) < decel) | |
| 14615 | ✗ | ice_vy = 0; | |
| 14616 | ✗ | else if(ice_vy > 0 && ody <= 0) | |
| 14617 | ✗ | ice_vy -= decel; | |
| 14618 | ✗ | else if(ice_vy < 0 && ody >= 0) | |
| 14619 | ✗ | ice_vy += decel; | |
| 14620 | ✗ | } | |
| 14621 | 160 | } | |
| 14622 | } | ||
| 14623 |
1/2✓ Branch 0 taken 160 times.
✗ Branch 1 not taken.
|
160 | zfix cap = zslongToFix(zc_max(1,abs(icecmb.attributes[2]))); |
| 14624 | 160 | dx = ice_vx = vbound(ice_vx, -cap, cap); | |
| 14625 | 160 | dy = ice_vy = vbound(ice_vy, -cap, cap); | |
| 14626 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 160 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
160 | if(!dx && !dy) |
| 14627 | ✗ | ice_entry_count = 0; | |
| 14628 | 160 | } | |
| 14629 | 596106 | void HeroClass::mod_steps(std::vector<zfix*>& v) | |
| 14630 | { | ||
| 14631 |
3/4✓ Branch 0 taken 595426 times.
✓ Branch 1 taken 680 times.
✓ Branch 2 taken 595426 times.
✗ Branch 3 not taken.
|
596106 | bool can_combo = ((z==0 && fakez==0) || hero_scr->flags2&fAIRCOMBOS); |
| 14632 |
4/6✓ Branch 0 taken 21068 times.
✓ Branch 1 taken 575038 times.
✓ Branch 2 taken 21068 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 21068 times.
✗ Branch 5 not taken.
|
1171144 | bool slowcombo = (combo_class_buf[combobuf[MAPCOMBO(x+7,y+8)].type].slow_movement && _effectflag(x+7,y+8,1,-1) && can_combo) || |
| 14633 |
5/6✓ Branch 0 taken 761 times.
✓ Branch 1 taken 574277 times.
✓ Branch 2 taken 652 times.
✓ Branch 3 taken 109 times.
✓ Branch 4 taken 761 times.
✗ Branch 5 not taken.
|
575038 | (isSideViewHero() && (on_sideview_solid_oldpos(this)||getOnSideviewLadder()) && combo_class_buf[combobuf[MAPCOMBO(x+7,y+8)].type].slow_movement && _effectflag(x+7,y+8,1,-1)); |
| 14634 | //!DIMITODO: add QR for slow combos under hero | ||
| 14635 |
4/4✓ Branch 0 taken 575038 times.
✓ Branch 1 taken 21068 times.
✓ Branch 2 taken 21068 times.
✓ Branch 3 taken 42136 times.
|
638242 | if(slowcombo) for (int32_t i = 1; i <= 2; ++i) |
| 14636 | { | ||
| 14637 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 42136 times.
|
42136 | if (get_scr_layer_valid(current_screen, i)) |
| 14638 | { | ||
| 14639 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 42136 times.
|
42136 | if (get_qr(qr_OLD_BRIDGE_COMBOS)) |
| 14640 | { | ||
| 14641 | ✗ | if (combobuf[MAPCOMBO2(i-1, x+7, y+8)].type == cBRIDGE && !_walkflag_layer(x+7, y+8, i)) | |
| 14642 | { | ||
| 14643 | ✗ | slowcombo = false; | |
| 14644 | ✗ | break; | |
| 14645 | } | ||
| 14646 | ✗ | } | |
| 14647 | else | ||
| 14648 | { | ||
| 14649 |
2/4✓ Branch 0 taken 42136 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 42136 times.
✗ Branch 3 not taken.
|
42136 | if (combobuf[MAPCOMBO2(i-1, x+7, y+8)].type == cBRIDGE && _effectflag_layer(x+7, y+8, i)) |
| 14650 | { | ||
| 14651 | ✗ | slowcombo = false; | |
| 14652 | ✗ | break; | |
| 14653 | } | ||
| 14654 | } | ||
| 14655 | 42136 | } | |
| 14656 | 63204 | } | |
| 14657 |
2/2✓ Branch 0 taken 5614 times.
✓ Branch 1 taken 590492 times.
|
596106 | bool slowcharging = charging>0 && (itemsbuf[getWpnPressed(itype_sword)].flags & item_flag10); |
| 14658 | 596106 | bool is_swimming = (action == swimming); | |
| 14659 | 596106 | int32_t shieldid = getCurrentActiveShield(); | |
| 14660 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 596106 times.
|
596106 | if(shieldid > -1) |
| 14661 | { | ||
| 14662 | ✗ | itemdata const& shield = itemsbuf[shieldid]; | |
| 14663 | ✗ | if(shield.flags & item_flag10) //Change Speed flag | |
| 14664 | { | ||
| 14665 | ✗ | zfix perc = shield.misc7; | |
| 14666 | ✗ | perc /= 100; | |
| 14667 | ✗ | if(perc < 0) | |
| 14668 | ✗ | perc = (perc*-1)+1; | |
| 14669 | ✗ | zfix add(shield.misc8); | |
| 14670 | ✗ | add /= 100; | |
| 14671 | ✗ | for(zfix* stp : v) | |
| 14672 | { | ||
| 14673 | ✗ | zfix& pix = *stp; | |
| 14674 | ✗ | pix = (pix * perc) + add; | |
| 14675 | } | ||
| 14676 | ✗ | } | |
| 14677 | ✗ | } | |
| 14678 | |||
| 14679 |
2/2✓ Branch 0 taken 680 times.
✓ Branch 1 taken 595426 times.
|
596106 | if (can_combo) |
| 14680 | { | ||
| 14681 | 595426 | rpos_t slow_rpos = COMBOPOS_REGION_B(x+7, y+8); | |
| 14682 |
2/2✓ Branch 0 taken 593642 times.
✓ Branch 1 taken 4164966 times.
|
4758608 | for (int q = 6; q >= 0; --q) |
| 14683 | { | ||
| 14684 |
1/2✓ Branch 0 taken 4164966 times.
✗ Branch 1 not taken.
|
4164966 | if (slow_rpos == rpos_t::None) break; |
| 14685 | 4164966 | auto& cmb = get_rpos_handle(slow_rpos, q).combo(); | |
| 14686 | |||
| 14687 |
3/6✓ Branch 0 taken 4164877 times.
✓ Branch 1 taken 89 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 4164877 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
4164966 | if (cmb.speed_mult != 1 || cmb.speed_div || cmb.speed_add) |
| 14688 | { | ||
| 14689 |
2/2✓ Branch 0 taken 20824830 times.
✓ Branch 1 taken 4164966 times.
|
24989796 | for (zfix* stp : v) |
| 14690 | { | ||
| 14691 | 20824830 | zfix& pix = *stp; | |
| 14692 | 20824830 | pix *= cmb.speed_mult; | |
| 14693 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 20824830 times.
|
20824830 | if(cmb.speed_div) |
| 14694 | 20824830 | pix /= cmb.speed_div; | |
| 14695 | 20824830 | pix += cmb.speed_add; | |
| 14696 | } | ||
| 14697 | 4164966 | } | |
| 14698 | |||
| 14699 |
4/4✓ Branch 0 taken 3571324 times.
✓ Branch 1 taken 593642 times.
✓ Branch 2 taken 3569540 times.
✓ Branch 3 taken 1784 times.
|
4164966 | if (q > 0 && cmb.type == cBRIDGE) |
| 14700 | { | ||
| 14701 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 1784 times.
✓ Branch 2 taken 1784 times.
✗ Branch 3 not taken.
|
1784 | if(get_qr(qr_OLD_BRIDGE_COMBOS) |
| 14702 | ✗ | ? !_walkflag_layer(x+7,y+8,q-1) | |
| 14703 | 1784 | : _effectflag_layer(x+7,y+8,q-1)) | |
| 14704 | { | ||
| 14705 | 1784 | break; //Bridge blocks speed change from below it | |
| 14706 | } | ||
| 14707 | ✗ | } | |
| 14708 | 4163182 | } | |
| 14709 | 595426 | } | |
| 14710 | |||
| 14711 | 596106 | zfix mult = 1, div = 1; | |
| 14712 |
2/2✓ Branch 0 taken 6290 times.
✓ Branch 1 taken 589816 times.
|
596106 | if(is_swimming) |
| 14713 | { | ||
| 14714 | 6290 | mult = game->swim_mult; | |
| 14715 | 6290 | div = game->swim_div; | |
| 14716 | 6290 | } | |
| 14717 |
3/4✓ Branch 0 taken 5462 times.
✓ Branch 1 taken 584354 times.
✓ Branch 2 taken 5462 times.
✗ Branch 3 not taken.
|
589816 | else if(slowcharging && slowcombo) //1/2 speed |
| 14718 | { | ||
| 14719 | ✗ | div = 2; | |
| 14720 | ✗ | } | |
| 14721 |
4/4✓ Branch 0 taken 584354 times.
✓ Branch 1 taken 5462 times.
✓ Branch 2 taken 21068 times.
✓ Branch 3 taken 563286 times.
|
589816 | else if(slowcharging || slowcombo) //2/3 speed |
| 14722 | { | ||
| 14723 | 26530 | mult = 2; | |
| 14724 | 26530 | div = 3; | |
| 14725 | 26530 | } | |
| 14726 |
1/2✓ Branch 0 taken 596106 times.
✗ Branch 1 not taken.
|
596106 | if(!div) div = 1; |
| 14727 |
3/4✓ Branch 0 taken 563286 times.
✓ Branch 1 taken 32820 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 563286 times.
|
596106 | if(mult != 1 || div != 1) |
| 14728 | { | ||
| 14729 |
2/2✓ Branch 0 taken 164100 times.
✓ Branch 1 taken 32820 times.
|
196920 | for(zfix* stp : v) |
| 14730 | { | ||
| 14731 | 164100 | zfix& pix = *stp; | |
| 14732 | 164100 | pix = ((pix / div) * mult); | |
| 14733 | } | ||
| 14734 | 32820 | } | |
| 14735 | 596106 | } | |
| 14736 | |||
| 14737 | 13310460 | void HeroClass::moveheroOld() | |
| 14738 | { | ||
| 14739 |
4/4✓ Branch 0 taken 13296159 times.
✓ Branch 1 taken 14301 times.
✓ Branch 2 taken 13990 times.
✓ Branch 3 taken 13293765 times.
|
13310460 | if(lstunclock || is_conveyor_stunned) return; |
| 14740 | 13293765 | int32_t xoff=x.getInt()&7; | |
| 14741 | 13293765 | int32_t yoff=y.getInt()&7; | |
| 14742 |
4/4✓ Branch 0 taken 13104707 times.
✓ Branch 1 taken 189058 times.
✓ Branch 2 taken 29266 times.
✓ Branch 3 taken 13133973 times.
|
13293765 | if(NO_GRIDLOCK) |
| 14743 | { | ||
| 14744 | 218324 | xoff = 0; | |
| 14745 | 218324 | yoff = 0; | |
| 14746 | 218324 | } | |
| 14747 | 13325425 | int32_t push=pushing; | |
| 14748 | 13325425 | int32_t oldladderx=-1000, oldladdery=-1000; // moved here because linux complains "init crosses goto ~Koopa | |
| 14749 | 13325425 | pushing=0; | |
| 14750 | 13325425 | zfix temp_step(hero_newstep); | |
| 14751 | 13325425 | zfix temp_x(x); | |
| 14752 | 13325425 | zfix temp_y(y); | |
| 14753 | |||
| 14754 | 13325425 | tick_diving(); | |
| 14755 | |||
| 14756 |
2/2✓ Branch 0 taken 13212275 times.
✓ Branch 1 taken 113150 times.
|
13325425 | if(action==rafting) |
| 14757 | { | ||
| 14758 | 113150 | do_rafting(); | |
| 14759 | |||
| 14760 |
2/2✓ Branch 0 taken 112795 times.
✓ Branch 1 taken 355 times.
|
113150 | if(action==rafting) |
| 14761 | { | ||
| 14762 | 112795 | return; | |
| 14763 | } | ||
| 14764 | |||
| 14765 | |||
| 14766 | 355 | set_respawn_point(); | |
| 14767 | 355 | trySideviewLadder(); | |
| 14768 | 355 | } | |
| 14769 | |||
| 14770 | 13212630 | int32_t olddirectwpn = directWpn; // To be reinstated if startwpn() fails | |
| 14771 | 13212630 | int32_t btnwpn = -1; | |
| 14772 | |||
| 14773 | //&0xFFF removes the "bow & arrows" bitmask | ||
| 14774 | //The Quick Sword is allowed to interrupt attacks. | ||
| 14775 |
4/4✓ Branch 0 taken 13031854 times.
✓ Branch 1 taken 180776 times.
✓ Branch 2 taken 8826861 times.
✓ Branch 3 taken 4204993 times.
|
13212630 | int32_t currentSwordOrWand = (itemsbuf[dowpn].type == itype_wand || itemsbuf[dowpn].type == itype_sword)?dowpn:-1; |
| 14776 |
8/8✓ Branch 0 taken 11574311 times.
✓ Branch 1 taken 1638319 times.
✓ Branch 2 taken 11562965 times.
✓ Branch 3 taken 11346 times.
✓ Branch 4 taken 390563 times.
✓ Branch 5 taken 1259102 times.
✓ Branch 6 taken 72183 times.
✓ Branch 7 taken 1577482 times.
|
13212630 | if((!attackclk && action!=attacking && action != sideswimattacking) || ((attack==wSword || attack==wWand) && (itemsbuf[currentSwordOrWand].flags & item_flag5))) |
| 14777 | { | ||
| 14778 |
2/2✓ Branch 0 taken 29035 times.
✓ Branch 1 taken 11606113 times.
|
11635148 | if (getInput(btnB, INPUT_PRESS | INPUT_DRUNK | INPUT_HERO_ACTION)) |
| 14779 | { | ||
| 14780 | 29035 | btnwpn=getItemFamily(itemsbuf,Bwpn); | |
| 14781 |
2/2✓ Branch 0 taken 28831 times.
✓ Branch 1 taken 204 times.
|
29035 | dowpn = NEG_OR_MASK(Bwpn,0xFFF); |
| 14782 | 29035 | directWpn = directItemB; | |
| 14783 | 29035 | } | |
| 14784 |
2/2✓ Branch 0 taken 89956 times.
✓ Branch 1 taken 11516157 times.
|
11606113 | else if (getInput(btnA, INPUT_PRESS | INPUT_DRUNK | INPUT_HERO_ACTION)) |
| 14785 | { | ||
| 14786 | 89956 | btnwpn=getItemFamily(itemsbuf,Awpn); | |
| 14787 |
2/2✓ Branch 0 taken 87155 times.
✓ Branch 1 taken 2801 times.
|
89956 | dowpn = NEG_OR_MASK(Awpn,0xFFF); |
| 14788 | 89956 | directWpn = directItemA; | |
| 14789 | 89956 | } | |
| 14790 |
4/4✓ Branch 0 taken 200032 times.
✓ Branch 1 taken 11316125 times.
✓ Branch 2 taken 199956 times.
✓ Branch 3 taken 76 times.
|
11516157 | else if (get_qr(qr_SET_XBUTTON_ITEMS) && getInput(btnEx1, INPUT_PRESS | INPUT_DRUNK | INPUT_HERO_ACTION)) |
| 14791 | { | ||
| 14792 | 76 | btnwpn=getItemFamily(itemsbuf,Xwpn); | |
| 14793 |
1/2✓ Branch 0 taken 76 times.
✗ Branch 1 not taken.
|
76 | dowpn = NEG_OR_MASK(Xwpn,0xFFF); |
| 14794 | 76 | directWpn = directItemX; | |
| 14795 | 76 | } | |
| 14796 |
4/4✓ Branch 0 taken 199956 times.
✓ Branch 1 taken 11316125 times.
✓ Branch 2 taken 199831 times.
✓ Branch 3 taken 125 times.
|
11516081 | else if (get_qr(qr_SET_YBUTTON_ITEMS) && getInput(btnEx2, INPUT_PRESS | INPUT_DRUNK | INPUT_HERO_ACTION)) |
| 14797 | { | ||
| 14798 | 125 | btnwpn=getItemFamily(itemsbuf,Ywpn); | |
| 14799 |
1/2✓ Branch 0 taken 125 times.
✗ Branch 1 not taken.
|
125 | dowpn = NEG_OR_MASK(Ywpn,0xFFF); |
| 14800 | 125 | directWpn = directItemY; | |
| 14801 | 125 | } | |
| 14802 | |||
| 14803 |
2/2✓ Branch 0 taken 3946629 times.
✓ Branch 1 taken 7688519 times.
|
11635148 | auto itmid = directWpn>-1 ? directWpn : current_item_id(btnwpn); |
| 14804 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11635148 times.
|
11635148 | if (on_cooldown(itmid)) |
| 14805 | { | ||
| 14806 | ✗ | directWpn = olddirectwpn; | |
| 14807 | ✗ | btnwpn = -1; | |
| 14808 | ✗ | dowpn = -1; | |
| 14809 | ✗ | did_scriptb = false; | |
| 14810 | ✗ | } | |
| 14811 | else | ||
| 14812 | { | ||
| 14813 |
1/2✓ Branch 0 taken 11635148 times.
✗ Branch 1 not taken.
|
11635148 | if(directWpn >= MAXITEMS) directWpn = -1; |
| 14814 | |||
| 14815 | // The Quick Sword only allows repeated sword or wand swings. | ||
| 14816 |
7/8✓ Branch 0 taken 11562965 times.
✓ Branch 1 taken 72183 times.
✓ Branch 2 taken 72183 times.
✓ Branch 3 taken 11562965 times.
✓ Branch 4 taken 71496 times.
✓ Branch 5 taken 687 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 11563652 times.
|
11635148 | if((action==attacking||action==sideswimattacking) && ((attack==wSword && btnwpn!=itype_sword) || (attack==wWand && btnwpn!=itype_wand))) |
| 14817 | 71496 | btnwpn=-1; | |
| 14818 | } | ||
| 14819 | 11635148 | } | |
| 14820 | |||
| 14821 |
2/2✓ Branch 0 taken 4414202 times.
✓ Branch 1 taken 8798428 times.
|
13212630 | auto swordid = (directWpn>-1 ? directWpn : current_item_id(itype_sword)); |
| 14822 |
11/12✓ Branch 0 taken 12373698 times.
✓ Branch 1 taken 838932 times.
✓ Branch 2 taken 11808181 times.
✓ Branch 3 taken 565517 times.
✓ Branch 4 taken 8212633 times.
✓ Branch 5 taken 3595548 times.
✓ Branch 6 taken 8153203 times.
✓ Branch 7 taken 59430 times.
✓ Branch 8 taken 86531 times.
✓ Branch 9 taken 8066672 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 86531 times.
|
13212630 | if(can_attack() && (swordid > -1 && itemsbuf[swordid].type==itype_sword) && checkitem_jinx(swordid) && btnwpn==itype_sword && charging==0) |
| 14823 | { | ||
| 14824 |
2/2✓ Branch 0 taken 3646 times.
✓ Branch 1 taken 82885 times.
|
86531 | attackid=directWpn>-1 ? directWpn : current_item_id(itype_sword); |
| 14825 |
5/6✓ Branch 0 taken 86529 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 15 times.
✓ Branch 3 taken 86514 times.
✓ Branch 4 taken 15 times.
✗ Branch 5 not taken.
|
86531 | if(checkbunny(attackid) && (checkmagiccost(attackid) || !(itemsbuf[attackid].flags & item_flag6))) |
| 14826 | { | ||
| 14827 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 86514 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
86514 | if((itemsbuf[attackid].flags & item_flag6) && !(misc_internal_hero_flags & LF_PAID_SWORD_COST)) |
| 14828 | { | ||
| 14829 | ✗ | paymagiccost(attackid,true); | |
| 14830 | ✗ | misc_internal_hero_flags |= LF_PAID_SWORD_COST; | |
| 14831 | ✗ | } | |
| 14832 | 86514 | SetAttack(); | |
| 14833 | 86514 | attack=wSword; | |
| 14834 | |||
| 14835 | 86514 | attackclk=0; | |
| 14836 |
2/2✓ Branch 0 taken 3629 times.
✓ Branch 1 taken 82885 times.
|
86514 | sfx(itemsbuf[directWpn>-1 ? directWpn : current_item_id(itype_sword)].usesound, pan(x)); |
| 14837 | |||
| 14838 |
7/10✓ Branch 0 taken 86514 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 524 times.
✓ Branch 3 taken 85990 times.
✓ Branch 4 taken 524 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 7 times.
✓ Branch 7 taken 517 times.
✓ Branch 8 taken 7 times.
✗ Branch 9 not taken.
|
86514 | if(dowpn>-1 && itemsbuf[dowpn].script!=0 && !did_scripta && !(FFCore.doscript(ScriptType::Item, dowpn) && get_qr(qr_ITEMSCRIPTSKEEPRUNNING))) |
| 14839 | { | ||
| 14840 |
1/2✓ Branch 0 taken 517 times.
✗ Branch 1 not taken.
|
517 | if(!checkmagiccost(dowpn)) |
| 14841 | { | ||
| 14842 | ✗ | item_error(); | |
| 14843 | ✗ | } | |
| 14844 | else | ||
| 14845 | { | ||
| 14846 | //clear the item script stack for a new script | ||
| 14847 | 517 | int i = dowpn; | |
| 14848 | 517 | FFCore.reset_script_engine_data(ScriptType::Item, i); | |
| 14849 | 517 | ZScriptVersion::RunScript(ScriptType::Item, itemsbuf[i].script, i); | |
| 14850 | 517 | did_scripta=true; | |
| 14851 | } | ||
| 14852 | 517 | } | |
| 14853 | 86514 | } | |
| 14854 | else | ||
| 14855 | { | ||
| 14856 | 17 | item_error(); | |
| 14857 | } | ||
| 14858 | 86531 | } | |
| 14859 | else | ||
| 14860 | { | ||
| 14861 | 13126099 | did_scripta=false; | |
| 14862 | } | ||
| 14863 | |||
| 14864 |
6/10✓ Branch 0 taken 13056479 times.
✓ Branch 1 taken 156151 times.
✓ Branch 2 taken 13056479 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 13056479 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 13056479 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 13056479 times.
|
13212630 | if(action!=swimming && action != sideswimming && action != sideswimhit && action != sideswimattacking && !getOnSideviewLadder()) |
| 14865 | { | ||
| 14866 |
3/4✓ Branch 0 taken 2303034 times.
✓ Branch 1 taken 10753445 times.
✓ Branch 2 taken 2303034 times.
✗ Branch 3 not taken.
|
13056479 | if (getInput(btnUp, INPUT_DRUNK | INPUT_HERO_ACTION) && canSideviewLadder()) |
| 14867 | { | ||
| 14868 | ✗ | setOnSideviewLadder(true); | |
| 14869 | ✗ | } | |
| 14870 |
3/4✓ Branch 0 taken 1995410 times.
✓ Branch 1 taken 11061069 times.
✓ Branch 2 taken 1995410 times.
✗ Branch 3 not taken.
|
13056479 | else if (getInput(btnDown, INPUT_DRUNK | INPUT_HERO_ACTION) && canSideviewLadder(true)) |
| 14871 | { | ||
| 14872 | ✗ | y+=1; | |
| 14873 | ✗ | old_y += 1; | |
| 14874 | ✗ | setOnSideviewLadder(true); | |
| 14875 | ✗ | } | |
| 14876 | 13056479 | } | |
| 14877 | |||
| 14878 | 13212630 | int32_t wx=x; | |
| 14879 | 13212630 | int32_t wy=y; | |
| 14880 |
3/6✓ Branch 0 taken 9074097 times.
✓ Branch 1 taken 4138533 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 13212630 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
13212630 | if((action==none || action==walking) && getOnSideviewLadder() && (get_qr(qr_SIDEVIEWLADDER_FACEUP)!=0)) //Allow DIR to change if standing still on sideview ladder, and force-face up. |
| 14881 | { | ||
| 14882 | ✗ | if((xoff==0)||diagonalMovement) | |
| 14883 | { | ||
| 14884 | ✗ | if (getInput(btnUp, INPUT_DRUNK | INPUT_HERO_ACTION)) dir = up; | |
| 14885 | ✗ | if (getInput(btnDown, INPUT_DRUNK | INPUT_HERO_ACTION)) dir = down; | |
| 14886 | ✗ | } | |
| 14887 | |||
| 14888 | ✗ | if((yoff==0)||diagonalMovement) | |
| 14889 | { | ||
| 14890 | ✗ | if (getInput(btnLeft, INPUT_DRUNK | INPUT_HERO_ACTION)) dir = left; | |
| 14891 | ✗ | if (getInput(btnRight, INPUT_DRUNK | INPUT_HERO_ACTION)) dir = right; | |
| 14892 | ✗ | } | |
| 14893 | ✗ | } | |
| 14894 | |||
| 14895 |
5/5✓ Branch 0 taken 29266 times.
✓ Branch 1 taken 3107922 times.
✓ Branch 2 taken 2663409 times.
✓ Branch 3 taken 3569307 times.
✓ Branch 4 taken 3842726 times.
|
13212630 | switch(dir) |
| 14896 | { | ||
| 14897 | case up: | ||
| 14898 | 3107922 | wy-=16; | |
| 14899 | 3107922 | break; | |
| 14900 | |||
| 14901 | case down: | ||
| 14902 | 2663409 | wy+=16; | |
| 14903 | 2663409 | break; | |
| 14904 | |||
| 14905 | case left: | ||
| 14906 | 3569307 | wx-=16; | |
| 14907 | 3569307 | break; | |
| 14908 | |||
| 14909 | case right: | ||
| 14910 | 3842726 | wx+=16; | |
| 14911 | 3842726 | break; | |
| 14912 | } | ||
| 14913 | |||
| 14914 | 13212630 | do_lens(); | |
| 14915 | |||
| 14916 | 13212630 | WalkflagInfo info; | |
| 14917 | |||
| 14918 | 13212630 | bool no_jinx = true; | |
| 14919 |
2/2✓ Branch 0 taken 13211190 times.
✓ Branch 1 taken 1440 times.
|
13212630 | bool liftonly = lift_wpn && (liftflags & LIFTFL_DIS_ITEMS); |
| 14920 |
2/2✓ Branch 0 taken 4414202 times.
✓ Branch 1 taken 8798428 times.
|
13212630 | auto itmid = directWpn>-1 ? directWpn : current_item_id(btnwpn); |
| 14921 |
2/2✓ Branch 0 taken 29266 times.
✓ Branch 1 taken 13183364 times.
|
13212630 | if(liftonly) |
| 14922 | { | ||
| 14923 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 29266 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
29266 | if(replay_version_check(38) && btnwpn > -1) |
| 14924 | { | ||
| 14925 | ✗ | no_jinx = checkitem_jinx(itmid); | |
| 14926 | ✗ | if(no_jinx) | |
| 14927 | ✗ | startwpn(itmid); | |
| 14928 | ✗ | directWpn = olddirectwpn; | |
| 14929 | ✗ | } | |
| 14930 | 29266 | } | |
| 14931 |
7/8✓ Branch 0 taken 12373698 times.
✓ Branch 1 taken 809666 times.
✓ Branch 2 taken 28461 times.
✓ Branch 3 taken 12345237 times.
✓ Branch 4 taken 28461 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 4 times.
✓ Branch 7 taken 28457 times.
|
13183364 | else if(can_attack() && btnwpn>itype_sword && charging==0 && btnwpn!=itype_rupee) // This depends on item 0 being a rupee... |
| 14932 | { | ||
| 14933 | 28457 | bool paidmagic = false; | |
| 14934 |
5/8✓ Branch 0 taken 26672 times.
✓ Branch 1 taken 1785 times.
✓ Branch 2 taken 1785 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1785 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 1785 times.
|
28457 | if(btnwpn==itype_wand && (directWpn>-1 ? (!item_disabled(directWpn) ? itemsbuf[directWpn].type==itype_wand : false) : current_item(itype_wand))) |
| 14935 | { | ||
| 14936 |
1/2✓ Branch 0 taken 1785 times.
✗ Branch 1 not taken.
|
1785 | attackid=directWpn>-1 ? directWpn : current_item_id(itype_wand); |
| 14937 | 1785 | no_jinx = checkitem_jinx(attackid); | |
| 14938 |
4/8✓ Branch 0 taken 1784 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 1784 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1784 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
1785 | if(no_jinx && checkbunny(attackid) && ((!(itemsbuf[attackid].flags & item_flag6)) || checkmagiccost(attackid))) |
| 14939 | { | ||
| 14940 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1784 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1784 | if((itemsbuf[attackid].flags & item_flag6) && !(misc_internal_hero_flags & LF_PAID_WAND_COST)){ |
| 14941 | ✗ | paymagiccost(attackid,true); | |
| 14942 | ✗ | misc_internal_hero_flags |= LF_PAID_WAND_COST; | |
| 14943 | ✗ | } | |
| 14944 | 1784 | SetAttack(); | |
| 14945 | 1784 | attack=wWand; | |
| 14946 | 1784 | attackclk=0; | |
| 14947 | 1784 | } | |
| 14948 | else | ||
| 14949 | { | ||
| 14950 | 1 | item_error(); | |
| 14951 | } | ||
| 14952 | 1785 | } | |
| 14953 |
4/6✓ Branch 0 taken 2257 times.
✓ Branch 1 taken 24415 times.
✓ Branch 2 taken 2257 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2257 times.
|
28929 | else if((btnwpn==itype_hammer)&&!((action==attacking||action==sideswimattacking) && attack==wHammer) |
| 14954 |
3/6✗ Branch 0 not taken.
✓ Branch 1 taken 2257 times.
✓ Branch 2 taken 2257 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2257 times.
|
2257 | && (directWpn>-1 ? (!item_disabled(directWpn) ? itemsbuf[directWpn].type==itype_hammer : false) : current_item(itype_hammer))) |
| 14955 | { | ||
| 14956 | 2257 | no_jinx = checkitem_jinx(dowpn); | |
| 14957 |
3/6✓ Branch 0 taken 2257 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2257 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2257 times.
|
2257 | if(!(no_jinx && checkmagiccost(dowpn) && checkbunny(dowpn))) |
| 14958 | { | ||
| 14959 | ✗ | item_error(); | |
| 14960 | ✗ | } | |
| 14961 | else | ||
| 14962 | { | ||
| 14963 | 2257 | paymagiccost(dowpn); | |
| 14964 | 2257 | paidmagic = true; | |
| 14965 | 2257 | SetAttack(); | |
| 14966 | 2257 | attack=wHammer; | |
| 14967 |
1/2✓ Branch 0 taken 2257 times.
✗ Branch 1 not taken.
|
2257 | attackid=directWpn>-1 ? directWpn : current_item_id(itype_hammer); |
| 14968 | 2257 | attackclk=0; | |
| 14969 | } | ||
| 14970 | 2257 | } | |
| 14971 |
4/6✓ Branch 0 taken 1832 times.
✓ Branch 1 taken 22583 times.
✓ Branch 2 taken 1832 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1832 times.
|
26247 | else if((btnwpn==itype_candle)&&!((action==attacking||action==sideswimattacking) && attack==wFire) |
| 14972 |
3/6✗ Branch 0 not taken.
✓ Branch 1 taken 1832 times.
✓ Branch 2 taken 1832 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1832 times.
|
1832 | && (directWpn>-1 ? (!item_disabled(directWpn) ? itemsbuf[directWpn].type==itype_candle : false) : current_item(itype_candle))) |
| 14973 | { | ||
| 14974 | //checkbunny handled where magic cost is paid | ||
| 14975 |
1/2✓ Branch 0 taken 1832 times.
✗ Branch 1 not taken.
|
1832 | attackid=directWpn>-1 ? directWpn : current_item_id(itype_candle); |
| 14976 | 1832 | no_jinx = checkitem_jinx(attackid); | |
| 14977 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1832 times.
|
1832 | if(no_jinx) |
| 14978 | { | ||
| 14979 | 1832 | SetAttack(); | |
| 14980 | 1832 | attack=wFire; | |
| 14981 | 1832 | attackclk=0; | |
| 14982 | 1832 | } | |
| 14983 | 1832 | } | |
| 14984 |
4/6✓ Branch 0 taken 4 times.
✓ Branch 1 taken 22579 times.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 4 times.
|
22587 | else if((btnwpn==itype_cbyrna)&&!((action==attacking||action==sideswimattacking) && attack==wCByrna) |
| 14985 |
3/6✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 4 times.
|
4 | && (directWpn>-1 ? (!item_disabled(directWpn) ? itemsbuf[directWpn].type==itype_cbyrna : false) : current_item(itype_cbyrna))) |
| 14986 | { | ||
| 14987 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | attackid=directWpn>-1 ? directWpn : current_item_id(itype_cbyrna); |
| 14988 | 4 | no_jinx = checkitem_jinx(attackid); | |
| 14989 |
3/8✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 4 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
4 | if(no_jinx && checkbunny(attackid) && ((!(itemsbuf[attackid].flags & item_flag6)) || checkmagiccost(attackid))) |
| 14990 | { | ||
| 14991 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
4 | if((itemsbuf[attackid].flags & item_flag6) && !(misc_internal_hero_flags & LF_PAID_CBYRNA_COST)){ |
| 14992 | ✗ | paymagiccost(attackid,true); | |
| 14993 | ✗ | misc_internal_hero_flags |= LF_PAID_CBYRNA_COST; | |
| 14994 | ✗ | } | |
| 14995 | 4 | SetAttack(); | |
| 14996 | 4 | attack=wCByrna; | |
| 14997 | 4 | attackclk=0; | |
| 14998 | 4 | } | |
| 14999 | else | ||
| 15000 | { | ||
| 15001 | ✗ | item_error(); | |
| 15002 | } | ||
| 15003 | 4 | } | |
| 15004 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 22579 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
22579 | else if((btnwpn==itype_bugnet)&&!((action==attacking||action==sideswimattacking) && attack==wBugNet) |
| 15005 | ✗ | && (directWpn>-1 ? (!item_disabled(directWpn) && itemsbuf[directWpn].type==itype_bugnet) : current_item(itype_bugnet))) | |
| 15006 | { | ||
| 15007 | ✗ | attackid = directWpn>-1 ? directWpn : current_item_id(itype_bugnet); | |
| 15008 | ✗ | no_jinx = checkitem_jinx(attackid); | |
| 15009 | ✗ | if(no_jinx && checkbunny(attackid) && checkmagiccost(attackid)) | |
| 15010 | { | ||
| 15011 | ✗ | paymagiccost(attackid); | |
| 15012 | ✗ | SetAttack(); | |
| 15013 | ✗ | attack = wBugNet; | |
| 15014 | ✗ | attackclk = 0; | |
| 15015 | ✗ | sfx(itemsbuf[attackid].usesound); | |
| 15016 | ✗ | } | |
| 15017 | else | ||
| 15018 | { | ||
| 15019 | ✗ | item_error(); | |
| 15020 | } | ||
| 15021 | ✗ | } | |
| 15022 | else | ||
| 15023 | { | ||
| 15024 | 22579 | no_jinx = checkitem_jinx(itmid); | |
| 15025 |
2/2✓ Branch 0 taken 51 times.
✓ Branch 1 taken 22528 times.
|
22579 | if(no_jinx) |
| 15026 | { | ||
| 15027 | 22528 | paidmagic = startwpn(itmid); | |
| 15028 | |||
| 15029 |
2/2✓ Branch 0 taken 19443 times.
✓ Branch 1 taken 3085 times.
|
22528 | if(paidmagic) |
| 15030 | { | ||
| 15031 |
6/10✓ Branch 0 taken 19423 times.
✓ Branch 1 taken 20 times.
✓ Branch 2 taken 19423 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 19423 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 19423 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 19423 times.
|
19443 | if(action==casting || action==drowning || action==lavadrowning || action == sideswimcasting || action==sidedrowning) |
| 15032 | { | ||
| 15033 | ; | ||
| 15034 | 20 | } | |
| 15035 | else | ||
| 15036 | { | ||
| 15037 | 19423 | SetAttack(); | |
| 15038 | 19423 | attackclk=0; | |
| 15039 | 19423 | attack=none; | |
| 15040 | |||
| 15041 |
2/2✓ Branch 0 taken 5936 times.
✓ Branch 1 taken 13487 times.
|
19423 | if(btnwpn==itype_brang) |
| 15042 | { | ||
| 15043 | 13487 | attack=wBrang; | |
| 15044 | 13487 | } | |
| 15045 | } | ||
| 15046 | 19443 | } | |
| 15047 | else | ||
| 15048 | { | ||
| 15049 | // Weapon not started: directWpn should be reset to prev. value. | ||
| 15050 | 3085 | directWpn = olddirectwpn; | |
| 15051 | } | ||
| 15052 | 22528 | } | |
| 15053 | } | ||
| 15054 | |||
| 15055 |
8/12✓ Branch 0 taken 28457 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 28405 times.
✓ Branch 3 taken 52 times.
✓ Branch 4 taken 1276 times.
✓ Branch 5 taken 27129 times.
✓ Branch 6 taken 1210 times.
✓ Branch 7 taken 66 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 1210 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
28457 | if(dowpn>-1 && no_jinx && itemsbuf[dowpn].script!=0 && !did_scriptb && !(FFCore.doscript(ScriptType::Item, dowpn) && get_qr(qr_ITEMSCRIPTSKEEPRUNNING))) |
| 15056 | { | ||
| 15057 |
3/4✓ Branch 0 taken 1206 times.
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1210 times.
|
1210 | if(!((paidmagic || checkmagiccost(dowpn)) && checkbunny(dowpn))) |
| 15058 | { | ||
| 15059 | ✗ | item_error(); | |
| 15060 | ✗ | } | |
| 15061 | else | ||
| 15062 | { | ||
| 15063 | // Only charge for magic if item's magic cost wasn't already charged | ||
| 15064 | // for the item's main use. | ||
| 15065 |
4/4✓ Branch 0 taken 1206 times.
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 7 times.
✓ Branch 3 taken 1199 times.
|
1210 | if(!paidmagic && attack!=wWand) |
| 15066 | 1199 | paymagiccost(dowpn); | |
| 15067 | //clear the item script stack for a new script | ||
| 15068 | 1210 | int i = dowpn; | |
| 15069 | 1210 | FFCore.reset_script_engine_data(ScriptType::Item, i); | |
| 15070 | 1210 | ZScriptVersion::RunScript(ScriptType::Item, itemsbuf[i].script, i); | |
| 15071 | 1210 | did_scriptb=true; | |
| 15072 | } | ||
| 15073 | 1210 | } | |
| 15074 | |||
| 15075 |
8/12✓ Branch 0 taken 28405 times.
✓ Branch 1 taken 52 times.
✓ Branch 2 taken 28385 times.
✓ Branch 3 taken 20 times.
✓ Branch 4 taken 28385 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 28385 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 28385 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 28385 times.
|
28457 | if(no_jinx && (action==casting || action==drowning || action==lavadrowning || action == sideswimcasting || action==sidedrowning)) |
| 15076 | { | ||
| 15077 | 20 | return; | |
| 15078 | } | ||
| 15079 |
2/2✓ Branch 0 taken 28385 times.
✓ Branch 1 taken 52 times.
|
28437 | if(!no_jinx) |
| 15080 | 52 | did_scriptb = false; | |
| 15081 | 28437 | } | |
| 15082 | else | ||
| 15083 | { | ||
| 15084 | 13154907 | did_scriptb=false; | |
| 15085 | } | ||
| 15086 | |||
| 15087 |
6/6✓ Branch 0 taken 11574977 times.
✓ Branch 1 taken 1579101 times.
✓ Branch 2 taken 11451692 times.
✓ Branch 3 taken 123285 times.
✓ Branch 4 taken 29266 times.
✓ Branch 5 taken 11422426 times.
|
13212610 | if(attackclk || action==attacking || action==sideswimattacking) |
| 15088 | { | ||
| 15089 | |||
| 15090 |
4/8✓ Branch 0 taken 123285 times.
✓ Branch 1 taken 1608367 times.
✓ Branch 2 taken 123285 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 123285 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
1731652 | if((attackclk==0) && action!=sideswimattacking && getOnSideviewLadder() && (get_qr(qr_SIDEVIEWLADDER_FACEUP)!=0)) //Allow DIR to change if standing still on sideview ladder, and force-face up. |
| 15091 | { | ||
| 15092 | ✗ | if((xoff==0)||diagonalMovement) | |
| 15093 | { | ||
| 15094 | ✗ | if (getInput(btnUp, INPUT_DRUNK | INPUT_HERO_ACTION)) dir = up; | |
| 15095 | ✗ | if (getInput(btnDown, INPUT_DRUNK | INPUT_HERO_ACTION)) dir = down; | |
| 15096 | ✗ | } | |
| 15097 | |||
| 15098 | ✗ | if((yoff==0)||diagonalMovement) | |
| 15099 | { | ||
| 15100 | ✗ | if (getInput(btnLeft, INPUT_DRUNK | INPUT_HERO_ACTION)) dir = left; | |
| 15101 | ✗ | if (getInput(btnRight, INPUT_DRUNK | INPUT_HERO_ACTION)) dir = right; | |
| 15102 | ✗ | } | |
| 15103 | ✗ | } | |
| 15104 | |||
| 15105 | 1731652 | bool attacked = doattack(); | |
| 15106 | |||
| 15107 | // This section below interferes with script-setting Hero->Dir, so it comes after doattack | ||
| 15108 |
10/12✓ Branch 0 taken 1728507 times.
✓ Branch 1 taken 3145 times.
✓ Branch 2 taken 1245337 times.
✓ Branch 3 taken 483170 times.
✓ Branch 4 taken 266043 times.
✓ Branch 5 taken 979294 times.
✓ Branch 6 taken 230394 times.
✓ Branch 7 taken 35649 times.
✓ Branch 8 taken 230394 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 230394 times.
|
1731652 | if(!inlikelike && attackclk>4 && (attackclk&3)==0 && charging==0 && spins==0 && action!=sideswimattacking) |
| 15109 | { | ||
| 15110 |
4/4✓ Branch 0 taken 111335 times.
✓ Branch 1 taken 119059 times.
✓ Branch 2 taken 38493 times.
✓ Branch 3 taken 72842 times.
|
230394 | if((xoff==0)||diagonalMovement) |
| 15111 | { | ||
| 15112 |
2/2✓ Branch 0 taken 141119 times.
✓ Branch 1 taken 16433 times.
|
157552 | if (getInput(btnUp, INPUT_DRUNK | INPUT_HERO_ACTION)) dir = up; |
| 15113 | |||
| 15114 |
2/2✓ Branch 0 taken 138035 times.
✓ Branch 1 taken 19517 times.
|
157552 | if (getInput(btnDown, INPUT_DRUNK | INPUT_HERO_ACTION)) dir = down; |
| 15115 | 157552 | } | |
| 15116 | |||
| 15117 |
4/4✓ Branch 0 taken 88085 times.
✓ Branch 1 taken 142309 times.
✓ Branch 2 taken 35934 times.
✓ Branch 3 taken 52151 times.
|
230394 | if((yoff==0)||diagonalMovement) |
| 15118 | { | ||
| 15119 |
2/2✓ Branch 0 taken 152739 times.
✓ Branch 1 taken 25504 times.
|
178243 | if (getInput(btnLeft, INPUT_DRUNK | INPUT_HERO_ACTION)) dir = left; |
| 15120 | |||
| 15121 |
2/2✓ Branch 0 taken 151835 times.
✓ Branch 1 taken 26408 times.
|
178243 | if (getInput(btnRight, INPUT_DRUNK | INPUT_HERO_ACTION)) dir = right; |
| 15122 | 178243 | } | |
| 15123 | 230394 | } | |
| 15124 | |||
| 15125 |
9/10✓ Branch 0 taken 1615494 times.
✓ Branch 1 taken 116158 times.
✓ Branch 2 taken 1574508 times.
✓ Branch 3 taken 40986 times.
✓ Branch 4 taken 1574073 times.
✓ Branch 5 taken 435 times.
✓ Branch 6 taken 1568274 times.
✓ Branch 7 taken 5799 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 1568274 times.
|
1731652 | if(attacked && (charging==0 && spins<=5) && jumping<1 && action!=sideswimattacking) |
| 15126 | { | ||
| 15127 | 1568274 | return; | |
| 15128 | } | ||
| 15129 |
2/2✓ Branch 0 taken 47220 times.
✓ Branch 1 taken 116158 times.
|
163378 | else if(!attacked) |
| 15130 | { | ||
| 15131 | // Spin attack - change direction | ||
| 15132 |
3/4✓ Branch 0 taken 665 times.
✓ Branch 1 taken 115493 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 665 times.
|
116158 | if(spins>1 && attack != wHammer) |
| 15133 | { | ||
| 15134 | 665 | spins--; | |
| 15135 | |||
| 15136 |
2/2✓ Branch 0 taken 620 times.
✓ Branch 1 taken 45 times.
|
665 | if(spins%5==0) |
| 15137 | { | ||
| 15138 |
1/2✓ Branch 0 taken 45 times.
✗ Branch 1 not taken.
|
45 | int id = currentscroll > -1 ? currentscroll : (current_item_id(spins>5 ? itype_spinscroll2 : itype_spinscroll)); |
| 15139 | 45 | sfx(itemsbuf[id].usesound,pan(x)); | |
| 15140 | 45 | } | |
| 15141 | 665 | attackclk=1; | |
| 15142 | |||
| 15143 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 167 times.
✓ Branch 2 taken 166 times.
✓ Branch 3 taken 166 times.
✓ Branch 4 taken 166 times.
|
665 | switch(dir) |
| 15144 | { | ||
| 15145 | case up: | ||
| 15146 | 167 | dir=left; | |
| 15147 | 167 | break; | |
| 15148 | |||
| 15149 | case right: | ||
| 15150 | 166 | dir=up; | |
| 15151 | 166 | break; | |
| 15152 | |||
| 15153 | case down: | ||
| 15154 | 166 | dir=right; | |
| 15155 | 166 | break; | |
| 15156 | |||
| 15157 | case left: | ||
| 15158 | 166 | dir=down; | |
| 15159 | 166 | break; | |
| 15160 | } | ||
| 15161 | |||
| 15162 | 665 | return; | |
| 15163 | } | ||
| 15164 | else | ||
| 15165 | { | ||
| 15166 | 115493 | spins=0; | |
| 15167 | } | ||
| 15168 | |||
| 15169 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 115493 times.
|
115493 | if (IsSideSwim()) {action=sideswimming; FFCore.setHeroAction(sideswimming);} |
| 15170 | 115493 | else {action=none; FFCore.setHeroAction(none);} | |
| 15171 | 115493 | attackclk=0; | |
| 15172 | 115493 | charging=0; | |
| 15173 | 115493 | } | |
| 15174 | 162713 | } | |
| 15175 | |||
| 15176 |
2/2✓ Branch 0 taken 62 times.
✓ Branch 1 taken 11585077 times.
|
11585139 | if(pitslide()) //Check pit's 'pull'. If true, then Hero cannot fight the pull. |
| 15177 | 62 | return; | |
| 15178 | |||
| 15179 |
2/2✓ Branch 0 taken 4336557 times.
✓ Branch 1 taken 7248520 times.
|
11585077 | if(action==walking) //still walking |
| 15180 | { | ||
| 15181 |
9/10✓ Branch 0 taken 5330346 times.
✓ Branch 1 taken 1918174 times.
✓ Branch 2 taken 3714796 times.
✓ Branch 3 taken 1615550 times.
✓ Branch 4 taken 1957225 times.
✓ Branch 5 taken 1757571 times.
✓ Branch 6 taken 80540 times.
✓ Branch 7 taken 1876685 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 80540 times.
|
7248520 | if (!getInput(btnUp, INPUT_DRUNK | INPUT_HERO_ACTION) && !getInput(btnDown, INPUT_DRUNK | INPUT_HERO_ACTION) && !getInput(btnLeft, INPUT_DRUNK | INPUT_HERO_ACTION) && !getInput(btnRight, INPUT_DRUNK | INPUT_HERO_ACTION) && !autostep) |
| 15182 | { | ||
| 15183 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 80540 times.
|
80540 | if(attackclk>0) SetAttack(); |
| 15184 | 80540 | else {action = none; FFCore.setHeroAction(none);} | |
| 15185 | 80540 | hero_count=-1; | |
| 15186 | 80540 | return; | |
| 15187 | } | ||
| 15188 | |||
| 15189 | 7167980 | autostep=false; | |
| 15190 | |||
| 15191 |
4/6✓ Branch 0 taken 4949766 times.
✓ Branch 1 taken 2218214 times.
✓ Branch 2 taken 4949766 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 4949766 times.
|
7167980 | if(!(diagonalMovement || NO_GRIDLOCK)) |
| 15192 | { | ||
| 15193 |
2/4✓ Branch 0 taken 4949766 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 4949766 times.
|
4949766 | if(get_qr(qr_NEW_HERO_MOVEMENT) || IsSideSwim()) |
| 15194 | { | ||
| 15195 | ✗ | if(dir==up&&yoff) | |
| 15196 | { | ||
| 15197 | ✗ | info = walkflag(x,y+(bigHitbox?0:8)-int32_t(lsteps[y.getInt()&7]),2,up); | |
| 15198 | ✗ | info = info || walkflagMBlock(x+8,y+(bigHitbox?0:8)-int32_t(lsteps[y.getInt()&7])); | |
| 15199 | ✗ | execute(info); | |
| 15200 | |||
| 15201 | ✗ | if(!info.isUnwalkable()) | |
| 15202 | { | ||
| 15203 | ✗ | moveOld2(up); | |
| 15204 | ✗ | } | |
| 15205 | else | ||
| 15206 | { | ||
| 15207 | ✗ | action=none; FFCore.setHeroAction(none); | |
| 15208 | } | ||
| 15209 | |||
| 15210 | ✗ | return; | |
| 15211 | } | ||
| 15212 | |||
| 15213 | ✗ | if(dir==down&&yoff) | |
| 15214 | { | ||
| 15215 | ✗ | info = walkflag(x,y+15+int32_t(lsteps[y.getInt()&7]),2,down); | |
| 15216 | ✗ | info = info || walkflagMBlock(x+8,y+15+int32_t(lsteps[y.getInt()&7])); | |
| 15217 | ✗ | execute(info); | |
| 15218 | |||
| 15219 | ✗ | if(!info.isUnwalkable()) | |
| 15220 | { | ||
| 15221 | ✗ | moveOld2(down); | |
| 15222 | ✗ | } | |
| 15223 | else | ||
| 15224 | { | ||
| 15225 | ✗ | action=none; FFCore.setHeroAction(none); | |
| 15226 | } | ||
| 15227 | |||
| 15228 | ✗ | return; | |
| 15229 | } | ||
| 15230 | |||
| 15231 | ✗ | if(dir==left&&xoff) | |
| 15232 | { | ||
| 15233 | ✗ | info = walkflag(x-int32_t(lsteps[x.getInt()&7]),y+(bigHitbox?0:8),1,left) || walkflag(x-int32_t(lsteps[x.getInt()&7]),y+8,1,left); | |
| 15234 | ✗ | execute(info); | |
| 15235 | |||
| 15236 | ✗ | if(!info.isUnwalkable()) | |
| 15237 | { | ||
| 15238 | ✗ | moveOld2(left); | |
| 15239 | ✗ | } | |
| 15240 | else | ||
| 15241 | { | ||
| 15242 | ✗ | action=none; FFCore.setHeroAction(none); | |
| 15243 | } | ||
| 15244 | |||
| 15245 | ✗ | return; | |
| 15246 | } | ||
| 15247 | |||
| 15248 | ✗ | if(dir==right&&xoff) | |
| 15249 | { | ||
| 15250 | ✗ | info = walkflag(x+15+int32_t(lsteps[x.getInt()&7]),y+(bigHitbox?0:8),1,right) || walkflag(x+15+int32_t(lsteps[x.getInt()&7]),y+8,1,right); | |
| 15251 | ✗ | execute(info); | |
| 15252 | |||
| 15253 | ✗ | if(!info.isUnwalkable()) | |
| 15254 | { | ||
| 15255 | ✗ | moveOld2(right); | |
| 15256 | ✗ | } | |
| 15257 | else | ||
| 15258 | { | ||
| 15259 | ✗ | action=none; FFCore.setHeroAction(none); | |
| 15260 | } | ||
| 15261 | |||
| 15262 | ✗ | return; | |
| 15263 | } | ||
| 15264 | ✗ | } | |
| 15265 | else | ||
| 15266 | { | ||
| 15267 |
4/4✓ Branch 0 taken 1152672 times.
✓ Branch 1 taken 3797094 times.
✓ Branch 2 taken 188796 times.
✓ Branch 3 taken 963876 times.
|
4949766 | if(dir==up&&yoff) |
| 15268 | { | ||
| 15269 | 963876 | while(true) | |
| 15270 | { | ||
| 15271 | 963878 | info = walkflag(temp_x,temp_y+(bigHitbox?0:8)-temp_step,2,up); | |
| 15272 | 963878 | info = info || walkflagMBlock(temp_x+8,temp_y+(bigHitbox?0:8)-temp_step); | |
| 15273 | 963878 | execute(info); | |
| 15274 | |||
| 15275 |
2/2✓ Branch 0 taken 5173 times.
✓ Branch 1 taken 958705 times.
|
963878 | if(!info.isUnwalkable()) |
| 15276 | { | ||
| 15277 | 958705 | hero_newstep = temp_step; | |
| 15278 | 958705 | x = temp_x; | |
| 15279 | 958705 | y = temp_y; | |
| 15280 | 958705 | moveOld2(up); | |
| 15281 | 958705 | return; | |
| 15282 | } | ||
| 15283 | //Could not move, try moving less | ||
| 15284 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5173 times.
|
5173 | if(temp_y != int32_t(temp_y)) |
| 15285 | { | ||
| 15286 | ✗ | temp_y = floor((double)temp_y); | |
| 15287 | ✗ | continue; | |
| 15288 | } | ||
| 15289 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 5171 times.
|
5173 | else if(temp_step > 1) |
| 15290 | { | ||
| 15291 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if(temp_step != int32_t(temp_step)) //floor |
| 15292 | 2 | temp_step = floor((double)temp_step); | |
| 15293 | ✗ | else --temp_step; | |
| 15294 | 2 | continue; | |
| 15295 | } | ||
| 15296 | else //Can't move less, stop moving | ||
| 15297 | { | ||
| 15298 | 5171 | action=none; FFCore.setHeroAction(none); | |
| 15299 | } | ||
| 15300 | 5171 | return; | |
| 15301 | } | ||
| 15302 | } | ||
| 15303 | |||
| 15304 |
4/4✓ Branch 0 taken 945269 times.
✓ Branch 1 taken 3040621 times.
✓ Branch 2 taken 156271 times.
✓ Branch 3 taken 788998 times.
|
3985890 | if(dir==down&&yoff) |
| 15305 | { | ||
| 15306 | 788998 | while(true) | |
| 15307 | { | ||
| 15308 | 789052 | info = walkflag(temp_x,temp_y+15+temp_step,2,down); | |
| 15309 | 789052 | info = info || walkflagMBlock(temp_x+8,temp_y+15+temp_step); | |
| 15310 | 789052 | execute(info); | |
| 15311 | |||
| 15312 |
2/2✓ Branch 0 taken 4455 times.
✓ Branch 1 taken 784597 times.
|
789052 | if(!info.isUnwalkable()) |
| 15313 | { | ||
| 15314 | 784597 | hero_newstep = temp_step; | |
| 15315 | 784597 | x = temp_x; | |
| 15316 | 784597 | y = temp_y; | |
| 15317 | 784597 | moveOld2(down); | |
| 15318 | 784597 | return; | |
| 15319 | } | ||
| 15320 | //Could not move, try moving less | ||
| 15321 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4455 times.
|
4455 | if(temp_y != int32_t(temp_y)) |
| 15322 | { | ||
| 15323 | ✗ | temp_y = floor((double)temp_y); | |
| 15324 | ✗ | continue; | |
| 15325 | } | ||
| 15326 |
2/2✓ Branch 0 taken 54 times.
✓ Branch 1 taken 4401 times.
|
4455 | else if(temp_step > 1) |
| 15327 | { | ||
| 15328 |
1/2✓ Branch 0 taken 54 times.
✗ Branch 1 not taken.
|
54 | if(temp_step != int32_t(temp_step)) //floor |
| 15329 | 54 | temp_step = floor((double)temp_step); | |
| 15330 | ✗ | else --temp_step; | |
| 15331 | 54 | continue; | |
| 15332 | } | ||
| 15333 | else //Can't move less, stop moving | ||
| 15334 | { | ||
| 15335 | 4401 | action=none; FFCore.setHeroAction(none); | |
| 15336 | } | ||
| 15337 | 4401 | return; | |
| 15338 | } | ||
| 15339 | } | ||
| 15340 | |||
| 15341 |
4/4✓ Branch 0 taken 1387611 times.
✓ Branch 1 taken 1809281 times.
✓ Branch 2 taken 232515 times.
✓ Branch 3 taken 1155096 times.
|
3196892 | if(dir==left&&xoff) |
| 15342 | { | ||
| 15343 | 1155096 | while(true) | |
| 15344 | { | ||
| 15345 | 1155096 | info = walkflag(temp_x-temp_step,temp_y+(bigHitbox?0:8),1,left) || walkflag(temp_x-temp_step,temp_y+8,1,left); | |
| 15346 | 1155096 | execute(info); | |
| 15347 | |||
| 15348 |
2/2✓ Branch 0 taken 5165 times.
✓ Branch 1 taken 1149931 times.
|
1155096 | if(!info.isUnwalkable()) |
| 15349 | { | ||
| 15350 | 1149931 | hero_newstep = temp_step; | |
| 15351 | 1149931 | x = temp_x; | |
| 15352 | 1149931 | y = temp_y; | |
| 15353 | 1149931 | moveOld2(left); | |
| 15354 | 1149931 | return; | |
| 15355 | } | ||
| 15356 | //Could not move, try moving less | ||
| 15357 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5165 times.
|
5165 | if(temp_x != int32_t(temp_x)) |
| 15358 | { | ||
| 15359 | ✗ | temp_x = floor((double)temp_x); | |
| 15360 | ✗ | continue; | |
| 15361 | } | ||
| 15362 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5165 times.
|
5165 | else if(temp_step > 1) |
| 15363 | { | ||
| 15364 | ✗ | if(temp_step != int32_t(temp_step)) //floor | |
| 15365 | ✗ | temp_step = floor((double)temp_step); | |
| 15366 | ✗ | else --temp_step; | |
| 15367 | ✗ | continue; | |
| 15368 | } | ||
| 15369 | else //Can't move less, stop moving | ||
| 15370 | { | ||
| 15371 | 5165 | action=none; FFCore.setHeroAction(none); | |
| 15372 | } | ||
| 15373 | 5165 | return; | |
| 15374 | } | ||
| 15375 | } | ||
| 15376 | |||
| 15377 |
4/4✓ Branch 0 taken 1464214 times.
✓ Branch 1 taken 577582 times.
✓ Branch 2 taken 245328 times.
✓ Branch 3 taken 1218886 times.
|
2041796 | if(dir==right&&xoff) |
| 15378 | { | ||
| 15379 | 1218886 | while(true) | |
| 15380 | { | ||
| 15381 | 1218949 | info = walkflag(temp_x+15+temp_step,temp_y+(bigHitbox?0:8),1,right) || walkflag(temp_x+15+temp_step,temp_y+8,1,right); | |
| 15382 | 1218949 | execute(info); | |
| 15383 | |||
| 15384 |
2/2✓ Branch 0 taken 5828 times.
✓ Branch 1 taken 1213121 times.
|
1218949 | if(!info.isUnwalkable()) |
| 15385 | { | ||
| 15386 | 1213121 | hero_newstep = temp_step; | |
| 15387 | 1213121 | x = temp_x; | |
| 15388 | 1213121 | y = temp_y; | |
| 15389 | 1213121 | moveOld2(right); | |
| 15390 | 1213121 | return; | |
| 15391 | } | ||
| 15392 | //Could not move, try moving less | ||
| 15393 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5828 times.
|
5828 | if(temp_x != int32_t(temp_x)) |
| 15394 | { | ||
| 15395 | ✗ | temp_x = floor((double)temp_x); | |
| 15396 | ✗ | continue; | |
| 15397 | } | ||
| 15398 |
2/2✓ Branch 0 taken 63 times.
✓ Branch 1 taken 5765 times.
|
5828 | else if(temp_step > 1) |
| 15399 | { | ||
| 15400 |
1/2✓ Branch 0 taken 63 times.
✗ Branch 1 not taken.
|
63 | if(temp_step != int32_t(temp_step)) //floor |
| 15401 | 63 | temp_step = floor((double)temp_step); | |
| 15402 | ✗ | else --temp_step; | |
| 15403 | 63 | continue; | |
| 15404 | } | ||
| 15405 | else //Can't move less, stop moving | ||
| 15406 | { | ||
| 15407 | 5765 | action=none; FFCore.setHeroAction(none); | |
| 15408 | } | ||
| 15409 | 5765 | return; | |
| 15410 | } | ||
| 15411 | } | ||
| 15412 | } | ||
| 15413 | 822910 | } | |
| 15414 | |||
| 15415 | 3041124 | } // endif (action==walking) | |
| 15416 | |||
| 15417 |
16/24✓ Branch 0 taken 7280062 times.
✓ Branch 1 taken 97619 times.
✓ Branch 2 taken 7280062 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7280062 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 7280062 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 7280062 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 7280062 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 7280062 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 7280062 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 7280062 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 7239076 times.
✓ Branch 19 taken 40986 times.
✓ Branch 20 taken 7238641 times.
✓ Branch 21 taken 435 times.
✓ Branch 22 taken 109495 times.
✓ Branch 23 taken 7129146 times.
|
7377681 | if((action!=swimming)&&(action!=sideswimming)&&(action !=sideswimhit)&&(action !=sideswimattacking)&&(action!=casting)&&(action!=sideswimcasting)&&(action!=drowning)&&(action!=sidedrowning)&&(action!=lavadrowning) && charging==0 && spins==0 && jumping<1) |
| 15418 | { | ||
| 15419 | 7129146 | action=none; FFCore.setHeroAction(none); | |
| 15420 | 7129146 | } | |
| 15421 | |||
| 15422 |
2/2✓ Branch 0 taken 3598593 times.
✓ Branch 1 taken 3779088 times.
|
7377681 | if(diagonalMovement) |
| 15423 | { | ||
| 15424 |
5/5✓ Branch 0 taken 1174288 times.
✓ Branch 1 taken 494424 times.
✓ Branch 2 taken 453865 times.
✓ Branch 3 taken 704485 times.
✓ Branch 4 taken 771531 times.
|
3598593 | switch(holddir) |
| 15425 | { | ||
| 15426 | case up: | ||
| 15427 |
2/2✓ Branch 0 taken 477398 times.
✓ Branch 1 taken 17026 times.
|
494424 | if (!getInput(btnUp, INPUT_HERO_ACTION)) |
| 15428 | { | ||
| 15429 | 17026 | holddir=-1; | |
| 15430 | 17026 | } | |
| 15431 | |||
| 15432 | 494424 | break; | |
| 15433 | |||
| 15434 | case down: | ||
| 15435 |
2/2✓ Branch 0 taken 438723 times.
✓ Branch 1 taken 15142 times.
|
453865 | if (!getInput(btnDown, INPUT_HERO_ACTION)) |
| 15436 | { | ||
| 15437 | 15142 | holddir=-1; | |
| 15438 | 15142 | } | |
| 15439 | |||
| 15440 | 453865 | break; | |
| 15441 | |||
| 15442 | case left: | ||
| 15443 |
2/2✓ Branch 0 taken 684031 times.
✓ Branch 1 taken 20454 times.
|
704485 | if (!getInput(btnLeft, INPUT_HERO_ACTION)) |
| 15444 | { | ||
| 15445 | 20454 | holddir=-1; | |
| 15446 | 20454 | } | |
| 15447 | |||
| 15448 | 704485 | break; | |
| 15449 | |||
| 15450 | case right: | ||
| 15451 |
2/2✓ Branch 0 taken 750256 times.
✓ Branch 1 taken 21275 times.
|
771531 | if (!getInput(btnRight, INPUT_HERO_ACTION)) |
| 15452 | { | ||
| 15453 | 21275 | holddir=-1; | |
| 15454 | 21275 | } | |
| 15455 | |||
| 15456 | 771531 | break; | |
| 15457 | |||
| 15458 | default: | ||
| 15459 | 1174288 | break; | |
| 15460 | } //end switch | ||
| 15461 | |||
| 15462 |
4/4✓ Branch 0 taken 3065322 times.
✓ Branch 1 taken 533271 times.
✓ Branch 2 taken 29266 times.
✓ Branch 3 taken 3093628 times.
|
3598593 | if(get_qr(qr_NEW_HERO_MOVEMENT) || IsSideSwim()) //!DIRECTION SET |
| 15463 | { | ||
| 15464 | 562537 | walkable = false; | |
| 15465 |
6/6✓ Branch 0 taken 102006 times.
✓ Branch 1 taken 460531 times.
✓ Branch 2 taken 98793 times.
✓ Branch 3 taken 3213 times.
✓ Branch 4 taken 24447 times.
✓ Branch 5 taken 74346 times.
|
562537 | if (getInput(btnUp, INPUT_DRUNK | INPUT_HERO_ACTION) && (holddir == -1 || holddir == up)) |
| 15466 | { | ||
| 15467 |
5/8✓ Branch 0 taken 3090 times.
✓ Branch 1 taken 74469 times.
✓ Branch 2 taken 3057 times.
✓ Branch 3 taken 33 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 3090 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
77559 | if(isdungeon() && (x<=26 || x>=world_w - 42) && !get_qr(qr_FREEFORM) && !walk_through_walls) |
| 15468 | { | ||
| 15469 | ✗ | } | |
| 15470 | else | ||
| 15471 | { | ||
| 15472 |
5/10✓ Branch 0 taken 76595 times.
✓ Branch 1 taken 964 times.
✓ Branch 2 taken 76595 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 76595 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 76595 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
77559 | if(charging==0 && spins==0 && action != sideswimattacking && !(IsSideSwim() && get_qr(qr_SIDESWIMDIR))) |
| 15473 | { | ||
| 15474 | 76595 | dir=up; | |
| 15475 | 76595 | } | |
| 15476 | |||
| 15477 | 77559 | holddir=up; | |
| 15478 | |||
| 15479 |
4/4✓ Branch 0 taken 9850 times.
✓ Branch 1 taken 67709 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 9848 times.
|
77559 | if (getInput(btnRight, INPUT_DRUNK | INPUT_HERO_ACTION) && shiftdir != left) |
| 15480 | { | ||
| 15481 | 9848 | shiftdir=right; | |
| 15482 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 9848 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
9848 | if (IsSideSwim() && get_qr(qr_SIDESWIMDIR) && (charging==0 && spins==0)) dir = right; |
| 15483 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 9848 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
9848 | if (!IsSideSwim() || (charging==0 && spins==0)) sideswimdir = right; |
| 15484 | 9848 | } | |
| 15485 |
4/4✓ Branch 0 taken 9049 times.
✓ Branch 1 taken 58662 times.
✓ Branch 2 taken 9 times.
✓ Branch 3 taken 9040 times.
|
67711 | else if (getInput(btnLeft, INPUT_DRUNK | INPUT_HERO_ACTION) && shiftdir != right) |
| 15486 | { | ||
| 15487 | 9040 | shiftdir=left; | |
| 15488 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 9040 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
9040 | if (IsSideSwim() && get_qr(qr_SIDESWIMDIR) && (charging==0 && spins==0)) dir = left; |
| 15489 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 9040 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
9040 | if (!IsSideSwim() || (charging==0 && spins==0)) sideswimdir = left; |
| 15490 | 9040 | } | |
| 15491 | else | ||
| 15492 | { | ||
| 15493 | 58671 | shiftdir=-1; | |
| 15494 | } | ||
| 15495 | |||
| 15496 | //walkable if Ladder can be placed or is already placed vertically | ||
| 15497 |
1/18✗ Branch 0 not taken.
✓ Branch 1 taken 77559 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
77559 | if(isSideViewHero() && !walk_through_walls && !((can_deploy_ladder() && get_qr(qr_OLD_LADDER_ITEM_SIDEVIEW)) || (ladderx && laddery && ladderdir==up)) && !getOnSideviewLadder() && action != sideswimming && action != sideswimhit && action != sideswimattacking) |
| 15498 | { | ||
| 15499 | ✗ | walkable=false; | |
| 15500 | ✗ | } | |
| 15501 | else | ||
| 15502 | { | ||
| 15503 |
4/8✗ Branch 0 not taken.
✓ Branch 1 taken 77559 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 4 times.
✓ Branch 5 taken 77555 times.
✓ Branch 6 taken 4 times.
✗ Branch 7 not taken.
|
77559 | if ((get_qr(qr_OLD_LADDER_ITEM_SIDEVIEW) && can_deploy_ladder()) || (ladderx && laddery && ladderdir==up)) justmoved = 2; //Prevent the slope-snap code from running |
| 15504 | 77559 | do | |
| 15505 | { | ||
| 15506 | 89741 | zfix ty = y - hero_newstep; | |
| 15507 | 179482 | info = walkflag(x,(bigHitbox?0:8) + ty,2,up) | |
| 15508 | 89741 | || walkflag(x+15,(bigHitbox?0:8) + ty,1,up); | |
| 15509 | |||
| 15510 |
4/4✓ Branch 0 taken 307 times.
✓ Branch 1 taken 89434 times.
✓ Branch 2 taken 20 times.
✓ Branch 3 taken 287 times.
|
89741 | if (ty < 0 && !bigHitbox) //sanity check for up scroll |
| 15511 | { | ||
| 15512 | 287 | info = info || walkflag(x, 0_zf, 2, up); | |
| 15513 | 287 | info = info || walkflag(x+15, 0_zf, 1, up); | |
| 15514 | 287 | } | |
| 15515 | 89741 | info = info || walkflagMBlock(x+15, (bigHitbox?0:8) + ty); | |
| 15516 | |||
| 15517 | 89741 | execute(info); | |
| 15518 | |||
| 15519 |
2/2✓ Branch 0 taken 23217 times.
✓ Branch 1 taken 66524 times.
|
89741 | if(info.isUnwalkable()) |
| 15520 | { | ||
| 15521 |
2/2✓ Branch 0 taken 1147 times.
✓ Branch 1 taken 22070 times.
|
23217 | if(y != y.getInt()) |
| 15522 | { | ||
| 15523 | 1147 | y.doRound(); | |
| 15524 | 1147 | } | |
| 15525 |
2/2✓ Branch 0 taken 11035 times.
✓ Branch 1 taken 11035 times.
|
22070 | else if(hero_newstep > 1) |
| 15526 | { | ||
| 15527 |
1/2✓ Branch 0 taken 11035 times.
✗ Branch 1 not taken.
|
11035 | if(hero_newstep != int32_t(hero_newstep)) //floor |
| 15528 | 11035 | hero_newstep = floor((double)hero_newstep); | |
| 15529 | ✗ | else --hero_newstep; | |
| 15530 | 11035 | } | |
| 15531 | else | ||
| 15532 | 11035 | break; | |
| 15533 | 12182 | } | |
| 15534 | 66524 | else walkable = true; | |
| 15535 |
2/2✓ Branch 0 taken 12182 times.
✓ Branch 1 taken 66524 times.
|
78706 | } |
| 15536 | 78706 | while(!walkable); | |
| 15537 | } | ||
| 15538 | |||
| 15539 | 77559 | int32_t s=shiftdir; | |
| 15540 | |||
| 15541 |
5/6✓ Branch 0 taken 3090 times.
✓ Branch 1 taken 74469 times.
✓ Branch 2 taken 3058 times.
✓ Branch 3 taken 32 times.
✓ Branch 4 taken 3090 times.
✗ Branch 5 not taken.
|
77559 | if(isdungeon() && (y<=26 || y>=world_h-42) && !get_qr(qr_FREEFORM)) |
| 15542 | { | ||
| 15543 | ✗ | shiftdir=-1; | |
| 15544 | ✗ | } | |
| 15545 | else | ||
| 15546 | { | ||
| 15547 |
2/2✓ Branch 0 taken 9040 times.
✓ Branch 1 taken 68519 times.
|
77559 | if(s==left) |
| 15548 | { | ||
| 15549 | 9040 | do | |
| 15550 | { | ||
| 15551 | 10486 | info = (walkflag(x-hero_newstep_diag,y+(bigHitbox?0:8),1,left)||walkflag(x-hero_newstep_diag,y+15,1,left)); | |
| 15552 | |||
| 15553 | 10486 | execute(info); | |
| 15554 | |||
| 15555 |
2/2✓ Branch 0 taken 2765 times.
✓ Branch 1 taken 7721 times.
|
10486 | if(info.isUnwalkable()) |
| 15556 | { | ||
| 15557 |
2/2✓ Branch 0 taken 127 times.
✓ Branch 1 taken 2638 times.
|
2765 | if(x != x.getInt()) |
| 15558 | { | ||
| 15559 | 127 | x.doRound(); | |
| 15560 | 127 | } | |
| 15561 |
2/2✓ Branch 0 taken 1319 times.
✓ Branch 1 taken 1319 times.
|
2638 | else if(hero_newstep_diag > 1) |
| 15562 | { | ||
| 15563 |
1/2✓ Branch 0 taken 1319 times.
✗ Branch 1 not taken.
|
1319 | if(hero_newstep_diag != hero_newstep_diag.getInt()) //floor |
| 15564 | 1319 | hero_newstep_diag.doFloor(); | |
| 15565 | ✗ | else --hero_newstep_diag; | |
| 15566 | 1319 | } | |
| 15567 | else | ||
| 15568 | 1319 | shiftdir = -1; | |
| 15569 | 2765 | } | |
| 15570 |
2/2✓ Branch 0 taken 6389 times.
✓ Branch 1 taken 1332 times.
|
7721 | else if(walkable) |
| 15571 | { | ||
| 15572 | 6389 | do | |
| 15573 | { | ||
| 15574 | 6418 | info = walkflag(x-hero_newstep_diag,(bigHitbox?0:8)+(y-hero_newstep),1,left); | |
| 15575 | 6418 | execute(info); | |
| 15576 |
2/2✓ Branch 0 taken 46 times.
✓ Branch 1 taken 6372 times.
|
6418 | if(info.isUnwalkable()) |
| 15577 | { | ||
| 15578 |
2/2✓ Branch 0 taken 12 times.
✓ Branch 1 taken 34 times.
|
46 | if(x != x.getInt()) |
| 15579 | { | ||
| 15580 | 12 | x.doRound(); | |
| 15581 | 12 | } | |
| 15582 |
2/2✓ Branch 0 taken 17 times.
✓ Branch 1 taken 17 times.
|
34 | else if(hero_newstep_diag > 1) |
| 15583 | { | ||
| 15584 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(hero_newstep_diag != hero_newstep_diag.getInt()) //floor |
| 15585 | 17 | hero_newstep_diag.doFloor(); | |
| 15586 | ✗ | else --hero_newstep_diag; | |
| 15587 | 17 | } | |
| 15588 | else | ||
| 15589 | 17 | shiftdir = -1; | |
| 15590 | 46 | } | |
| 15591 | 6372 | else break; | |
| 15592 |
2/2✓ Branch 0 taken 29 times.
✓ Branch 1 taken 17 times.
|
46 | } |
| 15593 | 46 | while(shiftdir != -1); | |
| 15594 | 6389 | break; | |
| 15595 | } | ||
| 15596 | 1332 | else break; | |
| 15597 |
2/2✓ Branch 0 taken 1446 times.
✓ Branch 1 taken 1319 times.
|
2765 | } |
| 15598 | 2765 | while(shiftdir != -1); | |
| 15599 | 9040 | } | |
| 15600 |
2/2✓ Branch 0 taken 58671 times.
✓ Branch 1 taken 9848 times.
|
68519 | else if(s==right) |
| 15601 | { | ||
| 15602 | 9848 | do | |
| 15603 | { | ||
| 15604 | 11460 | info = (walkflag(x+15+hero_newstep_diag,y+(bigHitbox?0:8),1,right)||walkflag(x+15+hero_newstep_diag,y+15,1,right)); | |
| 15605 | |||
| 15606 | 11460 | execute(info); | |
| 15607 | |||
| 15608 |
2/2✓ Branch 0 taken 3070 times.
✓ Branch 1 taken 8390 times.
|
11460 | if(info.isUnwalkable()) |
| 15609 | { | ||
| 15610 |
2/2✓ Branch 0 taken 128 times.
✓ Branch 1 taken 2942 times.
|
3070 | if(x != x.getInt()) |
| 15611 | { | ||
| 15612 | 128 | x.doRound(); | |
| 15613 | 128 | } | |
| 15614 |
2/2✓ Branch 0 taken 1484 times.
✓ Branch 1 taken 1458 times.
|
2942 | else if(hero_newstep_diag > 1) |
| 15615 | { | ||
| 15616 |
1/2✓ Branch 0 taken 1484 times.
✗ Branch 1 not taken.
|
1484 | if(hero_newstep_diag != hero_newstep_diag.getInt()) //floor |
| 15617 | 1484 | hero_newstep_diag.doFloor(); | |
| 15618 | ✗ | else --hero_newstep_diag; | |
| 15619 | 1484 | } | |
| 15620 | else | ||
| 15621 | 1458 | shiftdir = -1; | |
| 15622 | 3070 | } | |
| 15623 |
2/2✓ Branch 0 taken 7069 times.
✓ Branch 1 taken 1321 times.
|
8390 | else if(walkable) |
| 15624 | { | ||
| 15625 | 7069 | do | |
| 15626 | { | ||
| 15627 | 7093 | info = walkflag(x+15+hero_newstep_diag,(bigHitbox?0:8)+(y-hero_newstep),1,right); | |
| 15628 | 7093 | execute(info); | |
| 15629 |
2/2✓ Branch 0 taken 40 times.
✓ Branch 1 taken 7053 times.
|
7093 | if(info.isUnwalkable()) |
| 15630 | { | ||
| 15631 |
2/2✓ Branch 0 taken 7 times.
✓ Branch 1 taken 33 times.
|
40 | if(x != x.getInt()) |
| 15632 | { | ||
| 15633 | 7 | x.doRound(); | |
| 15634 | 7 | } | |
| 15635 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 17 times.
|
33 | else if(hero_newstep_diag > 1) |
| 15636 | { | ||
| 15637 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(hero_newstep_diag != hero_newstep_diag.getInt()) //floor |
| 15638 | 17 | hero_newstep_diag.doFloor(); | |
| 15639 | ✗ | else --hero_newstep_diag; | |
| 15640 | 17 | } | |
| 15641 | else | ||
| 15642 | 16 | shiftdir = -1; | |
| 15643 | 40 | } | |
| 15644 | 7053 | else break; | |
| 15645 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 16 times.
|
40 | } |
| 15646 | 40 | while(shiftdir != -1); | |
| 15647 | 7069 | break; | |
| 15648 | } | ||
| 15649 | 1321 | else break; | |
| 15650 |
2/2✓ Branch 0 taken 1612 times.
✓ Branch 1 taken 1458 times.
|
3070 | } |
| 15651 | 3070 | while(shiftdir != -1); | |
| 15652 | 9848 | } | |
| 15653 | } | ||
| 15654 | |||
| 15655 | 77559 | moveOld2(up); | |
| 15656 | 77559 | shiftdir=s; | |
| 15657 | |||
| 15658 |
2/2✓ Branch 0 taken 66524 times.
✓ Branch 1 taken 11035 times.
|
77559 | if(!walkable) |
| 15659 | { | ||
| 15660 |
2/2✓ Branch 0 taken 3031 times.
✓ Branch 1 taken 8004 times.
|
11035 | if(shiftdir==-1) //Corner-shove; prevent being stuck on corners -V |
| 15661 | { | ||
| 15662 | 8004 | x = x.getInt(); | |
| 15663 | 8004 | y = y.getInt(); | |
| 15664 |
4/4✓ Branch 0 taken 1778 times.
✓ Branch 1 taken 6226 times.
✓ Branch 2 taken 532 times.
✓ Branch 3 taken 7472 times.
|
9782 | if(!_walkflag(x,y+(bigHitbox?0:8)-1,1,get_standing_z_state()) && |
| 15665 |
2/2✓ Branch 0 taken 1115 times.
✓ Branch 1 taken 663 times.
|
1778 | !_walkflag(x+8, y+(bigHitbox?0:8)-1,1,get_standing_z_state()) && |
| 15666 | 663 | _walkflag(x+15,y+(bigHitbox?0:8)-1,1,get_standing_z_state())) | |
| 15667 | { | ||
| 15668 |
7/12✓ Branch 0 taken 520 times.
✓ Branch 1 taken 12 times.
✓ Branch 2 taken 520 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 520 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 520 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 520 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 532 times.
|
532 | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(hero_scr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?15:11),y+(bigHitbox?0:8)-1)) |
| 15669 | 532 | sprite::move((zfix)-1,(zfix)0); | |
| 15670 | 532 | } | |
| 15671 | else | ||
| 15672 | { | ||
| 15673 |
4/4✓ Branch 0 taken 6226 times.
✓ Branch 1 taken 1246 times.
✓ Branch 2 taken 589 times.
✓ Branch 3 taken 6883 times.
|
13698 | if(_walkflag(x, y+(bigHitbox?0:8)-1,1,get_standing_z_state()) && |
| 15674 |
2/2✓ Branch 0 taken 5637 times.
✓ Branch 1 taken 589 times.
|
6226 | !_walkflag(x+7, y+(bigHitbox?0:8)-1,1,get_standing_z_state()) && |
| 15675 | 589 | !_walkflag(x+15,y+(bigHitbox?0:8)-1,1,get_standing_z_state())) | |
| 15676 | { | ||
| 15677 |
7/12✓ Branch 0 taken 582 times.
✓ Branch 1 taken 7 times.
✓ Branch 2 taken 582 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 582 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 582 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 582 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 589 times.
|
589 | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(hero_scr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?0:4),y+(bigHitbox?0:8)-1)) |
| 15678 | 589 | sprite::move((zfix)1,(zfix)0); | |
| 15679 | 589 | } | |
| 15680 | else | ||
| 15681 | { | ||
| 15682 | 6883 | pushing=push+1; | |
| 15683 | } | ||
| 15684 | } | ||
| 15685 | 8004 | } | |
| 15686 | else | ||
| 15687 | { | ||
| 15688 | 3031 | pushing=push+1; // L: This makes solid damage combos and diagonal-triggered Armoses work. | |
| 15689 | } | ||
| 15690 | 11035 | } | |
| 15691 | |||
| 15692 | 77559 | return; | |
| 15693 | } | ||
| 15694 | ✗ | } | |
| 15695 | |||
| 15696 |
6/6✓ Branch 0 taken 98716 times.
✓ Branch 1 taken 386262 times.
✓ Branch 2 taken 95582 times.
✓ Branch 3 taken 3134 times.
✓ Branch 4 taken 73293 times.
✓ Branch 5 taken 22289 times.
|
484978 | if (getInput(btnDown, INPUT_DRUNK | INPUT_HERO_ACTION) && (holddir == -1 || holddir == down)) |
| 15697 | { | ||
| 15698 |
4/8✓ Branch 0 taken 2687 times.
✓ Branch 1 taken 73740 times.
✓ Branch 2 taken 2687 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2687 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
76427 | if(isdungeon() && (x<=26 || x>=world_w - 42) && !get_qr(qr_FREEFORM) && !walk_through_walls) |
| 15699 | { | ||
| 15700 | ✗ | } | |
| 15701 | else | ||
| 15702 | { | ||
| 15703 |
5/10✓ Branch 0 taken 76223 times.
✓ Branch 1 taken 204 times.
✓ Branch 2 taken 76223 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 76223 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 76223 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
76427 | if(charging==0 && spins==0 && action != sideswimattacking && !(IsSideSwim() && get_qr(qr_SIDESWIMDIR))) |
| 15704 | { | ||
| 15705 | 76223 | dir=down; | |
| 15706 | 76223 | } | |
| 15707 | |||
| 15708 | 76427 | holddir=down; | |
| 15709 | |||
| 15710 |
4/4✓ Branch 0 taken 10699 times.
✓ Branch 1 taken 65728 times.
✓ Branch 2 taken 8 times.
✓ Branch 3 taken 10691 times.
|
76427 | if (getInput(btnRight, INPUT_DRUNK | INPUT_HERO_ACTION) && shiftdir != left) |
| 15711 | { | ||
| 15712 | 10691 | shiftdir=right; | |
| 15713 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 10691 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
10691 | if (IsSideSwim() && get_qr(qr_SIDESWIMDIR) && (charging==0 && spins==0)) dir = right; |
| 15714 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 10691 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
10691 | if (!IsSideSwim() || (charging==0 && spins==0)) sideswimdir = right; |
| 15715 | 10691 | } | |
| 15716 |
4/4✓ Branch 0 taken 11515 times.
✓ Branch 1 taken 54221 times.
✓ Branch 2 taken 12 times.
✓ Branch 3 taken 11503 times.
|
65736 | else if (getInput(btnLeft, INPUT_DRUNK | INPUT_HERO_ACTION) && shiftdir != right) |
| 15717 | { | ||
| 15718 | 11503 | shiftdir=left; | |
| 15719 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 11503 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
11503 | if (IsSideSwim() && get_qr(qr_SIDESWIMDIR) && (charging==0 && spins==0)) dir = left; |
| 15720 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 11503 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
11503 | if (!IsSideSwim() || (charging==0 && spins==0)) sideswimdir = left; |
| 15721 | 11503 | } | |
| 15722 | else | ||
| 15723 | { | ||
| 15724 | 54233 | shiftdir=-1; | |
| 15725 | } | ||
| 15726 | |||
| 15727 | //bool walkable; | ||
| 15728 |
1/12✗ Branch 0 not taken.
✓ Branch 1 taken 76427 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
76427 | if(isSideViewHero() && !walk_through_walls && !getOnSideviewLadder() && action != sideswimming && action != sideswimhit && action != sideswimattacking) |
| 15729 | { | ||
| 15730 | ✗ | walkable=false; | |
| 15731 | ✗ | } | |
| 15732 | else | ||
| 15733 | { | ||
| 15734 | 76427 | do | |
| 15735 | { | ||
| 15736 | 85872 | info = walkflag(x,15+(y+hero_newstep),2,down); | |
| 15737 | |||
| 15738 |
2/2✓ Branch 0 taken 52594 times.
✓ Branch 1 taken 33278 times.
|
85872 | if(x.getFloor() & 7) |
| 15739 | 52594 | info = info || walkflag(x+15,15+(y+hero_newstep),1,down); | |
| 15740 | else | ||
| 15741 | 33278 | info = info || walkflagMBlock(x+15, 15+(y+hero_newstep)); | |
| 15742 | |||
| 15743 | 85872 | execute(info); | |
| 15744 | |||
| 15745 |
2/2✓ Branch 0 taken 17827 times.
✓ Branch 1 taken 68045 times.
|
85872 | if(info.isUnwalkable()) |
| 15746 | { | ||
| 15747 |
2/2✓ Branch 0 taken 825 times.
✓ Branch 1 taken 17002 times.
|
17827 | if(y != y.getInt()) |
| 15748 | { | ||
| 15749 | 825 | y.doRound(); | |
| 15750 | 825 | } | |
| 15751 |
2/2✓ Branch 0 taken 8620 times.
✓ Branch 1 taken 8382 times.
|
17002 | else if(hero_newstep > 1) |
| 15752 | { | ||
| 15753 |
1/2✓ Branch 0 taken 8620 times.
✗ Branch 1 not taken.
|
8620 | if(hero_newstep != int32_t(hero_newstep)) //floor |
| 15754 | 8620 | hero_newstep = floor((double)hero_newstep); | |
| 15755 | ✗ | else --hero_newstep; | |
| 15756 | 8620 | } | |
| 15757 | else | ||
| 15758 | 8382 | break; | |
| 15759 | 9445 | } | |
| 15760 | 68045 | else walkable = true; | |
| 15761 |
2/2✓ Branch 0 taken 9445 times.
✓ Branch 1 taken 68045 times.
|
77490 | } |
| 15762 | 77490 | while(!walkable); | |
| 15763 | } | ||
| 15764 | |||
| 15765 | 76427 | int32_t s=shiftdir; | |
| 15766 | |||
| 15767 |
5/6✓ Branch 0 taken 2687 times.
✓ Branch 1 taken 73740 times.
✓ Branch 2 taken 2685 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 2687 times.
✗ Branch 5 not taken.
|
76427 | if(isdungeon() && (y<=26 || y>=world_h - 42) && !get_qr(qr_FREEFORM)) |
| 15768 | { | ||
| 15769 | ✗ | shiftdir=-1; | |
| 15770 | ✗ | } | |
| 15771 | else | ||
| 15772 | { | ||
| 15773 |
2/2✓ Branch 0 taken 11503 times.
✓ Branch 1 taken 64924 times.
|
76427 | if(s==left) |
| 15774 | { | ||
| 15775 | 11503 | do | |
| 15776 | { | ||
| 15777 | 13134 | info = (walkflag(x-hero_newstep_diag,y+(bigHitbox?0:8),1,left)||walkflag(x-hero_newstep_diag,y+15,1,left)); | |
| 15778 | |||
| 15779 | 13134 | execute(info); | |
| 15780 | |||
| 15781 |
2/2✓ Branch 0 taken 3070 times.
✓ Branch 1 taken 10064 times.
|
13134 | if(info.isUnwalkable()) |
| 15782 | { | ||
| 15783 |
2/2✓ Branch 0 taken 192 times.
✓ Branch 1 taken 2878 times.
|
3070 | if(x != x.getInt()) |
| 15784 | { | ||
| 15785 | 192 | x.doRound(); | |
| 15786 | 192 | } | |
| 15787 |
2/2✓ Branch 0 taken 1439 times.
✓ Branch 1 taken 1439 times.
|
2878 | else if(hero_newstep_diag > 1) |
| 15788 | { | ||
| 15789 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1439 times.
|
1439 | if(hero_newstep_diag != hero_newstep_diag.getInt()) //floor |
| 15790 | 1439 | hero_newstep_diag.doFloor(); | |
| 15791 | ✗ | else --hero_newstep_diag; | |
| 15792 | 1439 | } | |
| 15793 | else | ||
| 15794 | 1439 | shiftdir = -1; | |
| 15795 | 3070 | } | |
| 15796 |
2/2✓ Branch 0 taken 8469 times.
✓ Branch 1 taken 1595 times.
|
10064 | else if(walkable) |
| 15797 | { | ||
| 15798 | 8469 | do | |
| 15799 | { | ||
| 15800 | 8511 | info = walkflag(x-hero_newstep_diag,15+(y+hero_newstep),1,left); | |
| 15801 | 8511 | execute(info); | |
| 15802 |
2/2✓ Branch 0 taken 59 times.
✓ Branch 1 taken 8452 times.
|
8511 | if(info.isUnwalkable()) |
| 15803 | { | ||
| 15804 |
2/2✓ Branch 0 taken 25 times.
✓ Branch 1 taken 34 times.
|
59 | if(x != x.getInt()) |
| 15805 | { | ||
| 15806 | 25 | x.doRound(); | |
| 15807 | 25 | } | |
| 15808 |
2/2✓ Branch 0 taken 17 times.
✓ Branch 1 taken 17 times.
|
34 | else if(hero_newstep_diag > 1) |
| 15809 | { | ||
| 15810 |
1/2✓ Branch 0 taken 17 times.
✗ Branch 1 not taken.
|
17 | if(hero_newstep_diag != hero_newstep_diag.getInt()) //floor |
| 15811 | 17 | hero_newstep_diag.doFloor(); | |
| 15812 | ✗ | else --hero_newstep_diag; | |
| 15813 | 17 | } | |
| 15814 | else | ||
| 15815 | 17 | shiftdir = -1; | |
| 15816 | 59 | } | |
| 15817 | 8452 | else break; | |
| 15818 |
2/2✓ Branch 0 taken 42 times.
✓ Branch 1 taken 17 times.
|
59 | } |
| 15819 | 59 | while(shiftdir != -1); | |
| 15820 | 8469 | break; | |
| 15821 | } | ||
| 15822 | 1595 | else break; | |
| 15823 |
2/2✓ Branch 0 taken 1631 times.
✓ Branch 1 taken 1439 times.
|
3070 | } |
| 15824 | 3070 | while(shiftdir != -1); | |
| 15825 | 11503 | } | |
| 15826 |
2/2✓ Branch 0 taken 54233 times.
✓ Branch 1 taken 10691 times.
|
64924 | else if(s==right) |
| 15827 | { | ||
| 15828 | 10691 | do | |
| 15829 | { | ||
| 15830 | 12068 | info = (walkflag(x+15+hero_newstep_diag,y+(bigHitbox?0:8),1,right)||walkflag(x+15+hero_newstep_diag,y+15,1,right)); | |
| 15831 | |||
| 15832 | 12068 | execute(info); | |
| 15833 | |||
| 15834 |
2/2✓ Branch 0 taken 2646 times.
✓ Branch 1 taken 9422 times.
|
12068 | if(info.isUnwalkable()) |
| 15835 | { | ||
| 15836 |
2/2✓ Branch 0 taken 98 times.
✓ Branch 1 taken 2548 times.
|
2646 | if(x != x.getInt()) |
| 15837 | { | ||
| 15838 | 98 | x.doRound(); | |
| 15839 | 98 | } | |
| 15840 |
2/2✓ Branch 0 taken 1279 times.
✓ Branch 1 taken 1269 times.
|
2548 | else if(hero_newstep_diag > 1) |
| 15841 | { | ||
| 15842 |
1/2✓ Branch 0 taken 1279 times.
✗ Branch 1 not taken.
|
1279 | if(hero_newstep_diag != hero_newstep_diag.getInt()) //floor |
| 15843 | 1279 | hero_newstep_diag.doFloor(); | |
| 15844 | ✗ | else --hero_newstep_diag; | |
| 15845 | 1279 | } | |
| 15846 | else | ||
| 15847 | 1269 | shiftdir = -1; | |
| 15848 | 2646 | } | |
| 15849 |
2/2✓ Branch 0 taken 7796 times.
✓ Branch 1 taken 1626 times.
|
9422 | else if(walkable) |
| 15850 | { | ||
| 15851 | 7796 | do | |
| 15852 | { | ||
| 15853 | 7842 | info = walkflag(x+15+hero_newstep_diag,15+(y+hero_newstep),1,right); | |
| 15854 | 7842 | execute(info); | |
| 15855 |
2/2✓ Branch 0 taken 75 times.
✓ Branch 1 taken 7767 times.
|
7842 | if(info.isUnwalkable()) |
| 15856 | { | ||
| 15857 |
2/2✓ Branch 0 taken 17 times.
✓ Branch 1 taken 58 times.
|
75 | if(x != x.getInt()) |
| 15858 | { | ||
| 15859 | 17 | x.doRound(); | |
| 15860 | 17 | } | |
| 15861 |
2/2✓ Branch 0 taken 29 times.
✓ Branch 1 taken 29 times.
|
58 | else if(hero_newstep_diag > 1) |
| 15862 | { | ||
| 15863 |
1/2✓ Branch 0 taken 29 times.
✗ Branch 1 not taken.
|
29 | if(hero_newstep_diag != hero_newstep_diag.getInt()) //floor |
| 15864 | 29 | hero_newstep_diag.doFloor(); | |
| 15865 | ✗ | else --hero_newstep_diag; | |
| 15866 | 29 | } | |
| 15867 | else | ||
| 15868 | 29 | shiftdir = -1; | |
| 15869 | 75 | } | |
| 15870 | 7767 | else break; | |
| 15871 |
2/2✓ Branch 0 taken 46 times.
✓ Branch 1 taken 29 times.
|
75 | } |
| 15872 | 75 | while(shiftdir != -1); | |
| 15873 | 7796 | break; | |
| 15874 | } | ||
| 15875 | 1626 | else break; | |
| 15876 |
2/2✓ Branch 0 taken 1377 times.
✓ Branch 1 taken 1269 times.
|
2646 | } |
| 15877 | 2646 | while(shiftdir != -1); | |
| 15878 | 10691 | } | |
| 15879 | } | ||
| 15880 | |||
| 15881 | 76427 | moveOld2(down); | |
| 15882 | 76427 | shiftdir=s; | |
| 15883 | |||
| 15884 |
2/2✓ Branch 0 taken 68045 times.
✓ Branch 1 taken 8382 times.
|
76427 | if(!walkable) |
| 15885 | { | ||
| 15886 |
2/2✓ Branch 0 taken 3482 times.
✓ Branch 1 taken 4900 times.
|
8382 | if(shiftdir==-1) //Corner-shove; prevent being stuck on corners -V |
| 15887 | { | ||
| 15888 | 4900 | x = x.getInt(); | |
| 15889 | 4900 | y = y.getInt(); | |
| 15890 |
4/4✓ Branch 0 taken 1268 times.
✓ Branch 1 taken 3632 times.
✓ Branch 2 taken 515 times.
✓ Branch 3 taken 4385 times.
|
6168 | if(!_walkflag(x, y+15+1,1,get_standing_z_state())&& |
| 15891 |
2/2✓ Branch 0 taken 706 times.
✓ Branch 1 taken 562 times.
|
1268 | !_walkflag(x+8, y+15+1,1,get_standing_z_state())&& |
| 15892 | 562 | _walkflag(x+15,y+15+1,1,get_standing_z_state())) | |
| 15893 | { | ||
| 15894 |
9/12✓ Branch 0 taken 511 times.
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 511 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 511 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 507 times.
✓ Branch 7 taken 4 times.
✓ Branch 8 taken 507 times.
✓ Branch 9 taken 4 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 515 times.
|
515 | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(hero_scr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?15:11),y+15+1)) |
| 15895 | 515 | sprite::move((zfix)-1,(zfix)0); | |
| 15896 | 515 | } | |
| 15897 |
4/4✓ Branch 0 taken 3632 times.
✓ Branch 1 taken 753 times.
✓ Branch 2 taken 513 times.
✓ Branch 3 taken 3872 times.
|
8017 | else if(_walkflag(x, y+15+1,1,get_standing_z_state())&& |
| 15898 |
2/2✓ Branch 0 taken 3119 times.
✓ Branch 1 taken 513 times.
|
3632 | !_walkflag(x+7, y+15+1,1,get_standing_z_state())&& |
| 15899 | 513 | !_walkflag(x+15,y+15+1,1,get_standing_z_state())) | |
| 15900 | { | ||
| 15901 |
7/12✓ Branch 0 taken 507 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 507 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 507 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 507 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 507 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 513 times.
|
513 | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(hero_scr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?0:4),y+15+1)) |
| 15902 | 513 | sprite::move((zfix)1,(zfix)0); | |
| 15903 | 513 | } | |
| 15904 | else | ||
| 15905 | { | ||
| 15906 | 3872 | pushing=push+1; | |
| 15907 | } | ||
| 15908 | 4900 | } | |
| 15909 | else | ||
| 15910 | { | ||
| 15911 | 3482 | pushing=push+1; // L: This makes solid damage combos and diagonal-triggered Armoses work. | |
| 15912 | } | ||
| 15913 | 8382 | } | |
| 15914 | |||
| 15915 | 76427 | return; | |
| 15916 | } | ||
| 15917 | ✗ | } | |
| 15918 | |||
| 15919 |
6/6✓ Branch 0 taken 105626 times.
✓ Branch 1 taken 302925 times.
✓ Branch 2 taken 102124 times.
✓ Branch 3 taken 3502 times.
✓ Branch 4 taken 102023 times.
✓ Branch 5 taken 101 times.
|
408551 | if (getInput(btnLeft, INPUT_DRUNK | INPUT_HERO_ACTION) && (holddir == -1 || holddir == left)) |
| 15920 | { | ||
| 15921 |
5/8✓ Branch 0 taken 2992 times.
✓ Branch 1 taken 102533 times.
✓ Branch 2 taken 2945 times.
✓ Branch 3 taken 47 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2992 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
105525 | if(isdungeon() && (y<=26 || y>=world_h - 42) && !get_qr(qr_FREEFORM) && !walk_through_walls) |
| 15922 | { | ||
| 15923 | ✗ | } | |
| 15924 | else | ||
| 15925 | { | ||
| 15926 |
4/6✓ Branch 0 taken 105126 times.
✓ Branch 1 taken 399 times.
✓ Branch 2 taken 105126 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 105126 times.
|
105525 | if(charging==0 && spins==0 && action != sideswimattacking) |
| 15927 | { | ||
| 15928 | 105126 | dir=left; | |
| 15929 | 105126 | } | |
| 15930 | 105525 | sideswimdir = left; | |
| 15931 | |||
| 15932 | 105525 | holddir=left; | |
| 15933 | |||
| 15934 |
4/4✓ Branch 0 taken 12469 times.
✓ Branch 1 taken 93056 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 12468 times.
|
105525 | if (getInput(btnUp, INPUT_DRUNK | INPUT_HERO_ACTION) && shiftdir != down) |
| 15935 | { | ||
| 15936 | 12468 | shiftdir=up; | |
| 15937 | 12468 | } | |
| 15938 |
4/4✓ Branch 0 taken 11444 times.
✓ Branch 1 taken 81613 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 11442 times.
|
93057 | else if (getInput(btnDown, INPUT_DRUNK | INPUT_HERO_ACTION) && shiftdir != up) |
| 15939 | { | ||
| 15940 | 11442 | shiftdir=down; | |
| 15941 | 11442 | } | |
| 15942 | else | ||
| 15943 | { | ||
| 15944 | 81615 | shiftdir=-1; | |
| 15945 | } | ||
| 15946 | |||
| 15947 | 105525 | do | |
| 15948 | { | ||
| 15949 | 116860 | info = walkflag(x-hero_newstep,y+(bigHitbox?0:8),1,left)||walkflag(x-hero_newstep,y+8,1,left); | |
| 15950 | |||
| 15951 | 116860 | info = info || walkflag(x-hero_newstep,y+15,1,left); | |
| 15952 | |||
| 15953 | 116860 | execute(info); | |
| 15954 | |||
| 15955 |
2/2✓ Branch 0 taken 21300 times.
✓ Branch 1 taken 95560 times.
|
116860 | if(info.isUnwalkable()) |
| 15956 | { | ||
| 15957 |
2/2✓ Branch 0 taken 1372 times.
✓ Branch 1 taken 19928 times.
|
21300 | if(x != x.getInt()) |
| 15958 | { | ||
| 15959 | 1372 | x.doRound(); | |
| 15960 | 1372 | } | |
| 15961 |
2/2✓ Branch 0 taken 9963 times.
✓ Branch 1 taken 9965 times.
|
19928 | else if(hero_newstep > 1) |
| 15962 | { | ||
| 15963 |
1/2✓ Branch 0 taken 9963 times.
✗ Branch 1 not taken.
|
9963 | if(hero_newstep != int32_t(hero_newstep)) //floor |
| 15964 | 9963 | hero_newstep = floor((double)hero_newstep); | |
| 15965 | ✗ | else --hero_newstep; | |
| 15966 | 9963 | } | |
| 15967 | else | ||
| 15968 | 9965 | break; | |
| 15969 | 11335 | } | |
| 15970 | 95560 | else walkable = true; | |
| 15971 |
2/2✓ Branch 0 taken 11335 times.
✓ Branch 1 taken 95560 times.
|
106895 | } |
| 15972 | 106895 | while(!walkable); | |
| 15973 | |||
| 15974 | 105525 | int32_t s=shiftdir; | |
| 15975 | |||
| 15976 |
10/14✓ Branch 0 taken 2992 times.
✓ Branch 1 taken 102533 times.
✓ Branch 2 taken 2948 times.
✓ Branch 3 taken 44 times.
✓ Branch 4 taken 2992 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 894 times.
✓ Branch 7 taken 104631 times.
✓ Branch 8 taken 894 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 894 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 894 times.
✗ Branch 13 not taken.
|
105525 | if((isdungeon() && (x<=26 || x>=world_w - 42) && !get_qr(qr_FREEFORM)) || (isSideViewHero() && !getOnSideviewLadder() && action != sideswimming && action != sideswimhit && action != sideswimattacking)) |
| 15977 | { | ||
| 15978 | 894 | shiftdir=-1; | |
| 15979 | 894 | } | |
| 15980 | else | ||
| 15981 | { | ||
| 15982 |
2/2✓ Branch 0 taken 92163 times.
✓ Branch 1 taken 12468 times.
|
104631 | if(s==up) |
| 15983 | { | ||
| 15984 | 12468 | do | |
| 15985 | { | ||
| 15986 | 14161 | zfix ty = y - hero_newstep_diag; | |
| 15987 | 28322 | info = walkflag(x,(bigHitbox?0:8) + ty,2,up) | |
| 15988 | 14161 | || walkflag(x+15,(bigHitbox?0:8) + ty,1,up); | |
| 15989 | |||
| 15990 |
3/4✓ Branch 0 taken 7 times.
✓ Branch 1 taken 14154 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 7 times.
|
14161 | if (ty < 0 && !bigHitbox) //sanity check for up scroll |
| 15991 | { | ||
| 15992 | 7 | info = info || walkflag(x, 0_zf, 2, up); | |
| 15993 | 7 | info = info || walkflag(x+15, 0_zf, 1, up); | |
| 15994 | 7 | } | |
| 15995 | 14161 | info = info || walkflagMBlock(x+15, (bigHitbox?0:8) + ty); | |
| 15996 | |||
| 15997 | 14161 | execute(info); | |
| 15998 | |||
| 15999 |
2/2✓ Branch 0 taken 3189 times.
✓ Branch 1 taken 10972 times.
|
14161 | if(info.isUnwalkable()) |
| 16000 | { | ||
| 16001 |
2/2✓ Branch 0 taken 197 times.
✓ Branch 1 taken 2992 times.
|
3189 | if(y != y.getInt()) |
| 16002 | { | ||
| 16003 | 197 | y.doRound(); | |
| 16004 | 197 | } | |
| 16005 |
2/2✓ Branch 0 taken 1496 times.
✓ Branch 1 taken 1496 times.
|
2992 | else if(hero_newstep_diag > 1) |
| 16006 | { | ||
| 16007 |
1/2✓ Branch 0 taken 1496 times.
✗ Branch 1 not taken.
|
1496 | if(hero_newstep_diag != hero_newstep_diag.getInt()) //floor |
| 16008 | 1496 | hero_newstep_diag.doFloor(); | |
| 16009 | ✗ | else --hero_newstep_diag; | |
| 16010 | 1496 | } | |
| 16011 | else | ||
| 16012 | 1496 | shiftdir = -1; | |
| 16013 | 3189 | } | |
| 16014 |
2/2✓ Branch 0 taken 9302 times.
✓ Branch 1 taken 1670 times.
|
10972 | else if(walkable) |
| 16015 | { | ||
| 16016 | 9302 | do | |
| 16017 | { | ||
| 16018 | 9361 | zfix tx = x-hero_newstep, ty = y-hero_newstep_diag; | |
| 16019 | 9361 | info = walkflag(tx,(bigHitbox?0:8)+ty,1,up); | |
| 16020 | |||
| 16021 |
3/4✓ Branch 0 taken 7 times.
✓ Branch 1 taken 9354 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 7 times.
|
9361 | if (ty < 0 && !bigHitbox) //sanity check for up scroll |
| 16022 | { | ||
| 16023 | 7 | info = info || walkflag(tx, 0_zf, 1, up); | |
| 16024 | 7 | info = info || walkflag(tx+15, 0_zf, 1, up); | |
| 16025 | 7 | } | |
| 16026 | 9361 | info = info || walkflagMBlock(tx+15, (bigHitbox?0:8) + ty); | |
| 16027 | |||
| 16028 | 9361 | execute(info); | |
| 16029 |
2/2✓ Branch 0 taken 97 times.
✓ Branch 1 taken 9264 times.
|
9361 | if(info.isUnwalkable()) |
| 16030 | { | ||
| 16031 |
2/2✓ Branch 0 taken 21 times.
✓ Branch 1 taken 76 times.
|
97 | if(y != y.getInt()) |
| 16032 | { | ||
| 16033 | 21 | y.doRound(); | |
| 16034 | 21 | } | |
| 16035 |
2/2✓ Branch 0 taken 38 times.
✓ Branch 1 taken 38 times.
|
76 | else if(hero_newstep_diag > 1) |
| 16036 | { | ||
| 16037 |
1/2✓ Branch 0 taken 38 times.
✗ Branch 1 not taken.
|
38 | if(hero_newstep_diag != hero_newstep_diag.getInt()) //floor |
| 16038 | 38 | hero_newstep_diag.doFloor(); | |
| 16039 | ✗ | else --hero_newstep_diag; | |
| 16040 | 38 | } | |
| 16041 | else | ||
| 16042 | 38 | shiftdir = -1; | |
| 16043 | 97 | } | |
| 16044 | 9264 | else break; | |
| 16045 |
2/2✓ Branch 0 taken 59 times.
✓ Branch 1 taken 38 times.
|
97 | } |
| 16046 | 97 | while(shiftdir != -1); | |
| 16047 | 9302 | break; | |
| 16048 | } | ||
| 16049 | 1670 | else break; | |
| 16050 |
2/2✓ Branch 0 taken 1693 times.
✓ Branch 1 taken 1496 times.
|
3189 | } |
| 16051 | 3189 | while(shiftdir != -1); | |
| 16052 | 12468 | } | |
| 16053 |
2/2✓ Branch 0 taken 80721 times.
✓ Branch 1 taken 11442 times.
|
92163 | else if(s==down) |
| 16054 | { | ||
| 16055 | 11442 | do | |
| 16056 | { | ||
| 16057 | 13536 | info = walkflag(x,y+15+hero_newstep_diag,2,down)||walkflag(x+15,y+15+hero_newstep_diag,1,down); | |
| 16058 | |||
| 16059 | 13536 | execute(info); | |
| 16060 | |||
| 16061 |
2/2✓ Branch 0 taken 3941 times.
✓ Branch 1 taken 9595 times.
|
13536 | if(info.isUnwalkable()) |
| 16062 | { | ||
| 16063 |
2/2✓ Branch 0 taken 201 times.
✓ Branch 1 taken 3740 times.
|
3941 | if(y != y.getInt()) |
| 16064 | { | ||
| 16065 | 201 | y.doRound(); | |
| 16066 | 201 | } | |
| 16067 |
2/2✓ Branch 0 taken 1893 times.
✓ Branch 1 taken 1847 times.
|
3740 | else if(hero_newstep_diag > 1) |
| 16068 | { | ||
| 16069 |
1/2✓ Branch 0 taken 1893 times.
✗ Branch 1 not taken.
|
1893 | if(hero_newstep_diag != hero_newstep_diag.getInt()) //floor |
| 16070 | 1893 | hero_newstep_diag.doFloor(); | |
| 16071 | ✗ | else --hero_newstep_diag; | |
| 16072 | 1893 | } | |
| 16073 | else | ||
| 16074 | 1847 | shiftdir = -1; | |
| 16075 | 3941 | } | |
| 16076 |
2/2✓ Branch 0 taken 7952 times.
✓ Branch 1 taken 1643 times.
|
9595 | else if(walkable) |
| 16077 | { | ||
| 16078 | 7952 | do | |
| 16079 | { | ||
| 16080 | 7970 | info = walkflag(x-hero_newstep,y+15+hero_newstep_diag,1,down); | |
| 16081 | 7970 | execute(info); | |
| 16082 |
2/2✓ Branch 0 taken 32 times.
✓ Branch 1 taken 7938 times.
|
7970 | if(info.isUnwalkable()) |
| 16083 | { | ||
| 16084 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 28 times.
|
32 | if(y != y.getInt()) |
| 16085 | { | ||
| 16086 | 4 | y.doRound(); | |
| 16087 | 4 | } | |
| 16088 |
2/2✓ Branch 0 taken 14 times.
✓ Branch 1 taken 14 times.
|
28 | else if(hero_newstep_diag > 1) |
| 16089 | { | ||
| 16090 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
|
14 | if(hero_newstep_diag != hero_newstep_diag.getInt()) //floor |
| 16091 | 14 | hero_newstep_diag.doFloor(); | |
| 16092 | ✗ | else --hero_newstep_diag; | |
| 16093 | 14 | } | |
| 16094 | else | ||
| 16095 | 14 | shiftdir = -1; | |
| 16096 | 32 | } | |
| 16097 | 7938 | else break; | |
| 16098 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 14 times.
|
32 | } |
| 16099 | 32 | while(shiftdir != -1); | |
| 16100 | 7952 | break; | |
| 16101 | } | ||
| 16102 | 1643 | else break; | |
| 16103 |
2/2✓ Branch 0 taken 2094 times.
✓ Branch 1 taken 1847 times.
|
3941 | } |
| 16104 | 3941 | while(shiftdir != -1); | |
| 16105 | 11442 | } | |
| 16106 | } | ||
| 16107 | |||
| 16108 | 105525 | moveOld2(left); | |
| 16109 | 105525 | shiftdir=s; | |
| 16110 | |||
| 16111 |
2/2✓ Branch 0 taken 95560 times.
✓ Branch 1 taken 9965 times.
|
105525 | if(!walkable) |
| 16112 | { | ||
| 16113 |
2/2✓ Branch 0 taken 3680 times.
✓ Branch 1 taken 6285 times.
|
9965 | if(shiftdir==-1) //Corner-shove; prevent being stuck on corners -V |
| 16114 | { | ||
| 16115 | 6285 | x = x.getInt(); | |
| 16116 | 6285 | y = y.getInt(); | |
| 16117 | 6285 | int32_t v1=bigHitbox?0:8; | |
| 16118 | 6285 | int32_t v2=bigHitbox?8:12; | |
| 16119 | |||
| 16120 |
4/4✓ Branch 0 taken 1218 times.
✓ Branch 1 taken 5067 times.
✓ Branch 2 taken 156 times.
✓ Branch 3 taken 6129 times.
|
7503 | if(!_walkflag(x-1,y+v1,1,get_standing_z_state())&& |
| 16121 |
2/2✓ Branch 0 taken 597 times.
✓ Branch 1 taken 621 times.
|
1218 | !_walkflag(x-1,y+v2,1,get_standing_z_state())&& |
| 16122 | 621 | _walkflag(x-1,y+15,1,get_standing_z_state())) | |
| 16123 | { | ||
| 16124 |
9/12✓ Branch 0 taken 149 times.
✓ Branch 1 taken 7 times.
✓ Branch 2 taken 149 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 149 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 146 times.
✓ Branch 7 taken 3 times.
✓ Branch 8 taken 146 times.
✓ Branch 9 taken 3 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 156 times.
|
156 | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(hero_scr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x-1,y+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?15:11))) |
| 16125 | 156 | sprite::move((zfix)0,(zfix)-1); | |
| 16126 | 156 | } | |
| 16127 |
4/4✓ Branch 0 taken 5067 times.
✓ Branch 1 taken 1062 times.
✓ Branch 2 taken 195 times.
✓ Branch 3 taken 5934 times.
|
11196 | else if(_walkflag(x-1,y+v1, 1,get_standing_z_state())&& |
| 16128 |
2/2✓ Branch 0 taken 4872 times.
✓ Branch 1 taken 195 times.
|
5067 | !_walkflag(x-1,y+v2-1,1,get_standing_z_state())&& |
| 16129 | 195 | !_walkflag(x-1,y+15, 1,get_standing_z_state())) | |
| 16130 | { | ||
| 16131 |
7/12✓ Branch 0 taken 194 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 194 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 194 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 194 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 194 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 195 times.
|
195 | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(hero_scr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x-1,y+v1+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?0:4))) |
| 16132 | 195 | sprite::move((zfix)0,(zfix)1); | |
| 16133 | 195 | } | |
| 16134 | else | ||
| 16135 | { | ||
| 16136 | 5934 | pushing=push+1; | |
| 16137 | } | ||
| 16138 | 6285 | } | |
| 16139 | else | ||
| 16140 | { | ||
| 16141 | 3680 | pushing=push+1; // L: This makes solid damage combos and diagonal-triggered Armoses work. | |
| 16142 | |||
| 16143 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3680 times.
|
3680 | if(action!=swimming) |
| 16144 | { | ||
| 16145 | 3680 | } | |
| 16146 | } | ||
| 16147 | 9965 | } | |
| 16148 | |||
| 16149 | 105525 | return; | |
| 16150 | } | ||
| 16151 | ✗ | } | |
| 16152 | |||
| 16153 |
5/6✓ Branch 0 taken 108312 times.
✓ Branch 1 taken 194714 times.
✓ Branch 2 taken 104710 times.
✓ Branch 3 taken 3602 times.
✓ Branch 4 taken 104710 times.
✗ Branch 5 not taken.
|
303026 | if (getInput(btnRight, INPUT_DRUNK | INPUT_HERO_ACTION) && (holddir == -1 || holddir == right)) |
| 16154 | { | ||
| 16155 |
5/8✓ Branch 0 taken 3423 times.
✓ Branch 1 taken 104889 times.
✓ Branch 2 taken 3321 times.
✓ Branch 3 taken 102 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 3423 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
108312 | if(isdungeon() && (y<=26 || y>=world_h - 42) && !get_qr(qr_FREEFORM) && !walk_through_walls) |
| 16156 | { | ||
| 16157 | ✗ | } | |
| 16158 | else | ||
| 16159 | { | ||
| 16160 |
4/6✓ Branch 0 taken 107610 times.
✓ Branch 1 taken 702 times.
✓ Branch 2 taken 107610 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 107610 times.
|
108312 | if(charging==0 && spins==0 && action != sideswimattacking) |
| 16161 | { | ||
| 16162 | 107610 | dir=right; | |
| 16163 | 107610 | } | |
| 16164 | 108312 | sideswimdir = right; | |
| 16165 | |||
| 16166 | 108312 | holddir=right; | |
| 16167 | |||
| 16168 |
4/4✓ Branch 0 taken 11938 times.
✓ Branch 1 taken 96374 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 11937 times.
|
108312 | if (getInput(btnUp, INPUT_DRUNK | INPUT_HERO_ACTION) && shiftdir != down) |
| 16169 | { | ||
| 16170 | 11937 | shiftdir=up; | |
| 16171 | 11937 | } | |
| 16172 |
4/4✓ Branch 0 taken 10841 times.
✓ Branch 1 taken 85534 times.
✓ Branch 2 taken 10837 times.
✓ Branch 3 taken 4 times.
|
96375 | else if (getInput(btnDown, INPUT_DRUNK | INPUT_HERO_ACTION) && shiftdir != up) |
| 16173 | { | ||
| 16174 | 10837 | shiftdir=down; | |
| 16175 | 10837 | } | |
| 16176 | else | ||
| 16177 | { | ||
| 16178 | 85538 | shiftdir=-1; | |
| 16179 | } | ||
| 16180 | |||
| 16181 | 108312 | do | |
| 16182 | { | ||
| 16183 | 119870 | info = walkflag(x+15+hero_newstep,y+(bigHitbox?0:8),1,right)||walkflag(x+15+hero_newstep,y+8,1,right);; | |
| 16184 | |||
| 16185 | 119870 | info = info || walkflag(x+15+hero_newstep,y+15,1,right); | |
| 16186 | |||
| 16187 | 119870 | execute(info); | |
| 16188 | |||
| 16189 |
2/2✓ Branch 0 taken 21932 times.
✓ Branch 1 taken 97938 times.
|
119870 | if(info.isUnwalkable()) |
| 16190 | { | ||
| 16191 |
2/2✓ Branch 0 taken 787 times.
✓ Branch 1 taken 21145 times.
|
21932 | if(x != x.getInt()) |
| 16192 | { | ||
| 16193 | 787 | x.doRound(); | |
| 16194 | 787 | } | |
| 16195 |
2/2✓ Branch 0 taken 10771 times.
✓ Branch 1 taken 10374 times.
|
21145 | else if(hero_newstep > 1) |
| 16196 | { | ||
| 16197 |
1/2✓ Branch 0 taken 10771 times.
✗ Branch 1 not taken.
|
10771 | if(hero_newstep != int32_t(hero_newstep)) //floor |
| 16198 | 10771 | hero_newstep = floor((double)hero_newstep); | |
| 16199 | ✗ | else --hero_newstep; | |
| 16200 | 10771 | } | |
| 16201 | else | ||
| 16202 | 10374 | break; | |
| 16203 | 11558 | } | |
| 16204 | 97938 | else walkable = true; | |
| 16205 |
2/2✓ Branch 0 taken 11558 times.
✓ Branch 1 taken 97938 times.
|
109496 | } |
| 16206 | 109496 | while(!walkable); | |
| 16207 | |||
| 16208 | 108312 | int32_t s=shiftdir; | |
| 16209 | |||
| 16210 |
10/14✓ Branch 0 taken 3423 times.
✓ Branch 1 taken 104889 times.
✓ Branch 2 taken 3373 times.
✓ Branch 3 taken 50 times.
✓ Branch 4 taken 3423 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1560 times.
✓ Branch 7 taken 106752 times.
✓ Branch 8 taken 1560 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 1560 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 1560 times.
✗ Branch 13 not taken.
|
108312 | if((isdungeon() && (x<=26 || x>=world_w - 42) && !get_qr(qr_FREEFORM)) || (isSideViewHero() && !getOnSideviewLadder() && action != sideswimming && action != sideswimhit && action != sideswimattacking)) |
| 16211 | { | ||
| 16212 | 1560 | shiftdir=-1; | |
| 16213 | 1560 | } | |
| 16214 | else | ||
| 16215 | { | ||
| 16216 |
2/2✓ Branch 0 taken 94815 times.
✓ Branch 1 taken 11937 times.
|
106752 | if(s==up) |
| 16217 | { | ||
| 16218 | 11937 | do | |
| 16219 | { | ||
| 16220 | 13313 | zfix ty = y - hero_newstep_diag; | |
| 16221 | 26626 | info = walkflag(x,(bigHitbox?0:8) + ty,2,up) | |
| 16222 | 13313 | || walkflag(x+15,(bigHitbox?0:8) + ty,1,up); | |
| 16223 | |||
| 16224 |
3/4✓ Branch 0 taken 7 times.
✓ Branch 1 taken 13306 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 7 times.
|
13313 | if (ty < 0 && !bigHitbox) //sanity check for up scroll |
| 16225 | { | ||
| 16226 | 7 | info = info || walkflag(x, 0_zf, 2, up); | |
| 16227 | 7 | info = info || walkflag(x+15, 0_zf, 1, up); | |
| 16228 | 7 | } | |
| 16229 | 13313 | info = info || walkflagMBlock(x+15, (bigHitbox?0:8) + ty); | |
| 16230 | |||
| 16231 | 13313 | execute(info); | |
| 16232 | |||
| 16233 |
2/2✓ Branch 0 taken 2558 times.
✓ Branch 1 taken 10755 times.
|
13313 | if(info.isUnwalkable()) |
| 16234 | { | ||
| 16235 |
2/2✓ Branch 0 taken 194 times.
✓ Branch 1 taken 2364 times.
|
2558 | if(y != y.getInt()) |
| 16236 | { | ||
| 16237 | 194 | y.doRound(); | |
| 16238 | 194 | } | |
| 16239 |
2/2✓ Branch 0 taken 1182 times.
✓ Branch 1 taken 1182 times.
|
2364 | else if(hero_newstep_diag > 1) |
| 16240 | { | ||
| 16241 |
1/2✓ Branch 0 taken 1182 times.
✗ Branch 1 not taken.
|
1182 | if(hero_newstep_diag != hero_newstep_diag.getInt()) //floor |
| 16242 | 1182 | hero_newstep_diag.doFloor(); | |
| 16243 | ✗ | else --hero_newstep_diag; | |
| 16244 | 1182 | } | |
| 16245 | else | ||
| 16246 | 1182 | shiftdir = -1; | |
| 16247 | 2558 | } | |
| 16248 |
2/2✓ Branch 0 taken 9440 times.
✓ Branch 1 taken 1315 times.
|
10755 | else if(walkable) |
| 16249 | { | ||
| 16250 | 9440 | do | |
| 16251 | { | ||
| 16252 | 9488 | zfix tx = x+hero_newstep, ty = y-hero_newstep_diag; | |
| 16253 | 9488 | info = walkflag(tx+15,(bigHitbox?0:8)+ty,1,up); | |
| 16254 | |||
| 16255 |
3/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 9483 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5 times.
|
9488 | if (ty < 0 && !bigHitbox) //sanity check for up scroll |
| 16256 | { | ||
| 16257 | 5 | info = info || walkflag(tx, 0_zf, 1, up); | |
| 16258 | 5 | info = info || walkflag(tx+15, 0_zf, 1, up); | |
| 16259 | 5 | } | |
| 16260 | 9488 | info = info || walkflagMBlock(tx+15, (bigHitbox?0:8) + ty); | |
| 16261 | 9488 | execute(info); | |
| 16262 |
2/2✓ Branch 0 taken 75 times.
✓ Branch 1 taken 9413 times.
|
9488 | if(info.isUnwalkable()) |
| 16263 | { | ||
| 16264 |
2/2✓ Branch 0 taken 21 times.
✓ Branch 1 taken 54 times.
|
75 | if(y != y.getInt()) |
| 16265 | { | ||
| 16266 | 21 | y.doRound(); | |
| 16267 | 21 | } | |
| 16268 |
2/2✓ Branch 0 taken 27 times.
✓ Branch 1 taken 27 times.
|
54 | else if(hero_newstep_diag > 1) |
| 16269 | { | ||
| 16270 |
1/2✓ Branch 0 taken 27 times.
✗ Branch 1 not taken.
|
27 | if(hero_newstep_diag != hero_newstep_diag.getInt()) //floor |
| 16271 | 27 | hero_newstep_diag.doFloor(); | |
| 16272 | ✗ | else --hero_newstep_diag; | |
| 16273 | 27 | } | |
| 16274 | else | ||
| 16275 | 27 | shiftdir = -1; | |
| 16276 | 75 | } | |
| 16277 | 9413 | else break; | |
| 16278 |
2/2✓ Branch 0 taken 48 times.
✓ Branch 1 taken 27 times.
|
75 | } |
| 16279 | 75 | while(shiftdir != -1); | |
| 16280 | 9440 | break; | |
| 16281 | } | ||
| 16282 | 1315 | else break; | |
| 16283 |
2/2✓ Branch 0 taken 1376 times.
✓ Branch 1 taken 1182 times.
|
2558 | } |
| 16284 | 2558 | while(shiftdir != -1); | |
| 16285 | 11937 | } | |
| 16286 |
2/2✓ Branch 0 taken 83978 times.
✓ Branch 1 taken 10837 times.
|
94815 | else if(s==down) |
| 16287 | { | ||
| 16288 | 10837 | do | |
| 16289 | { | ||
| 16290 | 12652 | info = walkflag(x,y+15+hero_newstep_diag,2,down)||walkflag(x+15,y+15+hero_newstep_diag,1,down); | |
| 16291 | |||
| 16292 | 12652 | execute(info); | |
| 16293 | |||
| 16294 |
2/2✓ Branch 0 taken 3373 times.
✓ Branch 1 taken 9279 times.
|
12652 | if(info.isUnwalkable()) |
| 16295 | { | ||
| 16296 |
2/2✓ Branch 0 taken 209 times.
✓ Branch 1 taken 3164 times.
|
3373 | if(y != y.getInt()) |
| 16297 | { | ||
| 16298 | 209 | y.doRound(); | |
| 16299 | 209 | } | |
| 16300 |
2/2✓ Branch 0 taken 1558 times.
✓ Branch 1 taken 1606 times.
|
3164 | else if(hero_newstep_diag > 1) |
| 16301 | { | ||
| 16302 |
1/2✓ Branch 0 taken 1606 times.
✗ Branch 1 not taken.
|
1606 | if(hero_newstep_diag != hero_newstep_diag.getInt()) //floor |
| 16303 | 1606 | hero_newstep_diag.doFloor(); | |
| 16304 | ✗ | else --hero_newstep_diag; | |
| 16305 | 1606 | } | |
| 16306 | else | ||
| 16307 | 1558 | shiftdir = -1; | |
| 16308 | 3373 | } | |
| 16309 |
2/2✓ Branch 0 taken 7880 times.
✓ Branch 1 taken 1399 times.
|
9279 | else if(walkable) |
| 16310 | { | ||
| 16311 | 7880 | do | |
| 16312 | { | ||
| 16313 | 7913 | info = walkflag(x+15+hero_newstep,y+15+hero_newstep_diag,1,down); | |
| 16314 | 7913 | execute(info); | |
| 16315 |
2/2✓ Branch 0 taken 54 times.
✓ Branch 1 taken 7859 times.
|
7913 | if(info.isUnwalkable()) |
| 16316 | { | ||
| 16317 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 44 times.
|
54 | if(y != y.getInt()) |
| 16318 | { | ||
| 16319 | 10 | y.doRound(); | |
| 16320 | 10 | } | |
| 16321 |
2/2✓ Branch 0 taken 21 times.
✓ Branch 1 taken 23 times.
|
44 | else if(hero_newstep_diag > 1) |
| 16322 | { | ||
| 16323 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 23 times.
|
23 | if(hero_newstep_diag != hero_newstep_diag.getInt()) //floor |
| 16324 | 23 | hero_newstep_diag.doFloor(); | |
| 16325 | ✗ | else --hero_newstep_diag; | |
| 16326 | 23 | } | |
| 16327 | else | ||
| 16328 | 21 | shiftdir = -1; | |
| 16329 | 54 | } | |
| 16330 | 7859 | else break; | |
| 16331 |
2/2✓ Branch 0 taken 33 times.
✓ Branch 1 taken 21 times.
|
54 | } |
| 16332 | 54 | while(shiftdir != -1); | |
| 16333 | 7880 | break; | |
| 16334 | } | ||
| 16335 | 1399 | else break; | |
| 16336 |
2/2✓ Branch 0 taken 1815 times.
✓ Branch 1 taken 1558 times.
|
3373 | } |
| 16337 | 3373 | while(shiftdir != -1); | |
| 16338 | 10837 | } | |
| 16339 | } | ||
| 16340 | |||
| 16341 | 108312 | moveOld2(right); | |
| 16342 | 108312 | shiftdir=s; | |
| 16343 | |||
| 16344 |
2/2✓ Branch 0 taken 97938 times.
✓ Branch 1 taken 10374 times.
|
108312 | if(!walkable) |
| 16345 | { | ||
| 16346 |
2/2✓ Branch 0 taken 2939 times.
✓ Branch 1 taken 7435 times.
|
10374 | if(shiftdir==-1) //Corner-shove; prevent being stuck on corners -V |
| 16347 | { | ||
| 16348 | 7435 | x = x.getInt(); | |
| 16349 | 7435 | y = y.getInt(); | |
| 16350 | 7435 | int32_t v1=bigHitbox?0:8; | |
| 16351 | 7435 | int32_t v2=bigHitbox?8:12; | |
| 16352 | |||
| 16353 |
4/4✓ Branch 0 taken 1159 times.
✓ Branch 1 taken 6276 times.
✓ Branch 2 taken 238 times.
✓ Branch 3 taken 7197 times.
|
8594 | if(!_walkflag(x+16,y+v1,1,get_standing_z_state())&& |
| 16354 |
2/2✓ Branch 0 taken 701 times.
✓ Branch 1 taken 458 times.
|
1159 | !_walkflag(x+16,y+v2,1,get_standing_z_state())&& |
| 16355 | 458 | _walkflag(x+16,y+15,1,get_standing_z_state())) | |
| 16356 | { | ||
| 16357 |
7/12✓ Branch 0 taken 231 times.
✓ Branch 1 taken 7 times.
✓ Branch 2 taken 231 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 231 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 231 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 231 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 238 times.
|
238 | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(hero_scr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x+16,y+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?15:11))) |
| 16358 | 238 | sprite::move((zfix)0,(zfix)-1); | |
| 16359 | 238 | } | |
| 16360 |
4/4✓ Branch 0 taken 6276 times.
✓ Branch 1 taken 921 times.
✓ Branch 2 taken 254 times.
✓ Branch 3 taken 6943 times.
|
13473 | else if(_walkflag(x+16,y+v1,1,get_standing_z_state())&& |
| 16361 |
2/2✓ Branch 0 taken 6022 times.
✓ Branch 1 taken 254 times.
|
6276 | !_walkflag(x+16,y+v2-1,1,get_standing_z_state())&& |
| 16362 | 254 | !_walkflag(x+16,y+15,1,get_standing_z_state())) | |
| 16363 | { | ||
| 16364 |
9/12✓ Branch 0 taken 253 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 253 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 253 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 250 times.
✓ Branch 7 taken 3 times.
✓ Branch 8 taken 250 times.
✓ Branch 9 taken 3 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 254 times.
|
254 | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(hero_scr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x+16,y+v1+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?0:4))) |
| 16365 | 254 | sprite::move((zfix)0,(zfix)1); | |
| 16366 | 254 | } | |
| 16367 | else | ||
| 16368 | { | ||
| 16369 | 6943 | pushing=push+1; | |
| 16370 | 6943 | z3step=2; | |
| 16371 | } | ||
| 16372 | 7435 | } | |
| 16373 | else | ||
| 16374 | { | ||
| 16375 | 2939 | pushing=push+1; // L: This makes solid damage combos and diagonal-triggered Armoses work. | |
| 16376 | |||
| 16377 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2939 times.
|
2939 | if(action!=swimming) |
| 16378 | { | ||
| 16379 | 2939 | } | |
| 16380 | } | ||
| 16381 | 10374 | } | |
| 16382 | |||
| 16383 | 108312 | return; | |
| 16384 | } | ||
| 16385 | ✗ | } | |
| 16386 | 194714 | } | |
| 16387 | else | ||
| 16388 | { | ||
| 16389 |
6/6✓ Branch 0 taken 605306 times.
✓ Branch 1 taken 2488322 times.
✓ Branch 2 taken 591459 times.
✓ Branch 3 taken 13847 times.
✓ Branch 4 taken 130835 times.
✓ Branch 5 taken 471374 times.
|
3093628 | if (getInput(btnUp, INPUT_DRUNK | INPUT_HERO_ACTION) && (holddir == -1 || holddir == up)) |
| 16390 | { | ||
| 16391 |
5/8✓ Branch 0 taken 3903 times.
✓ Branch 1 taken 481318 times.
✓ Branch 2 taken 3899 times.
✓ Branch 3 taken 4 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 3903 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
485221 | if(isdungeon() && (x<=26 || x>=world_w - 42) && !get_qr(qr_FREEFORM) && !walk_through_walls) |
| 16392 | { | ||
| 16393 | ✗ | } | |
| 16394 | else | ||
| 16395 | { | ||
| 16396 |
3/4✓ Branch 0 taken 440629 times.
✓ Branch 1 taken 44592 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 440629 times.
|
485221 | if(charging==0 && spins==0) |
| 16397 | { | ||
| 16398 | 440629 | dir=up; | |
| 16399 | 440629 | } | |
| 16400 | |||
| 16401 | 485221 | holddir=up; | |
| 16402 | |||
| 16403 |
4/4✓ Branch 0 taken 64206 times.
✓ Branch 1 taken 340161 times.
✓ Branch 2 taken 110 times.
✓ Branch 3 taken 64096 times.
|
485221 | if (getInput(btnRight, INPUT_DRUNK | INPUT_HERO_ACTION) && shiftdir != left) |
| 16404 | { | ||
| 16405 | 64096 | shiftdir=right; | |
| 16406 | 64096 | } | |
| 16407 |
4/4✓ Branch 0 taken 52930 times.
✓ Branch 1 taken 287341 times.
✓ Branch 2 taken 80 times.
✓ Branch 3 taken 52850 times.
|
340271 | else if (getInput(btnLeft, INPUT_DRUNK | INPUT_HERO_ACTION) && shiftdir != right) |
| 16408 | { | ||
| 16409 | 52850 | shiftdir=left; | |
| 16410 | 52850 | } | |
| 16411 | else | ||
| 16412 | { | ||
| 16413 | 287421 | shiftdir=-1; | |
| 16414 | } | ||
| 16415 | |||
| 16416 | //walkable if Ladder can be placed or is already placed vertically | ||
| 16417 |
10/18✓ Branch 0 taken 21030 times.
✓ Branch 1 taken 383337 times.
✓ Branch 2 taken 21030 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 21030 times.
✓ Branch 6 taken 21030 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✓ Branch 10 taken 20899 times.
✓ Branch 11 taken 20899 times.
✓ Branch 12 taken 20899 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 20899 times.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✓ Branch 17 taken 20899 times.
|
404367 | if(isSideViewHero() && !walk_through_walls && !(((replay_version_check(0, 23) || get_qr(qr_OLD_LADDER_ITEM_SIDEVIEW)) && can_deploy_ladder()) || (ladderx && laddery && ladderdir==up)) && !getOnSideviewLadder() && action != sideswimming && action != sideswimhit && action != sideswimattacking) |
| 16418 | { | ||
| 16419 | 20899 | walkable=false; | |
| 16420 | 20899 | } | |
| 16421 | else | ||
| 16422 | { | ||
| 16423 |
7/8✓ Branch 0 taken 57465 times.
✓ Branch 1 taken 367801 times.
✓ Branch 2 taken 787 times.
✓ Branch 3 taken 56678 times.
✓ Branch 4 taken 963 times.
✓ Branch 5 taken 423516 times.
✓ Branch 6 taken 963 times.
✗ Branch 7 not taken.
|
425266 | if ((can_deploy_ladder() && get_qr(qr_OLD_LADDER_ITEM_SIDEVIEW)) || (ladderx && laddery && ladderdir==up)) justmoved = 2; |
| 16424 | 425266 | info = walkflag(x,y+(bigHitbox?0:8)-z3step,2,up); | |
| 16425 | |||
| 16426 |
2/2✓ Branch 0 taken 231559 times.
✓ Branch 1 taken 193707 times.
|
425266 | if(x.getInt() & 7) |
| 16427 | 231559 | info = info || walkflag(x+16,y+(bigHitbox?0:8)-z3step,1,up); | |
| 16428 | else | ||
| 16429 | 193707 | info = info || walkflagMBlock(x+16, y+(bigHitbox?0:8)-z3step); | |
| 16430 | |||
| 16431 | 425266 | execute(info); | |
| 16432 | |||
| 16433 |
2/2✓ Branch 0 taken 66936 times.
✓ Branch 1 taken 358330 times.
|
425266 | if(info.isUnwalkable()) |
| 16434 | { | ||
| 16435 |
2/2✓ Branch 0 taken 65594 times.
✓ Branch 1 taken 1342 times.
|
66936 | if(z3step==2) |
| 16436 | { | ||
| 16437 | 65594 | z3step=1; | |
| 16438 | 65594 | info = walkflag(x,y+(bigHitbox?0:8)-z3step,2,up); | |
| 16439 | |||
| 16440 |
2/2✓ Branch 0 taken 28001 times.
✓ Branch 1 taken 37593 times.
|
65594 | if(x.getInt()&7) |
| 16441 | 37593 | info = info || walkflag(x+16,y+(bigHitbox?0:8)-z3step,1,up); | |
| 16442 | else | ||
| 16443 | 28001 | info = info || walkflagMBlock(x+16, y+(bigHitbox?0:8)-z3step); | |
| 16444 | |||
| 16445 | 65594 | execute(info); | |
| 16446 | |||
| 16447 |
2/2✓ Branch 0 taken 60487 times.
✓ Branch 1 taken 5107 times.
|
65594 | if(info.isUnwalkable()) |
| 16448 | { | ||
| 16449 | 60487 | walkable = false; | |
| 16450 | 60487 | } | |
| 16451 | else | ||
| 16452 | { | ||
| 16453 | 5107 | walkable=true; | |
| 16454 | } | ||
| 16455 | 65594 | } | |
| 16456 | else | ||
| 16457 | { | ||
| 16458 | 1342 | walkable=false; | |
| 16459 | } | ||
| 16460 | 66936 | } | |
| 16461 | else | ||
| 16462 | { | ||
| 16463 | 358330 | walkable = true; | |
| 16464 | } | ||
| 16465 | } | ||
| 16466 | |||
| 16467 | 446165 | int32_t s=shiftdir; | |
| 16468 | |||
| 16469 |
5/6✓ Branch 0 taken 3903 times.
✓ Branch 1 taken 442262 times.
✓ Branch 2 taken 3784 times.
✓ Branch 3 taken 119 times.
✓ Branch 4 taken 3903 times.
✗ Branch 5 not taken.
|
446165 | if(isdungeon() && (y<=26 || y>=world_h-42) && !get_qr(qr_FREEFORM)) |
| 16470 | { | ||
| 16471 | ✗ | shiftdir=-1; | |
| 16472 | ✗ | } | |
| 16473 | else | ||
| 16474 | { | ||
| 16475 |
2/2✓ Branch 0 taken 52850 times.
✓ Branch 1 taken 393315 times.
|
446165 | if(s==left) |
| 16476 | { | ||
| 16477 | 52850 | info = (walkflag(x-1,y+(bigHitbox?0:8),1,left)||walkflag(x-1,y+15,1,left)); | |
| 16478 | 52850 | execute(info); | |
| 16479 | |||
| 16480 |
2/2✓ Branch 0 taken 7278 times.
✓ Branch 1 taken 45572 times.
|
52850 | if(info.isUnwalkable()) |
| 16481 | { | ||
| 16482 | 7278 | shiftdir=-1; | |
| 16483 | 7278 | } | |
| 16484 |
2/2✓ Branch 0 taken 9498 times.
✓ Branch 1 taken 36074 times.
|
45572 | else if(walkable) |
| 16485 | { | ||
| 16486 | 36074 | info = walkflag(x-1,y+(bigHitbox?0:8)-1,1,left); | |
| 16487 | 36074 | execute(info); | |
| 16488 |
2/2✓ Branch 0 taken 35991 times.
✓ Branch 1 taken 83 times.
|
36074 | if(info.isUnwalkable()) |
| 16489 | { | ||
| 16490 | 83 | shiftdir=-1; | |
| 16491 | 83 | } | |
| 16492 | 36074 | } | |
| 16493 | 52850 | } | |
| 16494 |
2/2✓ Branch 0 taken 329219 times.
✓ Branch 1 taken 64096 times.
|
393315 | else if(s==right) |
| 16495 | { | ||
| 16496 | 64096 | info = walkflag(x+16,y+(bigHitbox?0:8),1,right)||walkflag(x+16,y+15,1,right); | |
| 16497 | 64096 | execute(info); | |
| 16498 | |||
| 16499 |
2/2✓ Branch 0 taken 9315 times.
✓ Branch 1 taken 54781 times.
|
64096 | if(info.isUnwalkable()) |
| 16500 | { | ||
| 16501 | 9315 | shiftdir=-1; | |
| 16502 | 9315 | } | |
| 16503 |
2/2✓ Branch 0 taken 11126 times.
✓ Branch 1 taken 43655 times.
|
54781 | else if(walkable) |
| 16504 | { | ||
| 16505 | 43655 | info = walkflag(x+16,y+(bigHitbox?0:8)-1,1,right); | |
| 16506 | 43655 | execute(info); | |
| 16507 | |||
| 16508 |
2/2✓ Branch 0 taken 43569 times.
✓ Branch 1 taken 86 times.
|
43655 | if(info.isUnwalkable()) |
| 16509 | { | ||
| 16510 | 86 | shiftdir=-1; | |
| 16511 | 86 | } | |
| 16512 | 43655 | } | |
| 16513 | 64096 | } | |
| 16514 | } | ||
| 16515 | |||
| 16516 | 446165 | moveOld2(up); | |
| 16517 | 446165 | shiftdir=s; | |
| 16518 | |||
| 16519 |
2/2✓ Branch 0 taken 363437 times.
✓ Branch 1 taken 82728 times.
|
446165 | if(!walkable) |
| 16520 | { | ||
| 16521 |
2/2✓ Branch 0 taken 25064 times.
✓ Branch 1 taken 57664 times.
|
82728 | if(shiftdir==-1) //Corner-shove; prevent being stuck on corners -V |
| 16522 | { | ||
| 16523 |
4/4✓ Branch 0 taken 28362 times.
✓ Branch 1 taken 29302 times.
✓ Branch 2 taken 2488 times.
✓ Branch 3 taken 55176 times.
|
86026 | if(!_walkflag(x, y+(bigHitbox?0:8)-1,1,get_standing_z_state()) && |
| 16524 |
2/2✓ Branch 0 taken 5838 times.
✓ Branch 1 taken 22524 times.
|
28362 | !_walkflag(x+8, y+(bigHitbox?0:8)-1,1,get_standing_z_state()) && |
| 16525 | 22524 | _walkflag(x+15,y+(bigHitbox?0:8)-1,1,get_standing_z_state())) | |
| 16526 | { | ||
| 16527 |
9/12✓ Branch 0 taken 2417 times.
✓ Branch 1 taken 71 times.
✓ Branch 2 taken 2417 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2417 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2389 times.
✓ Branch 7 taken 28 times.
✓ Branch 8 taken 2389 times.
✓ Branch 9 taken 28 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 2488 times.
|
2488 | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(hero_scr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?15:11),y+(bigHitbox?0:8)-1)) |
| 16528 | 2488 | sprite::move((zfix)-1,(zfix)0); | |
| 16529 | 2488 | } | |
| 16530 | else | ||
| 16531 | { | ||
| 16532 |
4/4✓ Branch 0 taken 29302 times.
✓ Branch 1 taken 25874 times.
✓ Branch 2 taken 2472 times.
✓ Branch 3 taken 52704 times.
|
84478 | if(_walkflag(x, y+(bigHitbox?0:8)-1,1,get_standing_z_state()) && |
| 16533 |
2/2✓ Branch 0 taken 26830 times.
✓ Branch 1 taken 2472 times.
|
29302 | !_walkflag(x+7, y+(bigHitbox?0:8)-1,1,get_standing_z_state()) && |
| 16534 | 2472 | !_walkflag(x+15,y+(bigHitbox?0:8)-1,1,get_standing_z_state())) | |
| 16535 | { | ||
| 16536 |
10/12✓ Branch 0 taken 2383 times.
✓ Branch 1 taken 89 times.
✓ Branch 2 taken 2383 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2383 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 2370 times.
✓ Branch 7 taken 13 times.
✓ Branch 8 taken 2370 times.
✓ Branch 9 taken 13 times.
✓ Branch 10 taken 2 times.
✓ Branch 11 taken 2470 times.
|
2472 | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(hero_scr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?0:4),y+(bigHitbox?0:8)-1)) |
| 16537 | 2470 | sprite::move((zfix)1,(zfix)0); | |
| 16538 | 2472 | } | |
| 16539 | else | ||
| 16540 | { | ||
| 16541 | 52704 | pushing=push+1; | |
| 16542 | } | ||
| 16543 | } | ||
| 16544 | |||
| 16545 | 57664 | z3step=2; | |
| 16546 | 57664 | } | |
| 16547 | else | ||
| 16548 | { | ||
| 16549 | 25064 | pushing=push+1; // L: This makes solid damage combos and diagonal-triggered Armoses work. | |
| 16550 | 25064 | z3step=2; | |
| 16551 | } | ||
| 16552 | 82728 | } | |
| 16553 | |||
| 16554 | 446165 | return; | |
| 16555 | } | ||
| 16556 | ✗ | } | |
| 16557 | |||
| 16558 |
6/6✓ Branch 0 taken 505248 times.
✓ Branch 1 taken 2113909 times.
✓ Branch 2 taken 493208 times.
✓ Branch 3 taken 12040 times.
✓ Branch 4 taken 365430 times.
✓ Branch 5 taken 127778 times.
|
2619157 | if (getInput(btnDown, INPUT_DRUNK | INPUT_HERO_ACTION) && (holddir == -1 || holddir == down)) |
| 16559 | { | ||
| 16560 |
4/8✓ Branch 0 taken 2675 times.
✓ Branch 1 taken 374795 times.
✓ Branch 2 taken 2675 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2675 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
377470 | if(isdungeon() && (x<=26 || x>=world_w - 42) && !get_qr(qr_FREEFORM) && !walk_through_walls) |
| 16561 | { | ||
| 16562 | ✗ | } | |
| 16563 | else | ||
| 16564 | { | ||
| 16565 |
3/4✓ Branch 0 taken 372454 times.
✓ Branch 1 taken 5016 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 372454 times.
|
377470 | if(charging==0 && spins==0) |
| 16566 | { | ||
| 16567 | 372454 | dir=down; | |
| 16568 | 372454 | } | |
| 16569 | |||
| 16570 | 377470 | holddir=down; | |
| 16571 | |||
| 16572 |
4/4✓ Branch 0 taken 62738 times.
✓ Branch 1 taken 314732 times.
✓ Branch 2 taken 298 times.
✓ Branch 3 taken 62440 times.
|
377470 | if (getInput(btnRight, INPUT_DRUNK | INPUT_HERO_ACTION) && shiftdir != left) |
| 16573 | { | ||
| 16574 | 62440 | shiftdir=right; | |
| 16575 | 62440 | } | |
| 16576 |
4/4✓ Branch 0 taken 58119 times.
✓ Branch 1 taken 256911 times.
✓ Branch 2 taken 84 times.
✓ Branch 3 taken 58035 times.
|
315030 | else if (getInput(btnLeft, INPUT_DRUNK | INPUT_HERO_ACTION) && shiftdir != right) |
| 16577 | { | ||
| 16578 | 58035 | shiftdir=left; | |
| 16579 | 58035 | } | |
| 16580 | else | ||
| 16581 | { | ||
| 16582 | 256995 | shiftdir=-1; | |
| 16583 | } | ||
| 16584 | |||
| 16585 | //bool walkable; | ||
| 16586 |
7/12✓ Branch 0 taken 12293 times.
✓ Branch 1 taken 365177 times.
✓ Branch 2 taken 12293 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 12293 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 12293 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 12293 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 12293 times.
|
377470 | if(isSideViewHero() && !walk_through_walls && !getOnSideviewLadder() && action != sideswimming && action != sideswimhit && action != sideswimattacking) |
| 16587 | { | ||
| 16588 | 12293 | walkable=false; | |
| 16589 | 12293 | } | |
| 16590 | else | ||
| 16591 | { | ||
| 16592 | 365177 | info = walkflag(x,y+15+z3step,2,down); | |
| 16593 | |||
| 16594 |
2/2✓ Branch 0 taken 202261 times.
✓ Branch 1 taken 162916 times.
|
365177 | if(x.getInt()&7) |
| 16595 | 202261 | info = info || walkflag(x+16,y+15+z3step,1,down); | |
| 16596 | else | ||
| 16597 | 162916 | info = info || walkflagMBlock(x+16, y+15+z3step); | |
| 16598 | |||
| 16599 | 365177 | execute(info); | |
| 16600 | |||
| 16601 |
2/2✓ Branch 0 taken 64896 times.
✓ Branch 1 taken 300281 times.
|
365177 | if(info.isUnwalkable()) |
| 16602 | { | ||
| 16603 |
2/2✓ Branch 0 taken 63721 times.
✓ Branch 1 taken 1175 times.
|
64896 | if(z3step==2) |
| 16604 | { | ||
| 16605 | 63721 | z3step=1; | |
| 16606 | 63721 | info = walkflag(x,y+15+z3step,2,down); | |
| 16607 | |||
| 16608 |
2/2✓ Branch 0 taken 24935 times.
✓ Branch 1 taken 38786 times.
|
63721 | if(x.getInt()&7) |
| 16609 | 38786 | info = info || walkflag(x+16,y+15+z3step,1,down); | |
| 16610 | else | ||
| 16611 | 24935 | info = info || walkflagMBlock(x+16, y+15+z3step); | |
| 16612 | |||
| 16613 | 63721 | execute(info); | |
| 16614 | |||
| 16615 |
2/2✓ Branch 0 taken 59220 times.
✓ Branch 1 taken 4501 times.
|
63721 | if(info.isUnwalkable()) |
| 16616 | { | ||
| 16617 | 59220 | walkable = false; | |
| 16618 | 59220 | } | |
| 16619 | else | ||
| 16620 | { | ||
| 16621 | 4501 | walkable=true; | |
| 16622 | } | ||
| 16623 | 63721 | } | |
| 16624 | else | ||
| 16625 | { | ||
| 16626 | 1175 | walkable=false; | |
| 16627 | } | ||
| 16628 | 64896 | } | |
| 16629 | else | ||
| 16630 | { | ||
| 16631 | 300281 | walkable = true; | |
| 16632 | } | ||
| 16633 | } | ||
| 16634 | |||
| 16635 | 377470 | int32_t s=shiftdir; | |
| 16636 | |||
| 16637 |
5/6✓ Branch 0 taken 2675 times.
✓ Branch 1 taken 374795 times.
✓ Branch 2 taken 2670 times.
✓ Branch 3 taken 5 times.
✓ Branch 4 taken 2675 times.
✗ Branch 5 not taken.
|
377470 | if(isdungeon() && (y<=26 || y>=world_h-42) && !get_qr(qr_FREEFORM)) |
| 16638 | { | ||
| 16639 | ✗ | shiftdir=-1; | |
| 16640 | ✗ | } | |
| 16641 | else | ||
| 16642 | { | ||
| 16643 |
2/2✓ Branch 0 taken 58035 times.
✓ Branch 1 taken 319435 times.
|
377470 | if(s==left) |
| 16644 | { | ||
| 16645 | 58035 | info = walkflag(x-1,y+(bigHitbox?0:8),1,left)||walkflag(x-1,y+15,1,left); | |
| 16646 | 58035 | execute(info); | |
| 16647 | |||
| 16648 |
2/2✓ Branch 0 taken 6894 times.
✓ Branch 1 taken 51141 times.
|
58035 | if(info.isUnwalkable()) |
| 16649 | { | ||
| 16650 | 6894 | shiftdir=-1; | |
| 16651 | 6894 | } | |
| 16652 |
2/2✓ Branch 0 taken 12561 times.
✓ Branch 1 taken 38580 times.
|
51141 | else if(walkable) |
| 16653 | { | ||
| 16654 | 38580 | info = walkflag(x-1,y+16,1,left); | |
| 16655 | 38580 | execute(info); | |
| 16656 | |||
| 16657 |
2/2✓ Branch 0 taken 38500 times.
✓ Branch 1 taken 80 times.
|
38580 | if(info.isUnwalkable()) |
| 16658 | { | ||
| 16659 | 80 | shiftdir=-1; | |
| 16660 | 80 | } | |
| 16661 | 38580 | } | |
| 16662 | 58035 | } | |
| 16663 |
2/2✓ Branch 0 taken 256995 times.
✓ Branch 1 taken 62440 times.
|
319435 | else if(s==right) |
| 16664 | { | ||
| 16665 | 62440 | info = walkflag(x+16,y+(bigHitbox?0:8),1,right)||walkflag(x+16,y+15,1,right); | |
| 16666 | 62440 | execute(info); | |
| 16667 | |||
| 16668 |
2/2✓ Branch 0 taken 10015 times.
✓ Branch 1 taken 52425 times.
|
62440 | if(info.isUnwalkable()) |
| 16669 | { | ||
| 16670 | 10015 | shiftdir=-1; | |
| 16671 | 10015 | } | |
| 16672 |
2/2✓ Branch 0 taken 12539 times.
✓ Branch 1 taken 39886 times.
|
52425 | else if(walkable) |
| 16673 | { | ||
| 16674 | 39886 | info = walkflag(x+16,y+16,1,right); | |
| 16675 | 39886 | execute(info); | |
| 16676 | |||
| 16677 |
2/2✓ Branch 0 taken 39800 times.
✓ Branch 1 taken 86 times.
|
39886 | if(info.isUnwalkable()) |
| 16678 | { | ||
| 16679 | 86 | shiftdir=-1; | |
| 16680 | 86 | } | |
| 16681 | 39886 | } | |
| 16682 | 62440 | } | |
| 16683 | } | ||
| 16684 | |||
| 16685 | 377470 | moveOld2(down); | |
| 16686 | 377470 | shiftdir=s; | |
| 16687 | |||
| 16688 |
2/2✓ Branch 0 taken 304782 times.
✓ Branch 1 taken 72688 times.
|
377470 | if(!walkable) |
| 16689 | { | ||
| 16690 |
2/2✓ Branch 0 taken 31161 times.
✓ Branch 1 taken 41527 times.
|
72688 | if(shiftdir==-1) //Corner-shove; prevent being stuck on corners -V |
| 16691 | { | ||
| 16692 |
4/4✓ Branch 0 taken 17141 times.
✓ Branch 1 taken 24386 times.
✓ Branch 2 taken 1992 times.
✓ Branch 3 taken 39535 times.
|
58668 | if(!_walkflag(x, y+15+1,1,get_standing_z_state())&& |
| 16693 |
2/2✓ Branch 0 taken 5772 times.
✓ Branch 1 taken 11369 times.
|
17141 | !_walkflag(x+8, y+15+1,1,get_standing_z_state())&& |
| 16694 | 11369 | _walkflag(x+15,y+15+1,1,get_standing_z_state())) | |
| 16695 | { | ||
| 16696 |
9/12✓ Branch 0 taken 1867 times.
✓ Branch 1 taken 125 times.
✓ Branch 2 taken 1867 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1867 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1859 times.
✓ Branch 7 taken 8 times.
✓ Branch 8 taken 1859 times.
✓ Branch 9 taken 8 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 1992 times.
|
1992 | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(hero_scr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?15:11),y+15+1)) |
| 16697 | 1992 | sprite::move((zfix)-1,(zfix)0); | |
| 16698 | 1992 | } | |
| 16699 |
4/4✓ Branch 0 taken 24386 times.
✓ Branch 1 taken 15149 times.
✓ Branch 2 taken 1804 times.
✓ Branch 3 taken 37731 times.
|
63921 | else if(_walkflag(x, y+15+1,1,get_standing_z_state())&& |
| 16700 |
2/2✓ Branch 0 taken 22560 times.
✓ Branch 1 taken 1826 times.
|
24386 | !_walkflag(x+7, y+15+1,1,get_standing_z_state())&& |
| 16701 | 1826 | !_walkflag(x+15,y+15+1,1,get_standing_z_state())) | |
| 16702 | { | ||
| 16703 |
9/12✓ Branch 0 taken 1723 times.
✓ Branch 1 taken 81 times.
✓ Branch 2 taken 1723 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1723 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1717 times.
✓ Branch 7 taken 6 times.
✓ Branch 8 taken 1717 times.
✓ Branch 9 taken 6 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 1804 times.
|
1804 | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(hero_scr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?0:4),y+15+1)) |
| 16704 | 1804 | sprite::move((zfix)1,(zfix)0); | |
| 16705 | 1804 | } | |
| 16706 | else //if(shiftdir==-1) | ||
| 16707 | { | ||
| 16708 | 37731 | pushing=push+1; | |
| 16709 | |||
| 16710 |
2/2✓ Branch 0 taken 85 times.
✓ Branch 1 taken 37646 times.
|
37731 | if(action!=swimming) |
| 16711 | { | ||
| 16712 | 37646 | } | |
| 16713 | } | ||
| 16714 | |||
| 16715 | 41527 | z3step=2; | |
| 16716 | 41527 | } | |
| 16717 | else | ||
| 16718 | { | ||
| 16719 | 31161 | pushing=push+1; // L: This makes solid damage combos and diagonal-triggered Armoses work. | |
| 16720 | |||
| 16721 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 31161 times.
|
31161 | if(action!=swimming) |
| 16722 | { | ||
| 16723 | 31161 | } | |
| 16724 | |||
| 16725 | 31161 | z3step=2; | |
| 16726 | } | ||
| 16727 | 72688 | } | |
| 16728 | |||
| 16729 | 377470 | return; | |
| 16730 | } | ||
| 16731 | ✗ | } | |
| 16732 | |||
| 16733 |
6/6✓ Branch 0 taken 600618 times.
✓ Branch 1 taken 1641069 times.
✓ Branch 2 taken 583622 times.
✓ Branch 3 taken 16996 times.
✓ Branch 4 taken 582008 times.
✓ Branch 5 taken 1614 times.
|
2241687 | if (getInput(btnLeft, INPUT_DRUNK | INPUT_HERO_ACTION) && (holddir == -1 || holddir == left)) |
| 16734 | { | ||
| 16735 |
5/8✓ Branch 0 taken 4662 times.
✓ Branch 1 taken 594342 times.
✓ Branch 2 taken 4511 times.
✓ Branch 3 taken 151 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 4662 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
599004 | if(isdungeon() && (y<=26 || y>=world_h-42) && !get_qr(qr_FREEFORM) && !walk_through_walls) |
| 16736 | { | ||
| 16737 | ✗ | } | |
| 16738 | else | ||
| 16739 | { | ||
| 16740 |
3/4✓ Branch 0 taken 592458 times.
✓ Branch 1 taken 6546 times.
✓ Branch 2 taken 592458 times.
✗ Branch 3 not taken.
|
599004 | if(charging==0 && spins==0) |
| 16741 | { | ||
| 16742 | 592458 | dir=left; | |
| 16743 | 592458 | } | |
| 16744 | |||
| 16745 | 599004 | holddir=left; | |
| 16746 | |||
| 16747 |
4/4✓ Branch 0 taken 75929 times.
✓ Branch 1 taken 523075 times.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 75926 times.
|
599004 | if (getInput(btnUp, INPUT_DRUNK | INPUT_HERO_ACTION) && shiftdir != down) |
| 16748 | { | ||
| 16749 | 75926 | shiftdir=up; | |
| 16750 | 75926 | } | |
| 16751 |
4/4✓ Branch 0 taken 61170 times.
✓ Branch 1 taken 461908 times.
✓ Branch 2 taken 12 times.
✓ Branch 3 taken 61158 times.
|
523078 | else if (getInput(btnDown, INPUT_DRUNK | INPUT_HERO_ACTION) && shiftdir != up) |
| 16752 | { | ||
| 16753 | 61158 | shiftdir=down; | |
| 16754 | 61158 | } | |
| 16755 | else | ||
| 16756 | { | ||
| 16757 | 461920 | shiftdir=-1; | |
| 16758 | } | ||
| 16759 | |||
| 16760 | //bool walkable; | ||
| 16761 | 599004 | info = walkflag(x-z3step,y+(bigHitbox?0:8),1,left)||walkflag(x-z3step,y+8,1,left); | |
| 16762 | |||
| 16763 |
2/2✓ Branch 0 taken 254314 times.
✓ Branch 1 taken 344690 times.
|
599004 | if(y.getInt()&7) |
| 16764 | 344690 | info = info || walkflag(x-z3step,y+16,1,left); | |
| 16765 | |||
| 16766 | 599004 | execute(info); | |
| 16767 | |||
| 16768 |
2/2✓ Branch 0 taken 73587 times.
✓ Branch 1 taken 525417 times.
|
599004 | if(info.isUnwalkable()) |
| 16769 | { | ||
| 16770 |
2/2✓ Branch 0 taken 72185 times.
✓ Branch 1 taken 1402 times.
|
73587 | if(z3step==2) |
| 16771 | { | ||
| 16772 | 72185 | z3step=1; | |
| 16773 | 72185 | info = walkflag(x-z3step,y+(bigHitbox?0:8),1,left)||walkflag(x-z3step,y+8,1,left); | |
| 16774 | |||
| 16775 |
2/2✓ Branch 0 taken 44557 times.
✓ Branch 1 taken 27628 times.
|
72185 | if(y.getInt()&7) |
| 16776 | 44557 | info = info || walkflag(x-z3step,y+16,1,left); | |
| 16777 | |||
| 16778 | 72185 | execute(info); | |
| 16779 | |||
| 16780 |
2/2✓ Branch 0 taken 67321 times.
✓ Branch 1 taken 4864 times.
|
72185 | if(info.isUnwalkable()) |
| 16781 | { | ||
| 16782 | 67321 | walkable = false; | |
| 16783 | 67321 | } | |
| 16784 | else | ||
| 16785 | { | ||
| 16786 | 4864 | walkable=true; | |
| 16787 | } | ||
| 16788 | 72185 | } | |
| 16789 | else | ||
| 16790 | { | ||
| 16791 | 1402 | walkable=false; | |
| 16792 | } | ||
| 16793 | 73587 | } | |
| 16794 | else | ||
| 16795 | { | ||
| 16796 | 525417 | walkable = true; | |
| 16797 | } | ||
| 16798 | |||
| 16799 | 599004 | int32_t s=shiftdir; | |
| 16800 | |||
| 16801 |
10/14✓ Branch 0 taken 4662 times.
✓ Branch 1 taken 594342 times.
✓ Branch 2 taken 4595 times.
✓ Branch 3 taken 67 times.
✓ Branch 4 taken 4662 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 69998 times.
✓ Branch 7 taken 529006 times.
✓ Branch 8 taken 69998 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 69998 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 69998 times.
✗ Branch 13 not taken.
|
599004 | if((isdungeon() && (x<=26 || x>=world_w - 42) && !get_qr(qr_FREEFORM)) || (isSideViewHero() && !getOnSideviewLadder() && action != sideswimming && action != sideswimhit && action != sideswimattacking)) |
| 16802 | { | ||
| 16803 | 69998 | shiftdir=-1; | |
| 16804 | 69998 | } | |
| 16805 | else | ||
| 16806 | { | ||
| 16807 |
2/2✓ Branch 0 taken 454669 times.
✓ Branch 1 taken 74337 times.
|
529006 | if(s==up) |
| 16808 | { | ||
| 16809 | 74337 | info = walkflag(x,y+(bigHitbox?0:8)-1,2,up)||walkflag(x+15,y+(bigHitbox?0:8)-1,1,up); | |
| 16810 | 74337 | execute(info); | |
| 16811 | |||
| 16812 |
2/2✓ Branch 0 taken 8595 times.
✓ Branch 1 taken 65742 times.
|
74337 | if(info.isUnwalkable()) |
| 16813 | { | ||
| 16814 | 8595 | shiftdir=-1; | |
| 16815 | 8595 | } | |
| 16816 |
2/2✓ Branch 0 taken 9983 times.
✓ Branch 1 taken 55759 times.
|
65742 | else if(walkable) |
| 16817 | { | ||
| 16818 | 55759 | info = walkflag(x-1,y+(bigHitbox?0:8)-1,1,up); | |
| 16819 | 55759 | execute(info); | |
| 16820 | |||
| 16821 |
2/2✓ Branch 0 taken 55678 times.
✓ Branch 1 taken 81 times.
|
55759 | if(info.isUnwalkable()) |
| 16822 | { | ||
| 16823 | 81 | shiftdir=-1; | |
| 16824 | 81 | } | |
| 16825 | 55759 | } | |
| 16826 | 74337 | } | |
| 16827 |
2/2✓ Branch 0 taken 394275 times.
✓ Branch 1 taken 60394 times.
|
454669 | else if(s==down) |
| 16828 | { | ||
| 16829 | 60394 | info = walkflag(x,y+16,2,down)||walkflag(x+15,y+16,1,down); | |
| 16830 | 60394 | execute(info); | |
| 16831 | |||
| 16832 |
2/2✓ Branch 0 taken 9555 times.
✓ Branch 1 taken 50839 times.
|
60394 | if(info.isUnwalkable()) |
| 16833 | { | ||
| 16834 | 9555 | shiftdir=-1; | |
| 16835 | 9555 | } | |
| 16836 |
2/2✓ Branch 0 taken 7945 times.
✓ Branch 1 taken 42894 times.
|
50839 | else if(walkable) |
| 16837 | { | ||
| 16838 | 42894 | info = walkflag(x-1,y+16,1,down); | |
| 16839 | 42894 | execute(info); | |
| 16840 | |||
| 16841 |
2/2✓ Branch 0 taken 42823 times.
✓ Branch 1 taken 71 times.
|
42894 | if(info.isUnwalkable()) |
| 16842 | { | ||
| 16843 | 71 | shiftdir=-1; | |
| 16844 | 71 | } | |
| 16845 | 42894 | } | |
| 16846 | 60394 | } | |
| 16847 | } | ||
| 16848 | |||
| 16849 | 599004 | moveOld2(left); | |
| 16850 | 599004 | shiftdir=s; | |
| 16851 | |||
| 16852 |
2/2✓ Branch 0 taken 530281 times.
✓ Branch 1 taken 68723 times.
|
599004 | if(!walkable) |
| 16853 | { | ||
| 16854 |
2/2✓ Branch 0 taken 22576 times.
✓ Branch 1 taken 46147 times.
|
68723 | if(shiftdir==-1) //Corner-shove; prevent being stuck on corners -V |
| 16855 | { | ||
| 16856 | 46147 | int32_t v1=bigHitbox?0:8; | |
| 16857 | 46147 | int32_t v2=bigHitbox?8:12; | |
| 16858 | |||
| 16859 |
4/4✓ Branch 0 taken 8104 times.
✓ Branch 1 taken 38043 times.
✓ Branch 2 taken 1551 times.
✓ Branch 3 taken 44596 times.
|
54251 | if(!_walkflag(x-1,y+v1,1,get_standing_z_state())&& |
| 16860 |
2/2✓ Branch 0 taken 4024 times.
✓ Branch 1 taken 4080 times.
|
8104 | !_walkflag(x-1,y+v2,1,get_standing_z_state())&& |
| 16861 | 4080 | _walkflag(x-1,y+15,1,get_standing_z_state())) | |
| 16862 | { | ||
| 16863 |
9/12✓ Branch 0 taken 1422 times.
✓ Branch 1 taken 129 times.
✓ Branch 2 taken 1422 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1422 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1418 times.
✓ Branch 7 taken 4 times.
✓ Branch 8 taken 1418 times.
✓ Branch 9 taken 4 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 1551 times.
|
1551 | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(hero_scr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x-1,y+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?15:11))) |
| 16864 | 1551 | sprite::move((zfix)0,(zfix)-1); | |
| 16865 | 1551 | } | |
| 16866 |
4/4✓ Branch 0 taken 38043 times.
✓ Branch 1 taken 6553 times.
✓ Branch 2 taken 802 times.
✓ Branch 3 taken 43794 times.
|
82639 | else if(_walkflag(x-1,y+v1, 1,get_standing_z_state())&& |
| 16867 |
2/2✓ Branch 0 taken 37241 times.
✓ Branch 1 taken 802 times.
|
38043 | !_walkflag(x-1,y+v2-1,1,get_standing_z_state())&& |
| 16868 | 802 | !_walkflag(x-1,y+15, 1,get_standing_z_state())) | |
| 16869 | { | ||
| 16870 |
8/12✓ Branch 0 taken 750 times.
✓ Branch 1 taken 52 times.
✓ Branch 2 taken 750 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 750 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 750 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 750 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 1 times.
✓ Branch 11 taken 801 times.
|
802 | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(hero_scr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x-1,y+v1+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?0:4))) |
| 16871 | 801 | sprite::move((zfix)0,(zfix)1); | |
| 16872 | 802 | } | |
| 16873 | else //if(shiftdir==-1) | ||
| 16874 | { | ||
| 16875 | 43794 | pushing=push+1; | |
| 16876 | |||
| 16877 |
2/2✓ Branch 0 taken 205 times.
✓ Branch 1 taken 43589 times.
|
43794 | if(action!=swimming) |
| 16878 | { | ||
| 16879 | 43589 | } | |
| 16880 | } | ||
| 16881 | |||
| 16882 | 46147 | z3step=2; | |
| 16883 | 46147 | } | |
| 16884 | else | ||
| 16885 | { | ||
| 16886 | 22576 | pushing=push+1; // L: This makes solid damage combos and diagonal-triggered Armoses work. | |
| 16887 | |||
| 16888 |
2/2✓ Branch 0 taken 43 times.
✓ Branch 1 taken 22533 times.
|
22576 | if(action!=swimming) |
| 16889 | { | ||
| 16890 | 22533 | } | |
| 16891 | |||
| 16892 | 22576 | z3step=2; | |
| 16893 | } | ||
| 16894 | 68723 | } | |
| 16895 | |||
| 16896 | 599004 | return; | |
| 16897 | } | ||
| 16898 | ✗ | } | |
| 16899 | |||
| 16900 |
5/6✓ Branch 0 taken 663276 times.
✓ Branch 1 taken 979407 times.
✓ Branch 2 taken 645546 times.
✓ Branch 3 taken 17730 times.
✓ Branch 4 taken 645546 times.
✗ Branch 5 not taken.
|
1642683 | if (getInput(btnRight, INPUT_DRUNK | INPUT_HERO_ACTION) && (holddir == -1 || holddir == right)) |
| 16901 | { | ||
| 16902 |
5/8✓ Branch 0 taken 4663 times.
✓ Branch 1 taken 658613 times.
✓ Branch 2 taken 4484 times.
✓ Branch 3 taken 179 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 4663 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
663276 | if(isdungeon() && (y<=26 || y>=world_h-42) && !get_qr(qr_FREEFORM) && !walk_through_walls) |
| 16903 | { | ||
| 16904 | ✗ | } | |
| 16905 | else | ||
| 16906 | { | ||
| 16907 |
3/4✓ Branch 0 taken 655145 times.
✓ Branch 1 taken 8131 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 655145 times.
|
663276 | if(charging==0 && spins==0) |
| 16908 | { | ||
| 16909 | 655145 | dir=right; | |
| 16910 | 655145 | } | |
| 16911 | |||
| 16912 | 663276 | holddir=right; | |
| 16913 | |||
| 16914 |
4/4✓ Branch 0 taken 82864 times.
✓ Branch 1 taken 580412 times.
✓ Branch 2 taken 31 times.
✓ Branch 3 taken 82833 times.
|
663276 | if (getInput(btnUp, INPUT_DRUNK | INPUT_HERO_ACTION) && shiftdir != down) |
| 16915 | { | ||
| 16916 | 82833 | shiftdir=up; | |
| 16917 | 82833 | } | |
| 16918 |
4/4✓ Branch 0 taken 66527 times.
✓ Branch 1 taken 513916 times.
✓ Branch 2 taken 13 times.
✓ Branch 3 taken 66514 times.
|
580443 | else if (getInput(btnDown, INPUT_DRUNK | INPUT_HERO_ACTION) && shiftdir != up) |
| 16919 | { | ||
| 16920 | 66514 | shiftdir=down; | |
| 16921 | 66514 | } | |
| 16922 | else | ||
| 16923 | { | ||
| 16924 | 513929 | shiftdir=-1; | |
| 16925 | } | ||
| 16926 | |||
| 16927 | //bool walkable; | ||
| 16928 | 663276 | info = walkflag(x+15+z3step,y+(bigHitbox?0:8),1,right)||walkflag(x+15+z3step,y+8,1,right); | |
| 16929 | |||
| 16930 |
2/2✓ Branch 0 taken 374316 times.
✓ Branch 1 taken 288960 times.
|
663276 | if(y.getInt()&7) |
| 16931 | 374316 | info = info || walkflag(x+15+z3step,y+16,1,right); | |
| 16932 | |||
| 16933 | 663276 | execute(info); | |
| 16934 | |||
| 16935 |
2/2✓ Branch 0 taken 90569 times.
✓ Branch 1 taken 572707 times.
|
663276 | if(info.isUnwalkable()) |
| 16936 | { | ||
| 16937 |
2/2✓ Branch 0 taken 89087 times.
✓ Branch 1 taken 1482 times.
|
90569 | if(z3step==2) |
| 16938 | { | ||
| 16939 | 89087 | z3step=1; | |
| 16940 | 89087 | info = walkflag(x+15+z3step,y+(bigHitbox?0:8),1,right)||walkflag(x+15+z3step,y+8,1,right); | |
| 16941 | |||
| 16942 |
2/2✓ Branch 0 taken 33839 times.
✓ Branch 1 taken 55248 times.
|
89087 | if(y.getInt()&7) |
| 16943 | 55248 | info = info || walkflag(x+15+z3step,y+16,1,right); | |
| 16944 | |||
| 16945 | 89087 | execute(info); | |
| 16946 | |||
| 16947 |
2/2✓ Branch 0 taken 81577 times.
✓ Branch 1 taken 7510 times.
|
89087 | if(info.isUnwalkable()) |
| 16948 | { | ||
| 16949 | 81577 | walkable = false; | |
| 16950 | 81577 | } | |
| 16951 | else | ||
| 16952 | { | ||
| 16953 | 7510 | walkable=true; | |
| 16954 | } | ||
| 16955 | 89087 | } | |
| 16956 | else | ||
| 16957 | { | ||
| 16958 | 1482 | walkable=false; | |
| 16959 | } | ||
| 16960 | 90569 | } | |
| 16961 | else | ||
| 16962 | { | ||
| 16963 | 572707 | walkable = true; | |
| 16964 | } | ||
| 16965 | |||
| 16966 | 663276 | int32_t s=shiftdir; | |
| 16967 | |||
| 16968 |
10/14✓ Branch 0 taken 4663 times.
✓ Branch 1 taken 658613 times.
✓ Branch 2 taken 4647 times.
✓ Branch 3 taken 16 times.
✓ Branch 4 taken 4663 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 85857 times.
✓ Branch 7 taken 577419 times.
✓ Branch 8 taken 85857 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 85857 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 85857 times.
✗ Branch 13 not taken.
|
663276 | if((isdungeon() && (x<=26 || x>=world_w - 42) && !get_qr(qr_FREEFORM)) || (isSideViewHero() && !getOnSideviewLadder() && action != sideswimming && action != sideswimhit && action != sideswimattacking)) |
| 16969 | { | ||
| 16970 | 85857 | shiftdir=-1; | |
| 16971 | 85857 | } | |
| 16972 | else | ||
| 16973 | { | ||
| 16974 |
2/2✓ Branch 0 taken 497041 times.
✓ Branch 1 taken 80378 times.
|
577419 | if(s==up) |
| 16975 | { | ||
| 16976 | 80378 | info = walkflag(x,y+(bigHitbox?0:8)-1,2,up)||walkflag(x+15,y+(bigHitbox?0:8)-1,1,up); | |
| 16977 | 80378 | execute(info); | |
| 16978 | |||
| 16979 |
2/2✓ Branch 0 taken 10531 times.
✓ Branch 1 taken 69847 times.
|
80378 | if(info.isUnwalkable()) |
| 16980 | { | ||
| 16981 | 10531 | shiftdir=-1; | |
| 16982 | 10531 | } | |
| 16983 |
2/2✓ Branch 0 taken 11752 times.
✓ Branch 1 taken 58095 times.
|
69847 | else if(walkable) |
| 16984 | { | ||
| 16985 | 58095 | info = walkflag(x+16,y+(bigHitbox?0:8)-1,1,up); | |
| 16986 | 58095 | execute(info); | |
| 16987 | |||
| 16988 |
2/2✓ Branch 0 taken 58004 times.
✓ Branch 1 taken 91 times.
|
58095 | if(info.isUnwalkable()) |
| 16989 | { | ||
| 16990 | 91 | shiftdir=-1; | |
| 16991 | 91 | } | |
| 16992 | 58095 | } | |
| 16993 | 80378 | } | |
| 16994 |
2/2✓ Branch 0 taken 431114 times.
✓ Branch 1 taken 65927 times.
|
497041 | else if(s==down) |
| 16995 | { | ||
| 16996 | 65927 | info = walkflag(x,y+16,2,down)||walkflag(x+15,y+16,1,down); | |
| 16997 | 65927 | execute(info); | |
| 16998 | |||
| 16999 |
2/2✓ Branch 0 taken 11453 times.
✓ Branch 1 taken 54474 times.
|
65927 | if(info.isUnwalkable()) |
| 17000 | { | ||
| 17001 | 11453 | shiftdir=-1; | |
| 17002 | 11453 | } | |
| 17003 |
2/2✓ Branch 0 taken 9326 times.
✓ Branch 1 taken 45148 times.
|
54474 | else if(walkable) |
| 17004 | { | ||
| 17005 | 45148 | info = walkflag(x+16,y+16,1,down); | |
| 17006 | 45148 | execute(info); | |
| 17007 | |||
| 17008 |
2/2✓ Branch 0 taken 45066 times.
✓ Branch 1 taken 82 times.
|
45148 | if(info.isUnwalkable()) |
| 17009 | { | ||
| 17010 | 82 | shiftdir=-1; | |
| 17011 | 82 | } | |
| 17012 | 45148 | } | |
| 17013 | 65927 | } | |
| 17014 | } | ||
| 17015 | |||
| 17016 | 663276 | moveOld2(right); | |
| 17017 | 663276 | shiftdir=s; | |
| 17018 | |||
| 17019 |
2/2✓ Branch 0 taken 580217 times.
✓ Branch 1 taken 83059 times.
|
663276 | if(!walkable) |
| 17020 | { | ||
| 17021 |
2/2✓ Branch 0 taken 27386 times.
✓ Branch 1 taken 55673 times.
|
83059 | if(shiftdir==-1) //Corner-shove; prevent being stuck on corners -V |
| 17022 | { | ||
| 17023 | 55673 | int32_t v1=bigHitbox?0:8; | |
| 17024 | 55673 | int32_t v2=bigHitbox?8:12; | |
| 17025 | |||
| 17026 | 167019 | info = !walkflag(x+16,y+v1,1,right)&& | |
| 17027 | 111346 | !walkflag(x+16,y+v2,1,right)&& | |
| 17028 | 55673 | walkflag(x+16,y+15,1,right); | |
| 17029 | |||
| 17030 | //do NOT execute these | ||
| 17031 |
2/2✓ Branch 0 taken 1827 times.
✓ Branch 1 taken 53846 times.
|
55673 | if(info.isUnwalkable()) |
| 17032 | { | ||
| 17033 |
10/12✓ Branch 0 taken 1722 times.
✓ Branch 1 taken 105 times.
✓ Branch 2 taken 1722 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1722 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1721 times.
✓ Branch 7 taken 1 times.
✓ Branch 8 taken 1721 times.
✓ Branch 9 taken 1 times.
✓ Branch 10 taken 1 times.
✓ Branch 11 taken 1826 times.
|
1827 | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(hero_scr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x+16,y+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?15:11))) |
| 17034 | 1826 | sprite::move((zfix)0,(zfix)-1); | |
| 17035 | 1827 | } | |
| 17036 | else | ||
| 17037 | { | ||
| 17038 | 161538 | info = walkflag(x+16,y+v1, 1,right)&& | |
| 17039 | 107692 | !walkflag(x+16,y+v2-1,1,right)&& | |
| 17040 | 53846 | !walkflag(x+16,y+15, 1,right); | |
| 17041 | |||
| 17042 |
2/2✓ Branch 0 taken 939 times.
✓ Branch 1 taken 52907 times.
|
53846 | if(info.isUnwalkable()) |
| 17043 | { | ||
| 17044 |
7/12✓ Branch 0 taken 896 times.
✓ Branch 1 taken 43 times.
✓ Branch 2 taken 896 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 896 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 896 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 896 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 939 times.
|
939 | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(hero_scr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x+16,y+v1+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?0:4))) |
| 17045 | 939 | sprite::move((zfix)0,(zfix)1); | |
| 17046 | 939 | } | |
| 17047 | else //if(shiftdir==-1) | ||
| 17048 | { | ||
| 17049 | 52907 | pushing=push+1; | |
| 17050 | 52907 | z3step=2; | |
| 17051 | |||
| 17052 |
2/2✓ Branch 0 taken 66 times.
✓ Branch 1 taken 52841 times.
|
52907 | if(action!=swimming) |
| 17053 | { | ||
| 17054 | 52841 | } | |
| 17055 | } | ||
| 17056 | } | ||
| 17057 | |||
| 17058 | 55673 | z3step=2; | |
| 17059 | 55673 | } | |
| 17060 | else | ||
| 17061 | { | ||
| 17062 | 27386 | pushing=push+1; // L: This makes solid damage combos and diagonal-triggered Armoses work. | |
| 17063 | |||
| 17064 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 27376 times.
|
27386 | if(action!=swimming) |
| 17065 | { | ||
| 17066 | 27376 | } | |
| 17067 | |||
| 17068 | 27386 | z3step=2; | |
| 17069 | } | ||
| 17070 | 83059 | } | |
| 17071 | |||
| 17072 | 663276 | return; | |
| 17073 | } | ||
| 17074 | ✗ | } | |
| 17075 | } | ||
| 17076 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1174121 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1174121 | if(shield_forcedir > -1 && action != rafting) |
| 17077 | ✗ | dir = shield_forcedir; | |
| 17078 | 1174121 | int32_t wtry = iswaterex_z3(MAPCOMBO(x,y+15), -1, x,y+15, true, false); | |
| 17079 | 1174121 | int32_t wtry8 = iswaterex_z3(MAPCOMBO(x+15,y+15), -1, x+15,y+15, true, false); | |
| 17080 | 1174121 | int32_t wtrx = iswaterex_z3(MAPCOMBO(x,y+(bigHitbox?0:8)), -1, x,y+(bigHitbox?0:8), true, false); | |
| 17081 | 1174121 | int32_t wtrx8 = iswaterex_z3(MAPCOMBO(x+15,y+(bigHitbox?0:8)), -1, x+15,y+(bigHitbox?0:8), true, false); | |
| 17082 | 1174121 | int32_t wtrc = iswaterex_z3(MAPCOMBO(x+8,y+(bigHitbox?8:12)), -1, x+8,y+(bigHitbox?8:12), true, false); | |
| 17083 | |||
| 17084 |
8/12✓ Branch 0 taken 169103 times.
✓ Branch 1 taken 1005018 times.
✓ Branch 2 taken 169103 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 169103 times.
✓ Branch 6 taken 169103 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 166294 times.
✓ Branch 9 taken 2809 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 166294 times.
|
1174121 | if(can_use_item(itype_flippers,i_flippers)&¤t_item(itype_flippers) >= combobuf[wtrc].attribytes[0]&&(!(combobuf[wtrc].usrflags&cflag1) || (itemsbuf[current_item_id(itype_flippers)].flags & item_flag3))&&!(ladderx+laddery)&&z==0&&fakez==0) |
| 17085 | { | ||
| 17086 |
8/12✓ Branch 0 taken 571 times.
✓ Branch 1 taken 165723 times.
✓ Branch 2 taken 526 times.
✓ Branch 3 taken 45 times.
✓ Branch 4 taken 479 times.
✓ Branch 5 taken 47 times.
✓ Branch 6 taken 479 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 479 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
166294 | if(wtrx&&wtrx8&&wtry&&wtry8 && !DRIEDLAKE) |
| 17087 | { | ||
| 17088 | //action=swimming; | ||
| 17089 |
3/12✓ Branch 0 taken 360 times.
✓ Branch 1 taken 119 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 360 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
479 | if(action !=none && action != swimming && action != sideswimming && action != sideswimhit && action != sideswimattacking && !isSideViewHero()) |
| 17090 | { | ||
| 17091 | ✗ | hopclk = 0xFF; | |
| 17092 | ✗ | } | |
| 17093 | 479 | } | |
| 17094 | 166294 | } | |
| 17095 | |||
| 17096 | 1174121 | return; | |
| 17097 | } //endif (LTTPWALK) | ||
| 17098 | 3779088 | temp_step = hero_newstep; | |
| 17099 | 3779088 | temp_x = x; | |
| 17100 | 3779088 | temp_y = y; | |
| 17101 | |||
| 17102 |
7/8✓ Branch 0 taken 2471883 times.
✓ Branch 1 taken 1307205 times.
✓ Branch 2 taken 2420353 times.
✓ Branch 3 taken 51530 times.
✓ Branch 4 taken 59406 times.
✓ Branch 5 taken 2412477 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 59406 times.
|
3779088 | if(isdungeon() && (x<=26 || x>=world_w - 42) && !get_qr(qr_FREEFORM) && !walk_through_walls) |
| 17103 | { | ||
| 17104 |
2/4✓ Branch 0 taken 59406 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 59406 times.
|
59406 | if(get_qr(qr_NEW_HERO_MOVEMENT) || IsSideSwim()) |
| 17105 | ✗ | goto LEFTRIGHT_NEWMOVE; | |
| 17106 | 59406 | else goto LEFTRIGHT_OLDMOVE; | |
| 17107 | } | ||
| 17108 | |||
| 17109 | // make it easier to get in left & right doors | ||
| 17110 | |||
| 17111 | //ignore ladder for this part. sigh sigh sigh -DD | ||
| 17112 | 3719682 | oldladderx = ladderx; | |
| 17113 | 3719682 | oldladdery = laddery; | |
| 17114 |
2/4✓ Branch 0 taken 3719682 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 3719682 times.
|
3719682 | if(get_qr(qr_NEW_HERO_MOVEMENT) || IsSideSwim()) |
| 17115 | { | ||
| 17116 | ✗ | if (isdungeon() && getInput(btnLeft, INPUT_DRUNK | INPUT_HERO_ACTION) && (temp_x == 32 && temp_y == 80)) | |
| 17117 | { | ||
| 17118 | ✗ | do | |
| 17119 | { | ||
| 17120 | ✗ | info = walkflag(temp_x,temp_y+(bigHitbox?0:8),1,left) || | |
| 17121 | ✗ | walkflag(temp_x-temp_step,temp_y+(bigHitbox?0:8),1,left); | |
| 17122 | |||
| 17123 | ✗ | if(info.isUnwalkable()) | |
| 17124 | { | ||
| 17125 | ✗ | if(temp_x != int32_t(temp_x)) | |
| 17126 | { | ||
| 17127 | ✗ | temp_x = floor((double)temp_x); | |
| 17128 | ✗ | } | |
| 17129 | ✗ | else if(temp_step > 1) | |
| 17130 | { | ||
| 17131 | ✗ | if(temp_step != int32_t(temp_step)) //floor | |
| 17132 | ✗ | temp_step = floor((double)temp_step); | |
| 17133 | ✗ | else --temp_step; | |
| 17134 | ✗ | } | |
| 17135 | else | ||
| 17136 | ✗ | break; | |
| 17137 | ✗ | } | |
| 17138 | ✗ | } | |
| 17139 | ✗ | while(info.isUnwalkable()); | |
| 17140 | |||
| 17141 | ✗ | if(!info.isUnwalkable()) | |
| 17142 | { | ||
| 17143 | ✗ | x = temp_x; | |
| 17144 | ✗ | y = temp_y; | |
| 17145 | ✗ | hero_newstep = temp_step; | |
| 17146 | //ONLY process the side-effects of the above walkflag if Hero will actually move | ||
| 17147 | //sigh sigh sigh... walkflag is a horrible mess :-/ -DD | ||
| 17148 | ✗ | execute(info); | |
| 17149 | ✗ | moveOld2(left); | |
| 17150 | ✗ | return; | |
| 17151 | } | ||
| 17152 | ✗ | temp_x = x; | |
| 17153 | ✗ | temp_y = y; | |
| 17154 | ✗ | temp_step = hero_newstep; | |
| 17155 | ✗ | } | |
| 17156 | |||
| 17157 | ✗ | if (isdungeon() && getInput(btnRight, INPUT_DRUNK | INPUT_HERO_ACTION) && temp_x == 208 && temp_y == 80) | |
| 17158 | { | ||
| 17159 | ✗ | do | |
| 17160 | { | ||
| 17161 | ✗ | info = walkflag(temp_x+15+temp_step,temp_y+(bigHitbox?0:8),1,right) || | |
| 17162 | ✗ | walkflag(temp_x+15+temp_step,temp_y+8,1,right); | |
| 17163 | |||
| 17164 | ✗ | if(info.isUnwalkable()) | |
| 17165 | { | ||
| 17166 | ✗ | if(temp_x != int32_t(temp_x)) | |
| 17167 | { | ||
| 17168 | ✗ | temp_x = floor((double)temp_x); | |
| 17169 | ✗ | } | |
| 17170 | ✗ | else if(temp_step > 1) | |
| 17171 | { | ||
| 17172 | ✗ | if(temp_step != int32_t(temp_step)) //floor | |
| 17173 | ✗ | temp_step = floor((double)temp_step); | |
| 17174 | ✗ | else --temp_step; | |
| 17175 | ✗ | } | |
| 17176 | else | ||
| 17177 | ✗ | break; | |
| 17178 | ✗ | } | |
| 17179 | ✗ | } | |
| 17180 | ✗ | while(info.isUnwalkable()); | |
| 17181 | |||
| 17182 | ✗ | if(!info.isUnwalkable()) | |
| 17183 | { | ||
| 17184 | ✗ | x = temp_x; | |
| 17185 | ✗ | y = temp_y; | |
| 17186 | ✗ | hero_newstep = temp_step; | |
| 17187 | ✗ | execute(info); | |
| 17188 | ✗ | moveOld2(right); | |
| 17189 | ✗ | return; | |
| 17190 | } | ||
| 17191 | ✗ | temp_x = x; | |
| 17192 | ✗ | temp_y = y; | |
| 17193 | ✗ | temp_step = hero_newstep; | |
| 17194 | ✗ | } | |
| 17195 | |||
| 17196 | ✗ | ladderx = oldladderx; | |
| 17197 | ✗ | laddery = oldladdery; | |
| 17198 | |||
| 17199 | ✗ | if (getInput(btnUp, INPUT_DRUNK | INPUT_HERO_ACTION)) | |
| 17200 | { | ||
| 17201 | ✗ | if(xoff && !is_on_conveyor && action != swimming && action != sideswimming && action != sideswimhit && action != sideswimattacking && jumping<1) | |
| 17202 | { | ||
| 17203 | ✗ | if(dir!=up && dir!=down) | |
| 17204 | { | ||
| 17205 | ✗ | if(xoff>2&&xoff<6) | |
| 17206 | { | ||
| 17207 | ✗ | moveOld2(dir); | |
| 17208 | ✗ | } | |
| 17209 | ✗ | else if(xoff>=6) | |
| 17210 | { | ||
| 17211 | ✗ | moveOld2(right); | |
| 17212 | ✗ | } | |
| 17213 | ✗ | else if(xoff>=1) | |
| 17214 | { | ||
| 17215 | ✗ | moveOld2(left); | |
| 17216 | ✗ | } | |
| 17217 | ✗ | } | |
| 17218 | else | ||
| 17219 | { | ||
| 17220 | ✗ | if(xoff>=4) | |
| 17221 | { | ||
| 17222 | ✗ | moveOld2(right); | |
| 17223 | ✗ | } | |
| 17224 | ✗ | else if(xoff<4) | |
| 17225 | { | ||
| 17226 | ✗ | moveOld2(left); | |
| 17227 | ✗ | } | |
| 17228 | } | ||
| 17229 | ✗ | } | |
| 17230 | else | ||
| 17231 | { | ||
| 17232 | ✗ | do | |
| 17233 | { | ||
| 17234 | ✗ | if(action==swimming || IsSideSwim() || action == swimhit) | |
| 17235 | { | ||
| 17236 | ✗ | info = walkflag(temp_x,temp_y+(bigHitbox?0:8)-temp_step,2,up); | |
| 17237 | |||
| 17238 | ✗ | if(_walkflag(temp_x+15, temp_y+(bigHitbox?0:8)-temp_step, 1,get_standing_z_state()) && | |
| 17239 | ✗ | !(iswaterex_z3(MAPCOMBO(temp_x, temp_y+(bigHitbox?0:8)-temp_step), -1, temp_x, temp_y+(bigHitbox?0:8)-temp_step, true, false) && | |
| 17240 | ✗ | iswaterex_z3(MAPCOMBO(temp_x+15, temp_y+(bigHitbox?0:8)-temp_step), -1, temp_x+15, temp_y+(bigHitbox?0:8)-temp_step, true, false))) | |
| 17241 | ✗ | info.setUnwalkable(true); | |
| 17242 | ✗ | } | |
| 17243 | else | ||
| 17244 | { | ||
| 17245 | ✗ | info = walkflag(temp_x,temp_y+(bigHitbox?0:8)-temp_step,2,up); | |
| 17246 | ✗ | if(x.getInt() & 7) | |
| 17247 | ✗ | info = info || walkflag(temp_x+16,temp_y+(bigHitbox?0:8)-temp_step,1,up); | |
| 17248 | else | ||
| 17249 | ✗ | info = info || walkflagMBlock(temp_x+8,temp_y+(bigHitbox?0:8)-temp_step); | |
| 17250 | } | ||
| 17251 | |||
| 17252 | ✗ | if(info.isUnwalkable()) | |
| 17253 | { | ||
| 17254 | ✗ | if(temp_y != int32_t(temp_y)) | |
| 17255 | { | ||
| 17256 | ✗ | temp_y = floor((double)temp_y); | |
| 17257 | ✗ | } | |
| 17258 | ✗ | else if(temp_step > 1) | |
| 17259 | { | ||
| 17260 | ✗ | if(temp_step != int32_t(temp_step)) //floor | |
| 17261 | ✗ | temp_step = floor((double)temp_step); | |
| 17262 | ✗ | else --temp_step; | |
| 17263 | ✗ | } | |
| 17264 | else | ||
| 17265 | ✗ | break; | |
| 17266 | ✗ | } | |
| 17267 | ✗ | } | |
| 17268 | ✗ | while(info.isUnwalkable()); | |
| 17269 | |||
| 17270 | ✗ | execute(info); | |
| 17271 | |||
| 17272 | ✗ | if(!info.isUnwalkable()) | |
| 17273 | { | ||
| 17274 | ✗ | x = temp_x; | |
| 17275 | ✗ | y = temp_y; | |
| 17276 | ✗ | hero_newstep = temp_step; | |
| 17277 | ✗ | moveOld2(up); | |
| 17278 | ✗ | return; | |
| 17279 | } | ||
| 17280 | |||
| 17281 | ✗ | if (!getInput(btnLeft, INPUT_DRUNK | INPUT_HERO_ACTION) && !getInput(btnRight, INPUT_DRUNK | INPUT_HERO_ACTION)) | |
| 17282 | { | ||
| 17283 | ✗ | if(NO_GRIDLOCK) | |
| 17284 | { | ||
| 17285 | ✗ | x = x.getInt(); | |
| 17286 | ✗ | y = y.getInt(); | |
| 17287 | ✗ | if(!_walkflag(x,y+(bigHitbox?0:8)-1,1,get_standing_z_state()) && | |
| 17288 | ✗ | !_walkflag(x+8, y+(bigHitbox?0:8)-1,1,get_standing_z_state()) && | |
| 17289 | ✗ | _walkflag(x+15,y+(bigHitbox?0:8)-1,1,get_standing_z_state())) | |
| 17290 | { | ||
| 17291 | ✗ | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(hero_scr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?15:11),y+(bigHitbox?0:8)-1)) | |
| 17292 | ✗ | sprite::move((zfix)-1,(zfix)0); | |
| 17293 | ✗ | } | |
| 17294 | ✗ | else if(_walkflag(x,y+(bigHitbox?0:8)-1,1,get_standing_z_state()) && | |
| 17295 | ✗ | !_walkflag(x+7, y+(bigHitbox?0:8)-1,1,get_standing_z_state()) && | |
| 17296 | ✗ | !_walkflag(x+15,y+(bigHitbox?0:8)-1,1,get_standing_z_state())) | |
| 17297 | { | ||
| 17298 | ✗ | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(hero_scr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?0:4),y+(bigHitbox?0:8)-1)) | |
| 17299 | ✗ | sprite::move((zfix)1,(zfix)0); | |
| 17300 | ✗ | } | |
| 17301 | else | ||
| 17302 | { | ||
| 17303 | ✗ | pushing=push+1; | |
| 17304 | } | ||
| 17305 | ✗ | } | |
| 17306 | ✗ | else pushing=push+1; | |
| 17307 | |||
| 17308 | ✗ | if(charging==0 && spins==0) | |
| 17309 | { | ||
| 17310 | ✗ | dir=up; | |
| 17311 | ✗ | } | |
| 17312 | |||
| 17313 | ✗ | if(action!=swimming && action != sideswimming && action != sideswimhit && action != sideswimattacking) | |
| 17314 | { | ||
| 17315 | ✗ | herostep(); | |
| 17316 | ✗ | } | |
| 17317 | |||
| 17318 | ✗ | return; | |
| 17319 | } | ||
| 17320 | else | ||
| 17321 | { | ||
| 17322 | ✗ | goto LEFTRIGHT_NEWMOVE; | |
| 17323 | } | ||
| 17324 | } | ||
| 17325 | |||
| 17326 | ✗ | return; | |
| 17327 | } | ||
| 17328 | |||
| 17329 | ✗ | if (getInput(btnDown, INPUT_DRUNK | INPUT_HERO_ACTION)) | |
| 17330 | { | ||
| 17331 | ✗ | if(xoff && !is_on_conveyor && action != swimming && action != sideswimming && action != sideswimhit && action != sideswimattacking && jumping<1) | |
| 17332 | { | ||
| 17333 | ✗ | if(dir!=up && dir!=down) | |
| 17334 | { | ||
| 17335 | ✗ | if(xoff>2&&xoff<6) | |
| 17336 | { | ||
| 17337 | ✗ | moveOld2(dir); | |
| 17338 | ✗ | } | |
| 17339 | ✗ | else if(xoff>=6) | |
| 17340 | { | ||
| 17341 | ✗ | moveOld2(right); | |
| 17342 | ✗ | } | |
| 17343 | ✗ | else if(xoff>=1) | |
| 17344 | { | ||
| 17345 | ✗ | moveOld2(left); | |
| 17346 | ✗ | } | |
| 17347 | ✗ | } | |
| 17348 | else | ||
| 17349 | { | ||
| 17350 | ✗ | if(xoff>=4) | |
| 17351 | { | ||
| 17352 | ✗ | moveOld2(right); | |
| 17353 | ✗ | } | |
| 17354 | ✗ | else if(xoff<4) | |
| 17355 | { | ||
| 17356 | ✗ | moveOld2(left); | |
| 17357 | ✗ | } | |
| 17358 | } | ||
| 17359 | ✗ | } | |
| 17360 | else | ||
| 17361 | { | ||
| 17362 | ✗ | do | |
| 17363 | { | ||
| 17364 | ✗ | if(action==swimming || IsSideSwim() || action == swimhit) | |
| 17365 | { | ||
| 17366 | ✗ | info=walkflag(temp_x,temp_y+15+temp_step,2,down); | |
| 17367 | |||
| 17368 | ✗ | if(_walkflag(temp_x+15, temp_y+15+temp_step, 1,get_standing_z_state()) && | |
| 17369 | ✗ | !(iswaterex_z3(MAPCOMBO(temp_x, temp_y+15+temp_step), -1, temp_x, temp_y+15+temp_step, true, false) && | |
| 17370 | ✗ | iswaterex_z3(MAPCOMBO(temp_x+15, temp_y+15+temp_step), -1, temp_x+15, temp_y+15+temp_step, true, false))) | |
| 17371 | ✗ | info.setUnwalkable(true); | |
| 17372 | ✗ | } | |
| 17373 | else | ||
| 17374 | { | ||
| 17375 | ✗ | info=walkflag(temp_x,temp_y+15+temp_step,2,down); | |
| 17376 | ✗ | if(x.getInt() & 7) | |
| 17377 | ✗ | info = info || walkflag(temp_x+16,temp_y+15+temp_step,1,down); | |
| 17378 | else | ||
| 17379 | ✗ | info = info || walkflagMBlock(temp_x+8,temp_y+15+temp_step); | |
| 17380 | } | ||
| 17381 | |||
| 17382 | ✗ | if(info.isUnwalkable()) | |
| 17383 | { | ||
| 17384 | ✗ | if(temp_y != int32_t(temp_y)) | |
| 17385 | { | ||
| 17386 | ✗ | temp_y = floor((double)temp_y); | |
| 17387 | ✗ | } | |
| 17388 | ✗ | else if(temp_step > 1) | |
| 17389 | { | ||
| 17390 | ✗ | if(temp_step != int32_t(temp_step)) //floor | |
| 17391 | ✗ | temp_step = floor((double)temp_step); | |
| 17392 | ✗ | else --temp_step; | |
| 17393 | ✗ | } | |
| 17394 | else | ||
| 17395 | ✗ | break; | |
| 17396 | ✗ | } | |
| 17397 | ✗ | } | |
| 17398 | ✗ | while(info.isUnwalkable()); | |
| 17399 | |||
| 17400 | ✗ | execute(info); | |
| 17401 | |||
| 17402 | ✗ | if(!info.isUnwalkable()) | |
| 17403 | { | ||
| 17404 | ✗ | x = temp_x; | |
| 17405 | ✗ | y = temp_y; | |
| 17406 | ✗ | hero_newstep = temp_step; | |
| 17407 | ✗ | moveOld2(down); | |
| 17408 | ✗ | return; | |
| 17409 | } | ||
| 17410 | |||
| 17411 | ✗ | if (!getInput(btnLeft, INPUT_DRUNK | INPUT_HERO_ACTION) && !getInput(btnRight, INPUT_DRUNK | INPUT_HERO_ACTION)) | |
| 17412 | { | ||
| 17413 | ✗ | if(NO_GRIDLOCK) | |
| 17414 | { | ||
| 17415 | ✗ | x = x.getInt(); | |
| 17416 | ✗ | y = y.getInt(); | |
| 17417 | ✗ | if(!_walkflag(x, y+15+1,1,get_standing_z_state())&& | |
| 17418 | ✗ | !_walkflag(x+8, y+15+1,1,get_standing_z_state())&& | |
| 17419 | ✗ | _walkflag(x+15,y+15+1,1,get_standing_z_state())) | |
| 17420 | { | ||
| 17421 | ✗ | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(hero_scr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?15:11),y+15+1)) | |
| 17422 | ✗ | sprite::move((zfix)-1,(zfix)0); | |
| 17423 | ✗ | } | |
| 17424 | ✗ | else if(_walkflag(x, y+15+1,1,get_standing_z_state())&& | |
| 17425 | ✗ | !_walkflag(x+7, y+15+1,1,get_standing_z_state())&& | |
| 17426 | ✗ | !_walkflag(x+15,y+15+1,1,get_standing_z_state())) | |
| 17427 | { | ||
| 17428 | ✗ | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(hero_scr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?0:4),y+15+1)) | |
| 17429 | ✗ | sprite::move((zfix)1,(zfix)0); | |
| 17430 | ✗ | } | |
| 17431 | else | ||
| 17432 | { | ||
| 17433 | ✗ | pushing=push+1; | |
| 17434 | } | ||
| 17435 | ✗ | } | |
| 17436 | ✗ | else pushing=push+1; | |
| 17437 | |||
| 17438 | ✗ | if(charging==0 && spins==0) | |
| 17439 | { | ||
| 17440 | ✗ | dir=down; | |
| 17441 | ✗ | } | |
| 17442 | |||
| 17443 | ✗ | if(action!=swimming && action != sideswimming && action != sideswimhit && action != sideswimattacking) | |
| 17444 | { | ||
| 17445 | ✗ | herostep(); | |
| 17446 | ✗ | } | |
| 17447 | |||
| 17448 | ✗ | return; | |
| 17449 | } | ||
| 17450 | ✗ | else goto LEFTRIGHT_NEWMOVE; | |
| 17451 | } | ||
| 17452 | |||
| 17453 | ✗ | return; | |
| 17454 | } | ||
| 17455 | |||
| 17456 | LEFTRIGHT_NEWMOVE: | ||
| 17457 | ✗ | temp_x = x; | |
| 17458 | ✗ | temp_y = y; | |
| 17459 | ✗ | temp_step = hero_newstep; | |
| 17460 | ✗ | if(isdungeon() && (temp_y<=26 || temp_y>=134) && !get_qr(qr_FREEFORM) && !walk_through_walls) | |
| 17461 | { | ||
| 17462 | ✗ | return; | |
| 17463 | } | ||
| 17464 | |||
| 17465 | ✗ | if (getInput(btnLeft, INPUT_DRUNK | INPUT_HERO_ACTION)) | |
| 17466 | { | ||
| 17467 | ✗ | if(yoff && !is_on_conveyor && action != swimming && action != sideswimming && action != sideswimhit && action != sideswimattacking && jumping<1) | |
| 17468 | { | ||
| 17469 | ✗ | if(dir!=left && dir!=right) | |
| 17470 | { | ||
| 17471 | ✗ | if(yoff>2&&yoff<6) | |
| 17472 | { | ||
| 17473 | ✗ | moveOld2(dir); | |
| 17474 | ✗ | } | |
| 17475 | ✗ | else if(yoff>=6) | |
| 17476 | { | ||
| 17477 | ✗ | moveOld2(down); | |
| 17478 | ✗ | } | |
| 17479 | ✗ | else if(yoff>=1) | |
| 17480 | { | ||
| 17481 | ✗ | moveOld2(up); | |
| 17482 | ✗ | } | |
| 17483 | ✗ | } | |
| 17484 | else | ||
| 17485 | { | ||
| 17486 | ✗ | if(yoff>=4) | |
| 17487 | { | ||
| 17488 | ✗ | moveOld2(down); | |
| 17489 | ✗ | } | |
| 17490 | ✗ | else if(yoff<4) | |
| 17491 | { | ||
| 17492 | ✗ | moveOld2(up); | |
| 17493 | ✗ | } | |
| 17494 | } | ||
| 17495 | ✗ | } | |
| 17496 | else | ||
| 17497 | { | ||
| 17498 | ✗ | do | |
| 17499 | { | ||
| 17500 | ✗ | info = walkflag(temp_x-temp_step,temp_y+(bigHitbox?0:8),1,left) || | |
| 17501 | ✗ | walkflag(temp_x-temp_step,temp_y+(isSideViewHero() ?0:8), 1,left); | |
| 17502 | |||
| 17503 | ✗ | if(y.getInt() & 7) | |
| 17504 | ✗ | info = info || walkflag(temp_x-temp_step,temp_y+16,1,left); | |
| 17505 | |||
| 17506 | ✗ | if(info.isUnwalkable()) | |
| 17507 | { | ||
| 17508 | ✗ | if(temp_x != int32_t(temp_x)) | |
| 17509 | { | ||
| 17510 | ✗ | temp_x = floor((double)temp_x); | |
| 17511 | ✗ | } | |
| 17512 | ✗ | else if(temp_step > 1) | |
| 17513 | { | ||
| 17514 | ✗ | if(temp_step != int32_t(temp_step)) //floor | |
| 17515 | ✗ | temp_step = floor((double)temp_step); | |
| 17516 | ✗ | else --temp_step; | |
| 17517 | ✗ | } | |
| 17518 | else | ||
| 17519 | ✗ | break; | |
| 17520 | ✗ | } | |
| 17521 | ✗ | } | |
| 17522 | ✗ | while(info.isUnwalkable()); | |
| 17523 | |||
| 17524 | ✗ | execute(info); | |
| 17525 | |||
| 17526 | ✗ | if(!info.isUnwalkable()) | |
| 17527 | { | ||
| 17528 | ✗ | x = temp_x; | |
| 17529 | ✗ | y = temp_y; | |
| 17530 | ✗ | hero_newstep = temp_step; | |
| 17531 | ✗ | moveOld2(left); | |
| 17532 | ✗ | return; | |
| 17533 | } | ||
| 17534 | |||
| 17535 | ✗ | if (!getInput(btnUp, INPUT_DRUNK | INPUT_HERO_ACTION) && !getInput(btnDown, INPUT_DRUNK | INPUT_HERO_ACTION)) | |
| 17536 | { | ||
| 17537 | ✗ | if(NO_GRIDLOCK) | |
| 17538 | { | ||
| 17539 | ✗ | x = x.getInt(); | |
| 17540 | ✗ | y = y.getInt(); | |
| 17541 | ✗ | int32_t v1=bigHitbox?0:8; | |
| 17542 | ✗ | int32_t v2=bigHitbox?8:12; | |
| 17543 | |||
| 17544 | ✗ | if(!_walkflag(x-1,y+v1,1,get_standing_z_state())&& | |
| 17545 | ✗ | !_walkflag(x-1,y+v2,1,get_standing_z_state())&& | |
| 17546 | ✗ | _walkflag(x-1,y+15,1,get_standing_z_state())) | |
| 17547 | { | ||
| 17548 | ✗ | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(hero_scr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x-1,y+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?15:11))) | |
| 17549 | ✗ | sprite::move((zfix)0,(zfix)-1); | |
| 17550 | ✗ | } | |
| 17551 | ✗ | else if(_walkflag(x-1,y+v1,1,get_standing_z_state())&& | |
| 17552 | ✗ | !_walkflag(x-1,y+v2-1,1,get_standing_z_state())&& | |
| 17553 | ✗ | !_walkflag(x-1,y+15, 1,get_standing_z_state())) | |
| 17554 | { | ||
| 17555 | ✗ | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(hero_scr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x-1,y+v1+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?0:4))) | |
| 17556 | ✗ | sprite::move((zfix)0,(zfix)1); | |
| 17557 | ✗ | } | |
| 17558 | else | ||
| 17559 | { | ||
| 17560 | ✗ | pushing=push+1; | |
| 17561 | } | ||
| 17562 | ✗ | } | |
| 17563 | ✗ | else pushing=push+1; | |
| 17564 | |||
| 17565 | ✗ | if(charging==0 && spins==0) | |
| 17566 | { | ||
| 17567 | ✗ | dir=left; | |
| 17568 | ✗ | } | |
| 17569 | |||
| 17570 | ✗ | if(action!=swimming && action != sideswimming && action != sideswimhit && action != sideswimattacking) | |
| 17571 | { | ||
| 17572 | ✗ | herostep(); | |
| 17573 | ✗ | } | |
| 17574 | |||
| 17575 | ✗ | return; | |
| 17576 | } | ||
| 17577 | } | ||
| 17578 | |||
| 17579 | ✗ | return; | |
| 17580 | } | ||
| 17581 | |||
| 17582 | ✗ | if (getInput(btnRight, INPUT_DRUNK | INPUT_HERO_ACTION)) | |
| 17583 | { | ||
| 17584 | ✗ | if(yoff && !is_on_conveyor && action != swimming && action != sideswimming && action != sideswimhit && action != sideswimattacking && jumping<1) | |
| 17585 | { | ||
| 17586 | ✗ | if(dir!=left && dir!=right) | |
| 17587 | { | ||
| 17588 | ✗ | if(yoff>2&&yoff<6) | |
| 17589 | { | ||
| 17590 | ✗ | moveOld2(dir); | |
| 17591 | ✗ | } | |
| 17592 | ✗ | else if(yoff>=6) | |
| 17593 | { | ||
| 17594 | ✗ | moveOld2(down); | |
| 17595 | ✗ | } | |
| 17596 | ✗ | else if(yoff>=1) | |
| 17597 | { | ||
| 17598 | ✗ | moveOld2(up); | |
| 17599 | ✗ | } | |
| 17600 | ✗ | } | |
| 17601 | else | ||
| 17602 | { | ||
| 17603 | ✗ | if(yoff>=4) | |
| 17604 | { | ||
| 17605 | ✗ | moveOld2(down); | |
| 17606 | ✗ | } | |
| 17607 | ✗ | else if(yoff<4) | |
| 17608 | { | ||
| 17609 | ✗ | moveOld2(up); | |
| 17610 | ✗ | } | |
| 17611 | } | ||
| 17612 | ✗ | } | |
| 17613 | else | ||
| 17614 | { | ||
| 17615 | ✗ | do | |
| 17616 | { | ||
| 17617 | ✗ | info = walkflag(temp_x+15+temp_step,temp_y+(bigHitbox?0:8),1,right) || | |
| 17618 | ✗ | walkflag(temp_x+15+temp_step,temp_y+(isSideViewHero() ?0:8),1,right); | |
| 17619 | |||
| 17620 | ✗ | if(y.getInt() & 7) | |
| 17621 | ✗ | info = info || walkflag(temp_x+15+temp_step,y+16,1,right); | |
| 17622 | |||
| 17623 | ✗ | if(info.isUnwalkable()) | |
| 17624 | { | ||
| 17625 | ✗ | if(temp_x != int32_t(temp_x)) | |
| 17626 | { | ||
| 17627 | ✗ | temp_x = floor((double)temp_x); | |
| 17628 | ✗ | } | |
| 17629 | ✗ | else if(temp_step > 1) | |
| 17630 | { | ||
| 17631 | ✗ | if(temp_step != int32_t(temp_step)) //floor | |
| 17632 | ✗ | temp_step = floor((double)temp_step); | |
| 17633 | ✗ | else --temp_step; | |
| 17634 | ✗ | } | |
| 17635 | else | ||
| 17636 | ✗ | break; | |
| 17637 | ✗ | } | |
| 17638 | ✗ | } | |
| 17639 | ✗ | while(info.isUnwalkable()); | |
| 17640 | |||
| 17641 | ✗ | execute(info); | |
| 17642 | |||
| 17643 | ✗ | if(!info.isUnwalkable()) | |
| 17644 | { | ||
| 17645 | ✗ | x = temp_x; | |
| 17646 | ✗ | y = temp_y; | |
| 17647 | ✗ | hero_newstep = temp_step; | |
| 17648 | ✗ | moveOld2(right); | |
| 17649 | ✗ | return; | |
| 17650 | } | ||
| 17651 | |||
| 17652 | ✗ | if (!getInput(btnUp, INPUT_DRUNK | INPUT_HERO_ACTION) && !getInput(btnDown, INPUT_DRUNK | INPUT_HERO_ACTION)) | |
| 17653 | { | ||
| 17654 | ✗ | if(NO_GRIDLOCK) | |
| 17655 | { | ||
| 17656 | ✗ | x = x.getInt(); | |
| 17657 | ✗ | y = y.getInt(); | |
| 17658 | ✗ | int32_t v1=bigHitbox?0:8; | |
| 17659 | ✗ | int32_t v2=bigHitbox?8:12; | |
| 17660 | |||
| 17661 | ✗ | if(!_walkflag(x+16,y+v1,1,get_standing_z_state())&& | |
| 17662 | ✗ | !_walkflag(x+16,y+v2,1,get_standing_z_state())&& | |
| 17663 | ✗ | _walkflag(x+16,y+15,1,get_standing_z_state())) | |
| 17664 | { | ||
| 17665 | ✗ | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(hero_scr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x+16,y+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?15:11))) | |
| 17666 | ✗ | sprite::move((zfix)0,(zfix)-1); | |
| 17667 | ✗ | } | |
| 17668 | ✗ | else if(_walkflag(x+16,y+v1,1,get_standing_z_state())&& | |
| 17669 | ✗ | !_walkflag(x+16,y+v2-1,1,get_standing_z_state())&& | |
| 17670 | ✗ | !_walkflag(x+16,y+15,1,get_standing_z_state())) | |
| 17671 | { | ||
| 17672 | ✗ | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(hero_scr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x+16,y+v1+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?0:4))) | |
| 17673 | ✗ | sprite::move((zfix)0,(zfix)1); | |
| 17674 | ✗ | } | |
| 17675 | else | ||
| 17676 | { | ||
| 17677 | ✗ | pushing=push+1; | |
| 17678 | } | ||
| 17679 | ✗ | } | |
| 17680 | ✗ | else pushing=push+1; | |
| 17681 | |||
| 17682 | ✗ | if(charging==0 && spins==0) | |
| 17683 | { | ||
| 17684 | ✗ | dir=right; | |
| 17685 | ✗ | } | |
| 17686 | |||
| 17687 | ✗ | if(action!=swimming && action != sideswimming && action != sideswimhit && action != sideswimattacking) | |
| 17688 | { | ||
| 17689 | ✗ | herostep(); | |
| 17690 | ✗ | } | |
| 17691 | |||
| 17692 | ✗ | return; | |
| 17693 | } | ||
| 17694 | } | ||
| 17695 | ✗ | } | |
| 17696 | ✗ | } | |
| 17697 | else | ||
| 17698 | { | ||
| 17699 | 7439364 | info = walkflag(x-int32_t(lsteps[x.getInt()&7]),y+(bigHitbox?0:8),1,left) || | |
| 17700 | 3719682 | walkflag(x-int32_t(lsteps[x.getInt()&7]),y+8,1,left); | |
| 17701 | |||
| 17702 |
10/10✓ Branch 0 taken 2412477 times.
✓ Branch 1 taken 1307205 times.
✓ Branch 2 taken 304272 times.
✓ Branch 3 taken 2108205 times.
✓ Branch 4 taken 186363 times.
✓ Branch 5 taken 117909 times.
✓ Branch 6 taken 1889 times.
✓ Branch 7 taken 184474 times.
✓ Branch 8 taken 358 times.
✓ Branch 9 taken 1531 times.
|
3719682 | if (isdungeon() && getInput(btnLeft, INPUT_DRUNK | INPUT_HERO_ACTION) && !info.isUnwalkable() && (x == 32 && y == 80)) |
| 17703 | { | ||
| 17704 | //ONLY process the side-effects of the above walkflag if Hero will actually move | ||
| 17705 | //sigh sigh sigh... walkflag is a horrible mess :-/ -DD | ||
| 17706 | 1531 | execute(info); | |
| 17707 | 1531 | moveOld2(left); | |
| 17708 | 1531 | return; | |
| 17709 | } | ||
| 17710 | |||
| 17711 | 7436302 | info = walkflag(x+15+int32_t(lsteps[x.getInt()&7]),y+(bigHitbox?0:8),1,right) || | |
| 17712 | 3718151 | walkflag(x+15+int32_t(lsteps[x.getInt()&7]),y+8,1,right); | |
| 17713 | |||
| 17714 |
10/10✓ Branch 0 taken 2410946 times.
✓ Branch 1 taken 1307205 times.
✓ Branch 2 taken 337880 times.
✓ Branch 3 taken 2073066 times.
✓ Branch 4 taken 201211 times.
✓ Branch 5 taken 136669 times.
✓ Branch 6 taken 2221 times.
✓ Branch 7 taken 198990 times.
✓ Branch 8 taken 406 times.
✓ Branch 9 taken 1815 times.
|
3718151 | if (isdungeon() && getInput(btnRight, INPUT_DRUNK | INPUT_HERO_ACTION) && !info.isUnwalkable() && x == 208 && y == 80) |
| 17715 | { | ||
| 17716 | 1815 | execute(info); | |
| 17717 | 1815 | moveOld2(right); | |
| 17718 | 1815 | return; | |
| 17719 | } | ||
| 17720 | |||
| 17721 | 3716336 | ladderx = oldladderx; | |
| 17722 | 3716336 | laddery = oldladdery; | |
| 17723 | |||
| 17724 |
2/2✓ Branch 0 taken 416069 times.
✓ Branch 1 taken 3300267 times.
|
3716336 | if (getInput(btnUp, INPUT_DRUNK | INPUT_HERO_ACTION)) |
| 17725 | { | ||
| 17726 |
11/14✓ Branch 0 taken 11759 times.
✓ Branch 1 taken 404310 times.
✓ Branch 2 taken 10988 times.
✓ Branch 3 taken 771 times.
✓ Branch 4 taken 8233 times.
✓ Branch 5 taken 2755 times.
✓ Branch 6 taken 8233 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 8233 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 8233 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 3 times.
✓ Branch 13 taken 8230 times.
|
416069 | if(xoff && !is_on_conveyor && action != swimming && action != sideswimming && action != sideswimhit && action != sideswimattacking && jumping<1) |
| 17727 | { | ||
| 17728 |
4/4✓ Branch 0 taken 8196 times.
✓ Branch 1 taken 34 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 8195 times.
|
8230 | if(dir!=up && dir!=down) |
| 17729 | { | ||
| 17730 |
4/4✓ Branch 0 taken 5693 times.
✓ Branch 1 taken 2502 times.
✓ Branch 2 taken 2427 times.
✓ Branch 3 taken 3266 times.
|
8195 | if(xoff>2&&xoff<6) |
| 17731 | { | ||
| 17732 | 3266 | moveOld2(dir); | |
| 17733 | 3266 | } | |
| 17734 |
2/2✓ Branch 0 taken 2427 times.
✓ Branch 1 taken 2502 times.
|
4929 | else if(xoff>=6) |
| 17735 | { | ||
| 17736 | 2427 | moveOld2(right); | |
| 17737 | 2427 | } | |
| 17738 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2502 times.
|
2502 | else if(xoff>=1) |
| 17739 | { | ||
| 17740 | 2502 | moveOld2(left); | |
| 17741 | 2502 | } | |
| 17742 | 8195 | } | |
| 17743 | else | ||
| 17744 | { | ||
| 17745 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 25 times.
|
35 | if(xoff>=4) |
| 17746 | { | ||
| 17747 | 10 | moveOld2(right); | |
| 17748 | 10 | } | |
| 17749 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 25 times.
|
25 | else if(xoff<4) |
| 17750 | { | ||
| 17751 | 25 | moveOld2(left); | |
| 17752 | 25 | } | |
| 17753 | } | ||
| 17754 | 8230 | } | |
| 17755 | else | ||
| 17756 | { | ||
| 17757 |
4/6✓ Branch 0 taken 381459 times.
✓ Branch 1 taken 26380 times.
✓ Branch 2 taken 381459 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 381459 times.
|
407839 | if(action==swimming || IsSideSwim() || action == swimhit) |
| 17758 | { | ||
| 17759 | 26380 | info = walkflag(x,y+(bigHitbox?0:8)-int32_t(lsteps[y.getInt()&7]),2,up); | |
| 17760 | |||
| 17761 |
4/4✓ Branch 0 taken 2023 times.
✓ Branch 1 taken 24357 times.
✓ Branch 2 taken 21669 times.
✓ Branch 3 taken 4711 times.
|
50737 | if(_walkflag(x+15, y+(bigHitbox?0:8)-int32_t(lsteps[y.getInt()&7]), 1,get_standing_z_state()) && |
| 17762 |
2/2✓ Branch 0 taken 4471 times.
✓ Branch 1 taken 19886 times.
|
44243 | !(iswaterex_z3(MAPCOMBO(x, y+(bigHitbox?0:8)-int32_t(lsteps[y.getInt()&7])), -1, x, y+(bigHitbox?0:8)-int32_t(lsteps[y.getInt()&7])) && |
| 17763 | 19886 | iswaterex_z3(MAPCOMBO(x+15, y+(bigHitbox?0:8)-int32_t(lsteps[y.getInt()&7])), -1, x+15, y+(bigHitbox?0:8)-int32_t(lsteps[y.getInt()&7])))) | |
| 17764 | 4711 | info.setUnwalkable(true); | |
| 17765 | 26380 | } | |
| 17766 | else | ||
| 17767 | { | ||
| 17768 | 381459 | info = walkflag(x,y+(bigHitbox?0:8)-int32_t(lsteps[y.getInt()&7]),2,up); | |
| 17769 |
2/2✓ Branch 0 taken 777 times.
✓ Branch 1 taken 380682 times.
|
381459 | if(x.getInt() & 7) |
| 17770 | 777 | info = info || walkflag(x+16,y+(bigHitbox?0:8)-int32_t(lsteps[y.getInt()&7]),1,up); | |
| 17771 | else | ||
| 17772 | 380682 | info = info || walkflagMBlock(x+8,y+(bigHitbox?0:8)-int32_t(lsteps[y.getInt()&7])); | |
| 17773 | } | ||
| 17774 | |||
| 17775 | 407839 | execute(info); | |
| 17776 | |||
| 17777 |
2/2✓ Branch 0 taken 169874 times.
✓ Branch 1 taken 237965 times.
|
407839 | if(!info.isUnwalkable()) |
| 17778 | { | ||
| 17779 | 237965 | moveOld2(up); | |
| 17780 | 237965 | return; | |
| 17781 | } | ||
| 17782 | |||
| 17783 |
4/4✓ Branch 0 taken 151091 times.
✓ Branch 1 taken 18783 times.
✓ Branch 2 taken 18777 times.
✓ Branch 3 taken 132314 times.
|
169874 | if (!getInput(btnLeft, INPUT_DRUNK | INPUT_HERO_ACTION) && !getInput(btnRight, INPUT_DRUNK | INPUT_HERO_ACTION)) |
| 17784 | { | ||
| 17785 |
2/4✓ Branch 0 taken 132314 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 132314 times.
|
132314 | if(NO_GRIDLOCK) |
| 17786 | { | ||
| 17787 | ✗ | if(!_walkflag(x,y+(bigHitbox?0:8)-1,1,get_standing_z_state()) && | |
| 17788 | ✗ | !_walkflag(x+8, y+(bigHitbox?0:8)-1,1,get_standing_z_state()) && | |
| 17789 | ✗ | _walkflag(x+15,y+(bigHitbox?0:8)-1,1,get_standing_z_state())) | |
| 17790 | { | ||
| 17791 | ✗ | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(hero_scr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?15:11),y+(bigHitbox?0:8)-1)) | |
| 17792 | ✗ | sprite::move((zfix)-1,(zfix)0); | |
| 17793 | ✗ | } | |
| 17794 | ✗ | else if(_walkflag(x,y+(bigHitbox?0:8)-1,1,get_standing_z_state()) && | |
| 17795 | ✗ | !_walkflag(x+7, y+(bigHitbox?0:8)-1,1,get_standing_z_state()) && | |
| 17796 | ✗ | !_walkflag(x+15,y+(bigHitbox?0:8)-1,1,get_standing_z_state())) | |
| 17797 | { | ||
| 17798 | ✗ | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(hero_scr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?0:4),y+(bigHitbox?0:8)-1)) | |
| 17799 | ✗ | sprite::move((zfix)1,(zfix)0); | |
| 17800 | ✗ | } | |
| 17801 | else | ||
| 17802 | { | ||
| 17803 | ✗ | pushing=push+1; | |
| 17804 | } | ||
| 17805 | ✗ | } | |
| 17806 | 132314 | else pushing=push+1; | |
| 17807 | |||
| 17808 |
4/4✓ Branch 0 taken 132131 times.
✓ Branch 1 taken 183 times.
✓ Branch 2 taken 132035 times.
✓ Branch 3 taken 96 times.
|
132314 | if(charging==0 && spins==0) |
| 17809 | { | ||
| 17810 | 132035 | dir=up; | |
| 17811 | 132035 | } | |
| 17812 | |||
| 17813 |
5/8✓ Branch 0 taken 129287 times.
✓ Branch 1 taken 3027 times.
✓ Branch 2 taken 129287 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 129287 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 129287 times.
|
132314 | if(action!=swimming && action != sideswimming && action != sideswimhit && action != sideswimattacking) |
| 17814 | { | ||
| 17815 | 129287 | herostep(); | |
| 17816 | 129287 | } | |
| 17817 | |||
| 17818 | 132314 | return; | |
| 17819 | } | ||
| 17820 | else | ||
| 17821 | { | ||
| 17822 | 37560 | goto LEFTRIGHT_OLDMOVE; | |
| 17823 | } | ||
| 17824 | } | ||
| 17825 | |||
| 17826 | 8230 | return; | |
| 17827 | } | ||
| 17828 | |||
| 17829 |
2/2✓ Branch 0 taken 370315 times.
✓ Branch 1 taken 2929952 times.
|
3300267 | if (getInput(btnDown, INPUT_DRUNK | INPUT_HERO_ACTION)) |
| 17830 | { | ||
| 17831 |
11/14✓ Branch 0 taken 10694 times.
✓ Branch 1 taken 359621 times.
✓ Branch 2 taken 9975 times.
✓ Branch 3 taken 719 times.
✓ Branch 4 taken 6694 times.
✓ Branch 5 taken 3281 times.
✓ Branch 6 taken 6694 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 6694 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 6694 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 1 times.
✓ Branch 13 taken 6693 times.
|
370315 | if(xoff && !is_on_conveyor && action != swimming && action != sideswimming && action != sideswimhit && action != sideswimattacking && jumping<1) |
| 17832 | { | ||
| 17833 |
3/4✓ Branch 0 taken 6693 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 6690 times.
|
6693 | if(dir!=up && dir!=down) |
| 17834 | { | ||
| 17835 |
4/4✓ Branch 0 taken 4676 times.
✓ Branch 1 taken 2014 times.
✓ Branch 2 taken 2001 times.
✓ Branch 3 taken 2675 times.
|
6690 | if(xoff>2&&xoff<6) |
| 17836 | { | ||
| 17837 | 2675 | moveOld2(dir); | |
| 17838 | 2675 | } | |
| 17839 |
2/2✓ Branch 0 taken 2001 times.
✓ Branch 1 taken 2014 times.
|
4015 | else if(xoff>=6) |
| 17840 | { | ||
| 17841 | 2001 | moveOld2(right); | |
| 17842 | 2001 | } | |
| 17843 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2014 times.
|
2014 | else if(xoff>=1) |
| 17844 | { | ||
| 17845 | 2014 | moveOld2(left); | |
| 17846 | 2014 | } | |
| 17847 | 6690 | } | |
| 17848 | else | ||
| 17849 | { | ||
| 17850 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | if(xoff>=4) |
| 17851 | { | ||
| 17852 | 3 | moveOld2(right); | |
| 17853 | 3 | } | |
| 17854 | ✗ | else if(xoff<4) | |
| 17855 | { | ||
| 17856 | ✗ | moveOld2(left); | |
| 17857 | ✗ | } | |
| 17858 | } | ||
| 17859 | 6693 | } | |
| 17860 | else | ||
| 17861 | { | ||
| 17862 |
4/6✓ Branch 0 taken 340096 times.
✓ Branch 1 taken 23526 times.
✓ Branch 2 taken 340096 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 340096 times.
|
363622 | if(action==swimming || IsSideSwim() || action == swimhit) |
| 17863 | { | ||
| 17864 | 23526 | info=walkflag(x,y+15+int32_t(lsteps[y.getInt()&7]),2,down); | |
| 17865 | |||
| 17866 |
4/4✓ Branch 0 taken 2312 times.
✓ Branch 1 taken 21214 times.
✓ Branch 2 taken 17545 times.
✓ Branch 3 taken 5981 times.
|
44740 | if(_walkflag(x+15, y+15+int32_t(lsteps[y.getInt()&7]), 1,get_standing_z_state()) && |
| 17867 |
2/2✓ Branch 0 taken 5786 times.
✓ Branch 1 taken 15428 times.
|
36642 | !(iswaterex_z3(MAPCOMBO(x, y+15+int32_t(lsteps[y.getInt()&7])), -1, x, y+15+int32_t(lsteps[y.getInt()&7])) && |
| 17868 | 15428 | iswaterex_z3(MAPCOMBO(x+15, y+15+int32_t(lsteps[y.getInt()&7])), -1, x+15, y+15+int32_t(lsteps[y.getInt()&7])))) | |
| 17869 | 5981 | info.setUnwalkable(true); | |
| 17870 | 23526 | } | |
| 17871 | else | ||
| 17872 | { | ||
| 17873 | 340096 | info=walkflag(x,y+15+int32_t(lsteps[y.getInt()&7]),2,down); | |
| 17874 |
2/2✓ Branch 0 taken 724 times.
✓ Branch 1 taken 339372 times.
|
340096 | if(x.getInt() & 7) |
| 17875 | 724 | info = (info || walkflag(x+16,y+15+int32_t(lsteps[y.getInt()&7]),1,down)); | |
| 17876 | else | ||
| 17877 | 339372 | info = (info || walkflagMBlock(x+8,y+15+int32_t(lsteps[y.getInt()&7]))); | |
| 17878 | } | ||
| 17879 | |||
| 17880 | 363622 | execute(info); | |
| 17881 | |||
| 17882 |
2/2✓ Branch 0 taken 167095 times.
✓ Branch 1 taken 196527 times.
|
363622 | if(!info.isUnwalkable()) |
| 17883 | { | ||
| 17884 | 196527 | moveOld2(down); | |
| 17885 | 196527 | return; | |
| 17886 | } | ||
| 17887 | |||
| 17888 |
4/4✓ Branch 0 taken 146281 times.
✓ Branch 1 taken 20814 times.
✓ Branch 2 taken 20409 times.
✓ Branch 3 taken 125872 times.
|
167095 | if (!getInput(btnLeft, INPUT_DRUNK | INPUT_HERO_ACTION) && !getInput(btnRight, INPUT_DRUNK | INPUT_HERO_ACTION)) |
| 17889 | { | ||
| 17890 |
2/4✓ Branch 0 taken 125872 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 125872 times.
|
125872 | if(NO_GRIDLOCK) |
| 17891 | { | ||
| 17892 | ✗ | if(!_walkflag(x, y+15+1,1,get_standing_z_state())&& | |
| 17893 | ✗ | !_walkflag(x+8, y+15+1,1,get_standing_z_state())&& | |
| 17894 | ✗ | _walkflag(x+15,y+15+1,1,get_standing_z_state())) | |
| 17895 | { | ||
| 17896 | ✗ | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(hero_scr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?15:11),y+15+1)) | |
| 17897 | ✗ | sprite::move((zfix)-1,(zfix)0); | |
| 17898 | ✗ | } | |
| 17899 | ✗ | else if(_walkflag(x, y+15+1,1,get_standing_z_state())&& | |
| 17900 | ✗ | !_walkflag(x+7, y+15+1,1,get_standing_z_state())&& | |
| 17901 | ✗ | !_walkflag(x+15,y+15+1,1,get_standing_z_state())) | |
| 17902 | { | ||
| 17903 | ✗ | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(hero_scr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?0:4),y+15+1)) | |
| 17904 | ✗ | sprite::move((zfix)1,(zfix)0); | |
| 17905 | ✗ | } | |
| 17906 | else | ||
| 17907 | { | ||
| 17908 | ✗ | pushing=push+1; | |
| 17909 | } | ||
| 17910 | ✗ | } | |
| 17911 | 125872 | else pushing=push+1; | |
| 17912 | |||
| 17913 |
2/4✓ Branch 0 taken 125872 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 125872 times.
✗ Branch 3 not taken.
|
125872 | if(charging==0 && spins==0) |
| 17914 | { | ||
| 17915 | 125872 | dir=down; | |
| 17916 | 125872 | } | |
| 17917 | |||
| 17918 |
5/8✓ Branch 0 taken 123206 times.
✓ Branch 1 taken 2666 times.
✓ Branch 2 taken 123206 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 123206 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 123206 times.
|
125872 | if(action!=swimming && action != sideswimming && action != sideswimhit && action != sideswimattacking) |
| 17919 | { | ||
| 17920 | 123206 | herostep(); | |
| 17921 | 123206 | } | |
| 17922 | |||
| 17923 | 125872 | return; | |
| 17924 | } | ||
| 17925 | 41223 | else goto LEFTRIGHT_OLDMOVE; | |
| 17926 | } | ||
| 17927 | |||
| 17928 | 6693 | return; | |
| 17929 | } | ||
| 17930 | |||
| 17931 | LEFTRIGHT_OLDMOVE: | ||
| 17932 | |||
| 17933 |
7/8✓ Branch 0 taken 2014946 times.
✓ Branch 1 taken 1053195 times.
✓ Branch 2 taken 1959592 times.
✓ Branch 3 taken 55354 times.
✓ Branch 4 taken 55639 times.
✓ Branch 5 taken 1959307 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 55639 times.
|
3068141 | if(isdungeon() && (y<=26 || y>=world_h-42) && !get_qr(qr_FREEFORM) && !walk_through_walls) |
| 17934 | { | ||
| 17935 | 55639 | return; | |
| 17936 | } | ||
| 17937 | |||
| 17938 |
2/2✓ Branch 0 taken 462695 times.
✓ Branch 1 taken 2549807 times.
|
3012502 | if (getInput(btnLeft, INPUT_DRUNK | INPUT_HERO_ACTION)) |
| 17939 | { | ||
| 17940 |
11/14✓ Branch 0 taken 8415 times.
✓ Branch 1 taken 454280 times.
✓ Branch 2 taken 7962 times.
✓ Branch 3 taken 453 times.
✓ Branch 4 taken 7343 times.
✓ Branch 5 taken 619 times.
✓ Branch 6 taken 7343 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 7343 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 7343 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 2 times.
✓ Branch 13 taken 7341 times.
|
462695 | if(yoff && !is_on_conveyor && action != swimming && action != sideswimming && action != sideswimhit && action != sideswimattacking && jumping<1) |
| 17941 | { | ||
| 17942 |
3/4✓ Branch 0 taken 7332 times.
✓ Branch 1 taken 9 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 7332 times.
|
7341 | if(dir!=left && dir!=right) |
| 17943 | { | ||
| 17944 |
4/4✓ Branch 0 taken 5180 times.
✓ Branch 1 taken 2152 times.
✓ Branch 2 taken 2240 times.
✓ Branch 3 taken 2940 times.
|
7332 | if(yoff>2&&yoff<6) |
| 17945 | { | ||
| 17946 | 2940 | moveOld2(dir); | |
| 17947 | 2940 | } | |
| 17948 |
2/2✓ Branch 0 taken 2240 times.
✓ Branch 1 taken 2152 times.
|
4392 | else if(yoff>=6) |
| 17949 | { | ||
| 17950 | 2240 | moveOld2(down); | |
| 17951 | 2240 | } | |
| 17952 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2152 times.
|
2152 | else if(yoff>=1) |
| 17953 | { | ||
| 17954 | 2152 | moveOld2(up); | |
| 17955 | 2152 | } | |
| 17956 | 7332 | } | |
| 17957 | else | ||
| 17958 | { | ||
| 17959 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 3 times.
|
9 | if(yoff>=4) |
| 17960 | { | ||
| 17961 | 6 | moveOld2(down); | |
| 17962 | 6 | } | |
| 17963 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | else if(yoff<4) |
| 17964 | { | ||
| 17965 | 3 | moveOld2(up); | |
| 17966 | 3 | } | |
| 17967 | } | ||
| 17968 | 7341 | } | |
| 17969 | else | ||
| 17970 | { | ||
| 17971 | 910708 | info = walkflag(x-int32_t(lsteps[x.getInt()&7]),y+(bigHitbox?0:8),1,left) || | |
| 17972 | 455354 | walkflag(x-int32_t(lsteps[x.getInt()&7]),y+(isSideViewHero() ?0:8), 1,left); | |
| 17973 | |||
| 17974 | 455354 | execute(info); | |
| 17975 | |||
| 17976 |
2/2✓ Branch 0 taken 164089 times.
✓ Branch 1 taken 291265 times.
|
455354 | if(!info.isUnwalkable()) |
| 17977 | { | ||
| 17978 | 291265 | moveOld2(left); | |
| 17979 | 291265 | return; | |
| 17980 | } | ||
| 17981 | |||
| 17982 |
4/4✓ Branch 0 taken 156076 times.
✓ Branch 1 taken 8013 times.
✓ Branch 2 taken 8593 times.
✓ Branch 3 taken 147483 times.
|
164089 | if (!getInput(btnUp, INPUT_DRUNK | INPUT_HERO_ACTION) && !getInput(btnDown, INPUT_DRUNK | INPUT_HERO_ACTION)) |
| 17983 | { | ||
| 17984 |
2/4✓ Branch 0 taken 147483 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 147483 times.
|
147483 | if(NO_GRIDLOCK) |
| 17985 | { | ||
| 17986 | ✗ | int32_t v1=bigHitbox?0:8; | |
| 17987 | ✗ | int32_t v2=bigHitbox?8:12; | |
| 17988 | |||
| 17989 | ✗ | if(!_walkflag(x-1,y+v1,1,get_standing_z_state())&& | |
| 17990 | ✗ | !_walkflag(x-1,y+v2,1,get_standing_z_state())&& | |
| 17991 | ✗ | _walkflag(x-1,y+15,1,get_standing_z_state())) | |
| 17992 | { | ||
| 17993 | ✗ | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(hero_scr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x-1,y+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?15:11))) | |
| 17994 | ✗ | sprite::move((zfix)0,(zfix)-1); | |
| 17995 | ✗ | } | |
| 17996 | ✗ | else if(_walkflag(x-1,y+v1, 1,get_standing_z_state())&& | |
| 17997 | ✗ | !_walkflag(x-1,y+v2-1,1,get_standing_z_state())&& | |
| 17998 | ✗ | !_walkflag(x-1,y+15, 1,get_standing_z_state())) | |
| 17999 | { | ||
| 18000 | ✗ | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(hero_scr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x-1,y+v1+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?0:4))) | |
| 18001 | ✗ | sprite::move((zfix)0,(zfix)1); | |
| 18002 | ✗ | } | |
| 18003 | else | ||
| 18004 | { | ||
| 18005 | ✗ | pushing=push+1; | |
| 18006 | } | ||
| 18007 | ✗ | } | |
| 18008 | 147483 | else pushing=push+1; | |
| 18009 | |||
| 18010 |
3/4✓ Branch 0 taken 147477 times.
✓ Branch 1 taken 6 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 147477 times.
|
147483 | if(charging==0 && spins==0) |
| 18011 | { | ||
| 18012 | 147477 | dir=left; | |
| 18013 | 147477 | } | |
| 18014 | |||
| 18015 |
5/8✓ Branch 0 taken 143688 times.
✓ Branch 1 taken 3795 times.
✓ Branch 2 taken 143688 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 143688 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 143688 times.
|
147483 | if(action!=swimming && action != sideswimming && action != sideswimhit && action != sideswimattacking) |
| 18016 | { | ||
| 18017 | 143688 | herostep(); | |
| 18018 | 143688 | } | |
| 18019 | |||
| 18020 | 147483 | return; | |
| 18021 | } | ||
| 18022 | } | ||
| 18023 | |||
| 18024 | 23947 | return; | |
| 18025 | } | ||
| 18026 | |||
| 18027 |
2/2✓ Branch 0 taken 2047980 times.
✓ Branch 1 taken 501827 times.
|
2549807 | if (getInput(btnRight, INPUT_DRUNK | INPUT_HERO_ACTION)) |
| 18028 | { | ||
| 18029 |
10/14✓ Branch 0 taken 8229 times.
✓ Branch 1 taken 493598 times.
✓ Branch 2 taken 7620 times.
✓ Branch 3 taken 609 times.
✓ Branch 4 taken 7422 times.
✓ Branch 5 taken 198 times.
✓ Branch 6 taken 7422 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 7422 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 7422 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 7422 times.
|
501827 | if(yoff && !is_on_conveyor && action != swimming && action != sideswimming && action != sideswimhit && action != sideswimattacking && jumping<1) |
| 18030 | { | ||
| 18031 |
4/4✓ Branch 0 taken 7419 times.
✓ Branch 1 taken 3 times.
✓ Branch 2 taken 9 times.
✓ Branch 3 taken 7410 times.
|
7422 | if(dir!=left && dir!=right) |
| 18032 | { | ||
| 18033 |
4/4✓ Branch 0 taken 5268 times.
✓ Branch 1 taken 2142 times.
✓ Branch 2 taken 2234 times.
✓ Branch 3 taken 3034 times.
|
7410 | if(yoff>2&&yoff<6) |
| 18034 | { | ||
| 18035 | 3034 | moveOld2(dir); | |
| 18036 | 3034 | } | |
| 18037 |
2/2✓ Branch 0 taken 2234 times.
✓ Branch 1 taken 2142 times.
|
4376 | else if(yoff>=6) |
| 18038 | { | ||
| 18039 | 2234 | moveOld2(down); | |
| 18040 | 2234 | } | |
| 18041 |
1/2✓ Branch 0 taken 2142 times.
✗ Branch 1 not taken.
|
2142 | else if(yoff>=1) |
| 18042 | { | ||
| 18043 | 2142 | moveOld2(up); | |
| 18044 | 2142 | } | |
| 18045 | 7410 | } | |
| 18046 | else | ||
| 18047 | { | ||
| 18048 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 6 times.
|
12 | if(yoff>=4) |
| 18049 | { | ||
| 18050 | 6 | moveOld2(down); | |
| 18051 | 6 | } | |
| 18052 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
|
6 | else if(yoff<4) |
| 18053 | { | ||
| 18054 | 6 | moveOld2(up); | |
| 18055 | 6 | } | |
| 18056 | } | ||
| 18057 | 7422 | } | |
| 18058 | else | ||
| 18059 | { | ||
| 18060 | 988810 | info = walkflag(x+15+int32_t(lsteps[x.getInt()&7]),y+(bigHitbox?0:8),1,right) | |
| 18061 | 494405 | || walkflag(x+15+int32_t(lsteps[x.getInt()&7]),y+(isSideViewHero()?0:8),1,right); | |
| 18062 | |||
| 18063 | 494405 | execute(info); | |
| 18064 | |||
| 18065 |
2/2✓ Branch 0 taken 181175 times.
✓ Branch 1 taken 313230 times.
|
494405 | if(!info.isUnwalkable()) |
| 18066 | { | ||
| 18067 | 313230 | moveOld2(right); | |
| 18068 | 313230 | return; | |
| 18069 | } | ||
| 18070 | |||
| 18071 |
4/4✓ Branch 0 taken 174556 times.
✓ Branch 1 taken 6619 times.
✓ Branch 2 taken 8011 times.
✓ Branch 3 taken 166545 times.
|
181175 | if (!getInput(btnUp, INPUT_DRUNK | INPUT_HERO_ACTION) && !getInput(btnDown, INPUT_DRUNK | INPUT_HERO_ACTION)) |
| 18072 | { | ||
| 18073 |
2/4✓ Branch 0 taken 166545 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 166545 times.
|
166545 | if(NO_GRIDLOCK) |
| 18074 | { | ||
| 18075 | ✗ | int32_t v1=bigHitbox?0:8; | |
| 18076 | ✗ | int32_t v2=bigHitbox?8:12; | |
| 18077 | |||
| 18078 | ✗ | if(!_walkflag(x+16,y+v1,1,get_standing_z_state())&& | |
| 18079 | ✗ | !_walkflag(x+16,y+v2,1,get_standing_z_state())&& | |
| 18080 | ✗ | _walkflag(x+16,y+15,1,get_standing_z_state())) | |
| 18081 | { | ||
| 18082 | ✗ | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(hero_scr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x+16,y+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?15:11))) | |
| 18083 | ✗ | sprite::move((zfix)0,(zfix)-1); | |
| 18084 | ✗ | } | |
| 18085 | ✗ | else if(_walkflag(x+16,y+v1,1,get_standing_z_state())&& | |
| 18086 | ✗ | !_walkflag(x+16,y+v2-1,1,get_standing_z_state())&& | |
| 18087 | ✗ | !_walkflag(x+16,y+15,1,get_standing_z_state())) | |
| 18088 | { | ||
| 18089 | ✗ | if(hclk || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || ((z>0||fakez>0) && !(hero_scr->flags2&fAIRCOMBOS)) || !checkdamagecombos(x+16,y+v1+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?0:4))) | |
| 18090 | ✗ | sprite::move((zfix)0,(zfix)1); | |
| 18091 | ✗ | } | |
| 18092 | else | ||
| 18093 | { | ||
| 18094 | ✗ | pushing=push+1; | |
| 18095 | } | ||
| 18096 | ✗ | } | |
| 18097 | 166545 | else pushing=push+1; | |
| 18098 | |||
| 18099 |
2/4✓ Branch 0 taken 166545 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 166545 times.
|
166545 | if(charging==0 && spins==0) |
| 18100 | { | ||
| 18101 | 166545 | dir=right; | |
| 18102 | 166545 | } | |
| 18103 | |||
| 18104 |
5/8✓ Branch 0 taken 164951 times.
✓ Branch 1 taken 1594 times.
✓ Branch 2 taken 164951 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 164951 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 164951 times.
|
166545 | if(action!=swimming && action != sideswimming && action != sideswimhit && action != sideswimattacking) |
| 18105 | { | ||
| 18106 | 164951 | herostep(); | |
| 18107 | 164951 | } | |
| 18108 | |||
| 18109 | 166545 | return; | |
| 18110 | } | ||
| 18111 | } | ||
| 18112 | 22052 | } | |
| 18113 | } | ||
| 18114 | 13296470 | } | |
| 18115 | |||
| 18116 | 6315115 | bool HeroClass::scr_walkflag(zfix_round zdx,zfix_round zdy,int d2,bool kb, int* canladder) | |
| 18117 | { | ||
| 18118 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6315115 times.
|
6315115 | if(walk_through_walls) return false; |
| 18119 | 6315115 | int dx = zdx.getRound(), dy = zdy.getRound(); | |
| 18120 | |||
| 18121 | 6315115 | bool solid = false; | |
| 18122 | |||
| 18123 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6315115 times.
|
6315115 | if(!is_autowalking()) |
| 18124 | { | ||
| 18125 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 6315115 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
6315115 | if(blockpath && dy<80) //Blocked top parts of rooms |
| 18126 | ✗ | return true; | |
| 18127 | |||
| 18128 |
4/4✓ Branch 0 taken 156307 times.
✓ Branch 1 taken 6158808 times.
✓ Branch 2 taken 61724 times.
✓ Branch 3 taken 94583 times.
|
6315115 | if(mblock2.active() && mblock2.hit(dx,dy,0,1,1,1)) |
| 18129 | 94583 | return true; | |
| 18130 | //collide_object handled in scr_canmove | ||
| 18131 | |||
| 18132 |
4/6✓ Branch 0 taken 683926 times.
✓ Branch 1 taken 5536606 times.
✓ Branch 2 taken 683926 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 6220532 times.
|
6244311 | if(isdungeon() && cur_screen<128 && dy<40 |
| 18133 |
5/6✓ Branch 0 taken 23779 times.
✓ Branch 1 taken 660147 times.
✓ Branch 2 taken 13692 times.
✓ Branch 3 taken 10087 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 13692 times.
|
683926 | && ((x<=112||x>=128) || _walkflag(120,24,2,get_standing_z_state())) |
| 18134 |
0/2✗ Branch 0 not taken.
✗ Branch 1 not taken.
|
23779 | && !get_qr(qr_FREEFORM)) |
| 18135 | ✗ | return true; //Old NES dungeon stuff | |
| 18136 | |||
| 18137 | 6220532 | solid = _walkflag(zdx,zdy,1,get_standing_z_state()); | |
| 18138 | |||
| 18139 |
4/6✓ Branch 0 taken 683926 times.
✓ Branch 1 taken 5536606 times.
✓ Branch 2 taken 683926 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 683926 times.
✗ Branch 5 not taken.
|
6220532 | if(isdungeon() && cur_screen<128 && !get_qr(qr_FREEFORM)) |
| 18140 | { | ||
| 18141 | ✗ | if(dx>=112&&dx<120&&dy<40&&dy>=32) | |
| 18142 | ✗ | solid=true; | |
| 18143 | |||
| 18144 | ✗ | if(dx>=136&&dx<144&&dy<40&&dy>=32) | |
| 18145 | ✗ | solid=true; | |
| 18146 | ✗ | } | |
| 18147 | 6220532 | } | |
| 18148 | |||
| 18149 |
3/4✓ Branch 0 taken 6183753 times.
✓ Branch 1 taken 36779 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6183753 times.
|
6220532 | if(action==swimming || IsSideSwim()) |
| 18150 | { | ||
| 18151 |
2/2✓ Branch 0 taken 13463 times.
✓ Branch 1 taken 23316 times.
|
36779 | if(!solid) |
| 18152 | { | ||
| 18153 | 23316 | int ls = 22; | |
| 18154 |
1/6✓ Branch 0 taken 23316 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
23316 | if((get_qr(qr_DROWN) && isSwimming()) || (!diagonalMovement) || get_qr(qr_NO_HOPPING)) |
| 18155 | 23316 | ls = 1; | |
| 18156 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 23316 times.
|
23316 | if(landswim < ls) |
| 18157 | { | ||
| 18158 |
2/4✓ Branch 0 taken 23316 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 23316 times.
|
23316 | if(dx<0||dy<0); |
| 18159 |
2/2✓ Branch 0 taken 20 times.
✓ Branch 1 taken 23296 times.
|
23316 | else if(dx>=256); |
| 18160 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 23278 times.
|
23296 | else if(dy>=176); |
| 18161 |
2/4✓ Branch 0 taken 23278 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 23278 times.
|
23278 | else if(get_qr(qr_DROWN) && !ilswim); |
| 18162 | ✗ | else if(iswaterex_z3(MAPCOMBO(dx,dy), -1, dx,dy)) //!DIMI: weird duplicate function here before. Was water bugged this whole time, or was it just an unneccessary duplicate? | |
| 18163 | ✗ | solid = false; | |
| 18164 | else | ||
| 18165 | ✗ | solid = true; | |
| 18166 | 23316 | } | |
| 18167 | 23316 | } | |
| 18168 | else | ||
| 18169 | { | ||
| 18170 | 13463 | int32_t wtrx = iswaterex_z3(MAPCOMBO(dx,dy), -1, dx,dy); | |
| 18171 | |||
| 18172 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 13463 times.
|
13463 | if(wtrx) |
| 18173 | ✗ | solid = false; | |
| 18174 | } | ||
| 18175 | 36779 | } | |
| 18176 |
2/2✓ Branch 0 taken 24284 times.
✓ Branch 1 taken 6159469 times.
|
6183753 | else if(ladderx+laddery) // ladder is being used |
| 18177 | { | ||
| 18178 |
2/2✓ Branch 0 taken 7974 times.
✓ Branch 1 taken 16310 times.
|
24284 | if (canladder) |
| 18179 | { | ||
| 18180 | 16310 | *canladder = 0; | |
| 18181 | 16310 | } | |
| 18182 | 24284 | int32_t lx = zfix(dx); | |
| 18183 | 24284 | int32_t ly = zfix(dy); | |
| 18184 | |||
| 18185 |
2/2✓ Branch 0 taken 13984 times.
✓ Branch 1 taken 10300 times.
|
24284 | if(ladderdir<=down) //vertical ladder |
| 18186 | { | ||
| 18187 |
2/2✓ Branch 0 taken 9291 times.
✓ Branch 1 taken 4693 times.
|
13984 | if(abs(ly-(laddery+8))<=8) // ly is between laddery (laddery+8-8) and laddery+16 (laddery+8+8) |
| 18188 | { | ||
| 18189 | 4693 | bool temp = false; | |
| 18190 | |||
| 18191 |
2/2✓ Branch 0 taken 3451 times.
✓ Branch 1 taken 1242 times.
|
4693 | if(!(abs(lx-(ladderx+8))<=8)) |
| 18192 | 1242 | temp = true; | |
| 18193 | |||
| 18194 |
2/2✓ Branch 0 taken 1242 times.
✓ Branch 1 taken 3451 times.
|
4693 | if(!temp) |
| 18195 | { | ||
| 18196 | 3451 | solid = false; | |
| 18197 | 3451 | } | |
| 18198 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 1242 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1242 | else if(current_item_power(itype_ladder)<2 && (d2==left || d2==right) && !isSideViewHero()) |
| 18199 | { | ||
| 18200 | ✗ | solid = true; | |
| 18201 | ✗ | } | |
| 18202 | 4693 | } | |
| 18203 | 13984 | } | |
| 18204 | else //horizontal ladder | ||
| 18205 | { | ||
| 18206 |
2/2✓ Branch 0 taken 5357 times.
✓ Branch 1 taken 4943 times.
|
10300 | if(abs(lx-(ladderx+8))<=8) |
| 18207 | { | ||
| 18208 |
2/2✓ Branch 0 taken 3182 times.
✓ Branch 1 taken 1761 times.
|
4943 | if(abs(ly-(laddery+(bigHitbox?8:12)))<=(bigHitbox?8:4)) |
| 18209 | { | ||
| 18210 | 3182 | solid = false; | |
| 18211 | 3182 | } | |
| 18212 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 1761 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1761 | else if(current_item_power(itype_ladder)<2 && (d2==up || d2==down)) |
| 18213 | { | ||
| 18214 | ✗ | solid = true; | |
| 18215 | ✗ | } | |
| 18216 |
4/4✓ Branch 0 taken 99 times.
✓ Branch 1 taken 1662 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 94 times.
|
1761 | else if((abs(ly-laddery+8)<=8) && d2<=down) |
| 18217 | { | ||
| 18218 | 94 | solid = false; | |
| 18219 | 94 | } | |
| 18220 | 4943 | } | |
| 18221 | } | ||
| 18222 | 24284 | } | |
| 18223 |
5/6✓ Branch 0 taken 3412538 times.
✓ Branch 1 taken 2746931 times.
✓ Branch 2 taken 3408931 times.
✓ Branch 3 taken 3607 times.
✓ Branch 4 taken 3408931 times.
✗ Branch 5 not taken.
|
6159469 | else if(solid || isSideViewHero() || get_qr(qr_DROWN)) |
| 18224 | { | ||
| 18225 | // see if it's a good spot for the ladder or for swimming | ||
| 18226 | 6159469 | bool unwalkablex = _walkflag(zdx,zdy,1,get_standing_z_state()); //will be used later for the ladder -DD | |
| 18227 | |||
| 18228 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6159469 times.
|
6159469 | if(get_qr(qr_DROWN)) |
| 18229 | { | ||
| 18230 | // Drowning changes the following attributes: | ||
| 18231 | // * Dangerous water is also walkable, so ignore the previous | ||
| 18232 | // definitions of unwalkablex. | ||
| 18233 | // * Instead, prevent the ladder from being used in the | ||
| 18234 | // one frame where Hero has landed on water before drowning. | ||
| 18235 | 6159469 | unwalkablex = !iswaterex_z3(MAPCOMBO(x+4,y+11), -1, x+4,y+11); | |
| 18236 | 6159469 | } | |
| 18237 | |||
| 18238 | // check if he can swim | ||
| 18239 |
4/6✓ Branch 0 taken 450189 times.
✓ Branch 1 taken 5709280 times.
✓ Branch 2 taken 450189 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 450189 times.
|
6159469 | if(current_item(itype_flippers) && z==0 && fakez==0) |
| 18240 | { | ||
| 18241 | 450189 | int32_t wtrx = iswaterex_z3(MAPCOMBO(dx,dy), -1, dx,dy); | |
| 18242 |
6/6✓ Branch 0 taken 450015 times.
✓ Branch 1 taken 174 times.
✓ Branch 2 taken 1210 times.
✓ Branch 3 taken 448805 times.
✓ Branch 4 taken 893 times.
✓ Branch 5 taken 317 times.
|
450189 | if (current_item(itype_flippers) >= combobuf[wtrx].attribytes[0] && (!(combobuf[wtrx].usrflags&cflag1) || (itemsbuf[current_item_id(itype_flippers)].flags & item_flag3))) //Don't swim if the water's required level is too high! -Dimi |
| 18243 | { | ||
| 18244 | //ladder ignores water combos that are now walkable thanks to flippers -DD | ||
| 18245 |
2/2✓ Branch 0 taken 4598 times.
✓ Branch 1 taken 445100 times.
|
449698 | unwalkablex = unwalkablex && (!wtrx); |
| 18246 | |||
| 18247 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 449698 times.
|
449698 | if(landswim >= 22) |
| 18248 | { | ||
| 18249 | ✗ | solid = false; | |
| 18250 | ✗ | } | |
| 18251 |
2/2✓ Branch 0 taken 445361 times.
✓ Branch 1 taken 4337 times.
|
449698 | else if(wtrx) |
| 18252 | { | ||
| 18253 |
2/2✓ Branch 0 taken 998 times.
✓ Branch 1 taken 3339 times.
|
4337 | if(dir==d2) |
| 18254 | { | ||
| 18255 | 3339 | ladderx = 0; | |
| 18256 | 3339 | laddery = 0; | |
| 18257 | 3339 | } | |
| 18258 | 4337 | } | |
| 18259 | 449698 | } | |
| 18260 | 450189 | } | |
| 18261 | |||
| 18262 | // check if he can use the ladder | ||
| 18263 | // "Allow Ladder Anywhere" is toggled by fLADDER | ||
| 18264 |
2/2✓ Branch 0 taken 5162566 times.
✓ Branch 1 taken 996903 times.
|
6159469 | if(can_deploy_ladder()) |
| 18265 | // laddersetup | ||
| 18266 | { | ||
| 18267 | // Check if there's water to use the ladder over | ||
| 18268 | 996903 | bool wtrx = (iswaterex_z3(MAPCOMBO(dx,dy), -1, dx,dy) != 0); | |
| 18269 | 996903 | int32_t ldrid = current_item_id(itype_ladder); | |
| 18270 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 996903 times.
|
996903 | bool ladderpits = ldrid > -1 && (itemsbuf[ldrid].flags&item_flag1); |
| 18271 | |||
| 18272 |
2/2✓ Branch 0 taken 2252 times.
✓ Branch 1 taken 994651 times.
|
996903 | if(wtrx) |
| 18273 | { | ||
| 18274 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2252 times.
|
2252 | if(isSideViewHero()) |
| 18275 | { | ||
| 18276 | ✗ | wtrx = !_walkflag(zdx, zdy+8, 1,get_standing_z_state()) && !_walkflag(dx, dy, 1,get_standing_z_state()) && dir!=down; | |
| 18277 | ✗ | } | |
| 18278 | // * walk on half-water using the ladder instead of using flippers. | ||
| 18279 | // * otherwise, walk on ladder(+hookshot) combos. | ||
| 18280 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 2252 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
2252 | else if((isstepable(MAPCOMBO(dx, dy)) || wtrx==true)) |
| 18281 | { | ||
| 18282 |
3/4✓ Branch 0 taken 2252 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1935 times.
✓ Branch 3 taken 317 times.
|
2252 | if(!get_qr(qr_OLD_210_WATER) && current_item(itype_flippers)) |
| 18283 | { | ||
| 18284 | //if Hero could swim on a tile instead of using the ladder, | ||
| 18285 | //refuse to use the ladder to step over that tile. -DD | ||
| 18286 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 317 times.
|
317 | wtrx = isstepable(MAPCOMBO(dx, dy)) && unwalkablex; |
| 18287 | 317 | } | |
| 18288 | 2252 | } | |
| 18289 | 2252 | } | |
| 18290 | else | ||
| 18291 | { | ||
| 18292 | // No water; check other things | ||
| 18293 | |||
| 18294 | //Check pits | ||
| 18295 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 994651 times.
|
994651 | if(ladderpits) |
| 18296 | { | ||
| 18297 | 994651 | int32_t pit_cmb = getpitfall(dx,dy); | |
| 18298 |
2/2✓ Branch 0 taken 992823 times.
✓ Branch 1 taken 1828 times.
|
994651 | wtrx = pit_cmb && (combobuf[pit_cmb].usrflags&cflag4); |
| 18299 | 994651 | } | |
| 18300 |
4/6✓ Branch 0 taken 994651 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1106 times.
✓ Branch 3 taken 993545 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1106 times.
|
994651 | if(!ladderpits || (!wtrx || isSideViewHero())) //If no pit, check ladder combos |
| 18301 | { | ||
| 18302 | 993545 | int32_t combo=combobuf[MAPCOMBO(dx, dy)].type; | |
| 18303 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 993545 times.
|
993545 | wtrx=(combo==cLADDERONLY || combo==cLADDERHOOKSHOT); |
| 18304 | 993545 | } | |
| 18305 | } | ||
| 18306 | |||
| 18307 |
2/2✓ Branch 0 taken 1993806 times.
✓ Branch 1 taken 996903 times.
|
2990709 | for (int32_t i = 1; i <= 2; ++i) |
| 18308 | { | ||
| 18309 |
2/2✓ Branch 0 taken 9111 times.
✓ Branch 1 taken 1984695 times.
|
1993806 | if (get_scr_layer_valid(current_screen, i)) |
| 18310 | { | ||
| 18311 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1984695 times.
|
1984695 | if (get_qr(qr_OLD_BRIDGE_COMBOS)) |
| 18312 | { | ||
| 18313 | ✗ | if (combobuf[MAPCOMBO2(i-1,dx,dy)].type == cBRIDGE && !_walkflag_layer(dx,dy)) wtrx = false; | |
| 18314 | ✗ | } | |
| 18315 | else | ||
| 18316 | { | ||
| 18317 |
3/4✓ Branch 0 taken 630 times.
✓ Branch 1 taken 1984065 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 630 times.
|
1984695 | if (combobuf[MAPCOMBO2(i-1,dx,dy)].type == cBRIDGE && _effectflag_layer(dx,dy)) wtrx = false; |
| 18318 | } | ||
| 18319 | 1984695 | } | |
| 18320 | 1993806 | } | |
| 18321 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 996903 times.
|
996903 | bool walkwater = (get_qr(qr_DROWN) && !iswaterex_z3(MAPCOMBO(dx,dy), -1, dx,dy)); |
| 18322 | |||
| 18323 |
4/4✓ Branch 0 taken 993556 times.
✓ Branch 1 taken 3347 times.
✓ Branch 2 taken 692326 times.
✓ Branch 3 taken 301230 times.
|
996903 | if (!wtrx && solid) |
| 18324 | { | ||
| 18325 |
2/2✓ Branch 0 taken 229228 times.
✓ Branch 1 taken 72002 times.
|
301230 | if (canladder) |
| 18326 | { | ||
| 18327 | 72002 | *canladder = 0; | |
| 18328 | 72002 | } | |
| 18329 | 301230 | } | |
| 18330 | |||
| 18331 |
2/2✓ Branch 0 taken 227245 times.
✓ Branch 1 taken 769658 times.
|
996903 | if(d2==dir) |
| 18332 | { | ||
| 18333 | 769658 | int32_t c = walkwater ? 0:8; | |
| 18334 | 769658 | int32_t b = walkwater ? 8:0; | |
| 18335 | |||
| 18336 |
2/2✓ Branch 0 taken 314392 times.
✓ Branch 1 taken 455266 times.
|
769658 | if(d2>=left) |
| 18337 | { | ||
| 18338 |
2/2✓ Branch 0 taken 313079 times.
✓ Branch 1 taken 1313 times.
|
314392 | if (wtrx) |
| 18339 | { | ||
| 18340 | //If the difference between dy and y is small enough | ||
| 18341 | //this is apparently a really crappy corner shove check? | ||
| 18342 |
2/4✓ Branch 0 taken 1313 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1313 times.
|
1313 | if((replay_version_check(26)) || (abs((dy)-(int32_t(y+c)))<=(b))) |
| 18343 | { | ||
| 18344 | // Don't activate the ladder if it would be entirely | ||
| 18345 | // over water and Hero has the flippers. This isn't | ||
| 18346 | // a good way to do this, but it's too risky | ||
| 18347 | // to make big changes to this stuff. | ||
| 18348 | 1313 | bool deployLadder=true; | |
| 18349 | 1313 | int32_t lx=dx&0xF0; | |
| 18350 |
6/8✓ Branch 0 taken 197 times.
✓ Branch 1 taken 1116 times.
✓ Branch 2 taken 197 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 197 times.
✓ Branch 6 taken 1116 times.
✓ Branch 7 taken 197 times.
|
1313 | if(current_item(itype_flippers) && current_item(itype_flippers) >= combobuf[iswaterex_z3(MAPCOMBO(lx+8, y+8), -1, lx+8, y+8)].attribytes[0] && z==0 && fakez==0) |
| 18351 | { | ||
| 18352 |
4/4✓ Branch 0 taken 81 times.
✓ Branch 1 taken 116 times.
✓ Branch 2 taken 159 times.
✓ Branch 3 taken 38 times.
|
278 | if(iswaterex_z3(MAPCOMBO(lx, y), -1, lx, y) && |
| 18353 |
1/2✓ Branch 0 taken 81 times.
✗ Branch 1 not taken.
|
81 | iswaterex_z3(MAPCOMBO(lx+15, y), -1, lx+15, y) && |
| 18354 |
2/2✓ Branch 0 taken 43 times.
✓ Branch 1 taken 38 times.
|
81 | iswaterex_z3(MAPCOMBO(lx, y+15), -1, lx, y+15) && |
| 18355 | 38 | iswaterex_z3(MAPCOMBO(lx+15, y+15), -1, lx+15, y+15)) | |
| 18356 | 38 | deployLadder=false; | |
| 18357 | 197 | } | |
| 18358 |
2/2✓ Branch 0 taken 38 times.
✓ Branch 1 taken 1275 times.
|
1313 | if(deployLadder) |
| 18359 | { | ||
| 18360 |
1/2✓ Branch 0 taken 1275 times.
✗ Branch 1 not taken.
|
1275 | if (replay_version_check(26)) |
| 18361 | { | ||
| 18362 |
2/2✓ Branch 0 taken 61 times.
✓ Branch 1 taken 1214 times.
|
1275 | if (canladder) |
| 18363 | { | ||
| 18364 |
2/2✓ Branch 0 taken 224 times.
✓ Branch 1 taken 990 times.
|
1214 | if (*canladder == -1) *canladder = 1; |
| 18365 | 1214 | } | |
| 18366 | 1275 | } | |
| 18367 | else | ||
| 18368 | { | ||
| 18369 | ✗ | ladderx = dx&0xF0; | |
| 18370 | ✗ | laddery = y; | |
| 18371 | ✗ | ladderdir = left; | |
| 18372 | ✗ | ladderstart = d2; | |
| 18373 | ✗ | solid = laddery!=y.getInt(); | |
| 18374 | } | ||
| 18375 | 1275 | } | |
| 18376 | 1313 | } | |
| 18377 | 1313 | } | |
| 18378 | 314392 | } | |
| 18379 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 455266 times.
|
455266 | else if(d2<=down) |
| 18380 | { | ||
| 18381 |
2/2✓ Branch 0 taken 453770 times.
✓ Branch 1 taken 1496 times.
|
455266 | if (wtrx) |
| 18382 | { | ||
| 18383 | //Unsure if this actually needs a replay check but better safe than sorry? | ||
| 18384 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1496 times.
|
1496 | if (replay_version_check(26)) |
| 18385 | { | ||
| 18386 |
2/2✓ Branch 0 taken 108 times.
✓ Branch 1 taken 1388 times.
|
1496 | if (canladder) |
| 18387 | { | ||
| 18388 |
2/2✓ Branch 0 taken 405 times.
✓ Branch 1 taken 983 times.
|
1388 | if (*canladder == -1) *canladder = 1; |
| 18389 | 1388 | } | |
| 18390 | 1496 | } | |
| 18391 | // If the difference between dx and x is small enough | ||
| 18392 |
2/4✓ Branch 0 taken 1496 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1496 times.
✗ Branch 3 not taken.
|
1496 | if(!replay_version_check(26) && (abs((dx)-(int32_t(x+c)))<=(b))) |
| 18393 | { | ||
| 18394 | ✗ | ladderx = x; | |
| 18395 | ✗ | laddery = dy&0xF0; | |
| 18396 | ✗ | ladderdir = up; | |
| 18397 | ✗ | ladderstart = d2; | |
| 18398 | ✗ | solid = ladderx!=x.getInt(); | |
| 18399 | ✗ | } | |
| 18400 | 1496 | } | |
| 18401 | 455266 | } | |
| 18402 | 769658 | } | |
| 18403 | 996903 | } | |
| 18404 | 6159469 | } | |
| 18405 | |||
| 18406 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6220532 times.
|
6220532 | if (replay_version_check(26)) |
| 18407 | { | ||
| 18408 |
2/2✓ Branch 0 taken 4406900 times.
✓ Branch 1 taken 1813632 times.
|
6220532 | if (canladder) |
| 18409 | { | ||
| 18410 |
3/4✓ Branch 0 taken 1478683 times.
✓ Branch 1 taken 2928217 times.
✓ Branch 2 taken 1478683 times.
✗ Branch 3 not taken.
|
4406900 | if (solid && *canladder == 1) *canladder = 2; |
| 18411 | 4406900 | } | |
| 18412 | 6220532 | } | |
| 18413 | |||
| 18414 |
2/2✓ Branch 0 taken 3455505 times.
✓ Branch 1 taken 2765027 times.
|
6220532 | return solid && !is_autowalking(); |
| 18415 | 6315115 | } | |
| 18416 | |||
| 18417 | 2357067 | bool HeroClass::scr_canmove(zfix dx, zfix dy, bool kb, bool ign_sv, int* canladder) | |
| 18418 | { | ||
| 18419 |
2/2✓ Branch 0 taken 41 times.
✓ Branch 1 taken 2357026 times.
|
2357067 | if(walk_through_walls) return true; |
| 18420 |
3/4✓ Branch 0 taken 1147998 times.
✓ Branch 1 taken 1209028 times.
✓ Branch 2 taken 1147998 times.
✗ Branch 3 not taken.
|
2357026 | if(!(dx || dy)) return true; |
| 18421 | 2357026 | zfix bx = x, by = y+(bigHitbox?0:8); //left/top | |
| 18422 | 2357026 | zfix rx = x+15.9999_zf, ry = y+15.9999_zf; //right/bottom | |
| 18423 | 2357026 | zfix wid = 16, hei = bigHitbox ? 16 : 8; | |
| 18424 |
7/14✓ Branch 0 taken 2280555 times.
✓ Branch 1 taken 76471 times.
✓ Branch 2 taken 555815 times.
✓ Branch 3 taken 1724740 times.
✓ Branch 4 taken 130 times.
✓ Branch 5 taken 555685 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 130 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
|
2357026 | if(!ign_sv && dy < 0 && sideview_mode() && !getOnSideviewLadder() && action != sideswimming && action != sideswimhit && action != sideswimattacking) |
| 18425 | ✗ | return false; | |
| 18426 | |||
| 18427 | 2357026 | bool nosolid = true; | |
| 18428 | |||
| 18429 | 2357026 | bool ret = true; | |
| 18430 | |||
| 18431 |
3/4✓ Branch 0 taken 1209028 times.
✓ Branch 1 taken 1147998 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1209028 times.
|
2357026 | if(dx && !dy) |
| 18432 | { | ||
| 18433 |
2/2✓ Branch 0 taken 582488 times.
✓ Branch 1 taken 626540 times.
|
1209028 | if(dx < 0) |
| 18434 | { | ||
| 18435 | 582488 | zfix mx = bx+dx; | |
| 18436 |
2/2✓ Branch 0 taken 582488 times.
✓ Branch 1 taken 384898 times.
|
967386 | for(zfix ty = 0; by+ty < ry; ty += 8) |
| 18437 | { | ||
| 18438 |
2/2✓ Branch 0 taken 353001 times.
✓ Branch 1 taken 229487 times.
|
582488 | if(scr_walkflag(mx, by+ty, left, kb, canladder)) |
| 18439 | { | ||
| 18440 |
2/2✓ Branch 0 taken 31897 times.
✓ Branch 1 taken 197590 times.
|
229487 | if (canladder) ret = false; |
| 18441 | else | ||
| 18442 | { | ||
| 18443 | 197590 | return false; | |
| 18444 | } | ||
| 18445 | 31897 | } | |
| 18446 | 384898 | } | |
| 18447 |
2/2✓ Branch 0 taken 72837 times.
✓ Branch 1 taken 312061 times.
|
384898 | if(scr_walkflag(mx, ry, left, kb, canladder)) |
| 18448 | 72837 | return false; | |
| 18449 |
2/2✓ Branch 0 taken 306947 times.
✓ Branch 1 taken 5114 times.
|
312061 | if (!ret) return false; |
| 18450 |
2/4✓ Branch 0 taken 306947 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 306947 times.
✗ Branch 3 not taken.
|
306947 | if(nosolid && collide_object(bx+dx,by,-dx,hei,this)) |
| 18451 | ✗ | return false; | |
| 18452 | 306947 | } | |
| 18453 | else | ||
| 18454 | { | ||
| 18455 | 626540 | zfix mx = rx+dx; | |
| 18456 | 626540 | int lx = mx-hit_width+1; | |
| 18457 |
2/2✓ Branch 0 taken 626540 times.
✓ Branch 1 taken 415223 times.
|
1041763 | for(zfix ty = 0; by+ty < ry; ty += 8) |
| 18458 | { | ||
| 18459 |
2/2✓ Branch 0 taken 373588 times.
✓ Branch 1 taken 252952 times.
|
626540 | if(scr_walkflag(mx, by+ty, right, kb, canladder)) |
| 18460 | { | ||
| 18461 |
2/2✓ Branch 0 taken 41635 times.
✓ Branch 1 taken 211317 times.
|
252952 | if (canladder) ret = false; |
| 18462 | else | ||
| 18463 | { | ||
| 18464 | 211317 | return false; | |
| 18465 | } | ||
| 18466 | 41635 | } | |
| 18467 | 415223 | } | |
| 18468 |
2/2✓ Branch 0 taken 98642 times.
✓ Branch 1 taken 316581 times.
|
415223 | if(scr_walkflag(mx, ry, right, kb, canladder)) |
| 18469 | 98642 | return false; | |
| 18470 |
2/2✓ Branch 0 taken 307979 times.
✓ Branch 1 taken 8602 times.
|
316581 | if (!ret) return false; |
| 18471 |
2/4✓ Branch 0 taken 307979 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 307979 times.
✗ Branch 3 not taken.
|
307979 | if(nosolid && collide_object(bx+wid,by,dx,hei,this)) |
| 18472 | ✗ | return false; | |
| 18473 | } | ||
| 18474 | 614926 | } | |
| 18475 |
2/4✓ Branch 0 taken 1147998 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1147998 times.
|
1147998 | else if(dy && !dx) |
| 18476 | { | ||
| 18477 |
2/2✓ Branch 0 taken 566628 times.
✓ Branch 1 taken 581370 times.
|
1147998 | if(dy < 0) |
| 18478 | { | ||
| 18479 | 566628 | zfix my = by+dy; | |
| 18480 |
2/2✓ Branch 0 taken 964486 times.
✓ Branch 1 taken 364335 times.
|
1328821 | for(zfix tx = 0; bx+tx < rx; tx += 8) |
| 18481 | { | ||
| 18482 |
2/2✓ Branch 0 taken 632836 times.
✓ Branch 1 taken 331650 times.
|
964486 | if(scr_walkflag(bx+tx, my, up, kb, canladder)) |
| 18483 | { | ||
| 18484 |
2/2✓ Branch 0 taken 129357 times.
✓ Branch 1 taken 202293 times.
|
331650 | if (canladder) ret = false; |
| 18485 | else | ||
| 18486 | { | ||
| 18487 | 202293 | return false; | |
| 18488 | } | ||
| 18489 | 129357 | } | |
| 18490 | 762193 | } | |
| 18491 |
2/2✓ Branch 0 taken 103872 times.
✓ Branch 1 taken 260463 times.
|
364335 | if(scr_walkflag(rx, my, up, kb, canladder)) |
| 18492 | 103872 | return false; | |
| 18493 |
2/2✓ Branch 0 taken 242301 times.
✓ Branch 1 taken 18162 times.
|
260463 | if (!ret) return false; |
| 18494 |
2/4✓ Branch 0 taken 242301 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 242301 times.
✗ Branch 3 not taken.
|
242301 | if(nosolid && collide_object(bx,by+dy,wid,-dy,this)) |
| 18495 | ✗ | return false; | |
| 18496 | 242301 | } | |
| 18497 | else | ||
| 18498 | { | ||
| 18499 | 581370 | zfix my = ry+dy; | |
| 18500 | 581370 | int ly = my-hit_height+1; | |
| 18501 |
2/2✓ Branch 0 taken 951996 times.
✓ Branch 1 taken 331016 times.
|
1283012 | for(zfix tx = 0; bx+tx < rx; tx += 8) |
| 18502 | { | ||
| 18503 |
2/2✓ Branch 0 taken 642226 times.
✓ Branch 1 taken 309770 times.
|
951996 | if(scr_walkflag(bx+tx, my, down, kb, canladder)) |
| 18504 | { | ||
| 18505 |
2/2✓ Branch 0 taken 59416 times.
✓ Branch 1 taken 250354 times.
|
309770 | if (canladder) ret = false; |
| 18506 | else | ||
| 18507 | { | ||
| 18508 | 250354 | return false; | |
| 18509 | } | ||
| 18510 | 59416 | } | |
| 18511 | 701642 | } | |
| 18512 |
2/2✓ Branch 0 taken 85749 times.
✓ Branch 1 taken 245267 times.
|
331016 | if(scr_walkflag(rx, my, down, kb, canladder)) |
| 18513 | 85749 | return false; | |
| 18514 |
2/2✓ Branch 0 taken 236446 times.
✓ Branch 1 taken 8821 times.
|
245267 | if (!ret) return false; |
| 18515 |
2/4✓ Branch 0 taken 236446 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 236446 times.
|
236446 | if(nosolid && collide_object(bx,by+hei,wid,dy,this)) |
| 18516 | ✗ | return false; | |
| 18517 | } | ||
| 18518 | 478747 | } | |
| 18519 | else //! Untested, and currently unused. | ||
| 18520 | { | ||
| 18521 | ✗ | return scr_canmove(dx, 0, kb, ign_sv) && scr_canmove(dy, 0, kb, ign_sv); | |
| 18522 | } | ||
| 18523 | 1093673 | return ret; | |
| 18524 | 2357067 | } | |
| 18525 | 444360 | bool handle_movestate(std::function<bool()> proc) | |
| 18526 | { | ||
| 18527 | 444360 | zfix ox = Hero.x, oy = Hero.y; | |
| 18528 | 444360 | auto oladderx = Hero.ladderx; | |
| 18529 | 444360 | auto oladdery = Hero.laddery; | |
| 18530 | 444360 | auto oladderdir = Hero.ladderdir; | |
| 18531 | 444360 | auto oladderstart = Hero.ladderstart; | |
| 18532 | |||
| 18533 | 444360 | bool ret = proc(); | |
| 18534 | |||
| 18535 | 444360 | Hero.x = ox; | |
| 18536 | 444360 | Hero.y = oy; | |
| 18537 | 444360 | Hero.ladderx = oladderx; | |
| 18538 | 444360 | Hero.laddery = oladdery; | |
| 18539 | 444360 | Hero.ladderdir = oladderdir; | |
| 18540 | 444360 | Hero.ladderstart = oladderstart; | |
| 18541 | |||
| 18542 | 444360 | return ret; | |
| 18543 | } | ||
| 18544 | |||
| 18545 | 70 | zfix handle_movestate_zfix(std::function<zfix()> proc) | |
| 18546 | { | ||
| 18547 | 70 | zfix ox = Hero.x, oy = Hero.y; | |
| 18548 | 70 | auto oladderx = Hero.ladderx; | |
| 18549 | 70 | auto oladdery = Hero.laddery; | |
| 18550 | 70 | auto oladderdir = Hero.ladderdir; | |
| 18551 | 70 | auto oladderstart = Hero.ladderstart; | |
| 18552 | |||
| 18553 | 70 | zfix ret = proc(); | |
| 18554 | |||
| 18555 | 70 | Hero.x = ox; | |
| 18556 | 70 | Hero.y = oy; | |
| 18557 | 70 | Hero.ladderx = oladderx; | |
| 18558 | 70 | Hero.laddery = oladdery; | |
| 18559 | 70 | Hero.ladderdir = oladderdir; | |
| 18560 | 70 | Hero.ladderstart = oladderstart; | |
| 18561 | |||
| 18562 | 70 | return ret; | |
| 18563 | } | ||
| 18564 | |||
| 18565 | 58670 | optional<zfix> HeroClass::get_solid_coord(zfix tx, zfix ty, byte dir, byte mdir, bool kb, zfix earlyterm, bool doladder) | |
| 18566 | { | ||
| 18567 | 58670 | zfix tmp; | |
| 18568 |
4/5✓ Branch 0 taken 5037 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9976 times.
✓ Branch 3 taken 23023 times.
✓ Branch 4 taken 20634 times.
|
58670 | switch(dir) |
| 18569 | ✗ | { | |
| 18570 | default: | ||
| 18571 | case up: | ||
| 18572 |
2/4✓ Branch 0 taken 5037 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5037 times.
✗ Branch 3 not taken.
|
91713 | tmp = binary_search_zfix(ty, earlyterm, [&](zfix ty, zfix& retval) |
| 18573 | { | ||
| 18574 | 86676 | int laddercheck = -1; | |
| 18575 |
2/2✓ Branch 0 taken 42394 times.
✓ Branch 1 taken 44282 times.
|
86676 | if(!scr_walkflag(tx,ty,mdir,kb, &laddercheck)) |
| 18576 | { | ||
| 18577 | 42394 | retval = ty; | |
| 18578 | 42394 | return BSEARCH_CONTINUE_UP; | |
| 18579 | } | ||
| 18580 |
2/4✓ Branch 0 taken 44282 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 44282 times.
|
44282 | else if(doladder && laddercheck > 0) |
| 18581 | { | ||
| 18582 | ✗ | retval = ty; | |
| 18583 | ✗ | return BSEARCH_CONTINUE_UP; | |
| 18584 | } | ||
| 18585 | 44282 | else return BSEARCH_CONTINUE_DOWN; | |
| 18586 |
1/2✓ Branch 0 taken 5037 times.
✗ Branch 1 not taken.
|
91713 | }, -999); |
| 18587 |
2/2✓ Branch 0 taken 546 times.
✓ Branch 1 taken 4491 times.
|
5037 | if(tmp > -999) |
| 18588 | 4491 | tmp -= 15.9999_zf; | |
| 18589 | 5037 | break; | |
| 18590 | case down: | ||
| 18591 |
2/4✓ Branch 0 taken 9976 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9976 times.
✗ Branch 3 not taken.
|
184281 | tmp = binary_search_zfix(ty, earlyterm, [&](zfix ty, zfix& retval) |
| 18592 | { | ||
| 18593 | 174305 | int laddercheck = -1; | |
| 18594 |
2/2✓ Branch 0 taken 72917 times.
✓ Branch 1 taken 101388 times.
|
174305 | if(!scr_walkflag(tx,ty,mdir,kb, &laddercheck)) |
| 18595 | { | ||
| 18596 | 72917 | retval = ty; | |
| 18597 | 72917 | return BSEARCH_CONTINUE_DOWN; | |
| 18598 | } | ||
| 18599 |
2/4✓ Branch 0 taken 101388 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 101388 times.
|
101388 | else if(doladder && laddercheck > 0) |
| 18600 | { | ||
| 18601 | ✗ | retval = ty; | |
| 18602 | ✗ | return BSEARCH_CONTINUE_DOWN; | |
| 18603 | } | ||
| 18604 | 101388 | else return BSEARCH_CONTINUE_UP; | |
| 18605 |
1/2✓ Branch 0 taken 9976 times.
✗ Branch 1 not taken.
|
184281 | }, -999); |
| 18606 |
2/2✓ Branch 0 taken 549 times.
✓ Branch 1 taken 9427 times.
|
9976 | if(tmp > -999) |
| 18607 | 9427 | tmp -= (bigHitbox?0:8); | |
| 18608 | 9976 | break; | |
| 18609 | case left: | ||
| 18610 |
2/4✓ Branch 0 taken 23023 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 23023 times.
✗ Branch 3 not taken.
|
429102 | tmp = binary_search_zfix(tx, earlyterm, [&](zfix tx, zfix& retval) |
| 18611 | { | ||
| 18612 | 406079 | int laddercheck = -1; | |
| 18613 |
2/2✓ Branch 0 taken 58449 times.
✓ Branch 1 taken 347630 times.
|
406079 | if(!scr_walkflag(tx,ty,mdir,kb, &laddercheck)) |
| 18614 | { | ||
| 18615 | 58449 | retval = tx; | |
| 18616 | 58449 | return BSEARCH_CONTINUE_UP; | |
| 18617 | } | ||
| 18618 |
2/4✓ Branch 0 taken 347630 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 347630 times.
|
347630 | else if(doladder && laddercheck > 0) |
| 18619 | { | ||
| 18620 | ✗ | retval = tx; | |
| 18621 | ✗ | return BSEARCH_CONTINUE_UP; | |
| 18622 | } | ||
| 18623 | 347630 | else return BSEARCH_CONTINUE_DOWN; | |
| 18624 |
1/2✓ Branch 0 taken 23023 times.
✗ Branch 1 not taken.
|
429102 | }, -999); |
| 18625 |
2/2✓ Branch 0 taken 16619 times.
✓ Branch 1 taken 6404 times.
|
23023 | if(tmp > -999) |
| 18626 | 6404 | tmp -= 15.9999_zf; | |
| 18627 | 23023 | break; | |
| 18628 | case right: | ||
| 18629 |
2/4✓ Branch 0 taken 20634 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 20634 times.
✗ Branch 3 not taken.
|
385931 | tmp = binary_search_zfix(tx, earlyterm, [&](zfix tx, zfix& retval) |
| 18630 | { | ||
| 18631 | 365297 | int laddercheck = -1; | |
| 18632 |
2/2✓ Branch 0 taken 46891 times.
✓ Branch 1 taken 318406 times.
|
365297 | if(!scr_walkflag(tx,ty,mdir,kb, &laddercheck)) |
| 18633 | { | ||
| 18634 | 46891 | retval = tx; | |
| 18635 | 46891 | return BSEARCH_CONTINUE_DOWN; | |
| 18636 | } | ||
| 18637 |
2/4✓ Branch 0 taken 318406 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 318406 times.
|
318406 | else if(doladder && laddercheck > 0) |
| 18638 | { | ||
| 18639 | ✗ | retval = tx; | |
| 18640 | ✗ | return BSEARCH_CONTINUE_DOWN; | |
| 18641 | } | ||
| 18642 | 318406 | else return BSEARCH_CONTINUE_UP; | |
| 18643 |
1/2✓ Branch 0 taken 20634 times.
✗ Branch 1 not taken.
|
385931 | }, -999); |
| 18644 | 20634 | break; | |
| 18645 | } | ||
| 18646 |
2/2✓ Branch 0 taken 32867 times.
✓ Branch 1 taken 25803 times.
|
58670 | if(tmp > -999) |
| 18647 | { | ||
| 18648 | 25803 | zfix tx2(x), ty2(y); | |
| 18649 | 25803 | zfix dx, dy; | |
| 18650 |
4/5✓ Branch 0 taken 4491 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6404 times.
✓ Branch 3 taken 5481 times.
✓ Branch 4 taken 9427 times.
|
25803 | switch(dir) |
| 18651 | { | ||
| 18652 | case left: | ||
| 18653 | 6404 | tx2 = tmp; | |
| 18654 | 6404 | break; | |
| 18655 | case right: | ||
| 18656 | 5481 | tx2 = tmp; | |
| 18657 | 5481 | break; | |
| 18658 | default: | ||
| 18659 | case up: | ||
| 18660 | 4491 | ty2 = tmp; | |
| 18661 | 4491 | break; | |
| 18662 | case down: | ||
| 18663 | 9427 | ty2 = tmp; | |
| 18664 | 9427 | break; | |
| 18665 | } | ||
| 18666 |
4/5✓ Branch 0 taken 5887 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4593 times.
✓ Branch 3 taken 9325 times.
✓ Branch 4 taken 5998 times.
|
25803 | switch(mdir) |
| 18667 | { | ||
| 18668 | case left: | ||
| 18669 | 4593 | dx = -0.0001_zf; | |
| 18670 | 4593 | break; | |
| 18671 | case right: | ||
| 18672 | 9325 | dx = 0.0001_zf; | |
| 18673 | 9325 | break; | |
| 18674 | default: | ||
| 18675 | case up: | ||
| 18676 | 5887 | dy = -0.0001_zf; | |
| 18677 | 5887 | break; | |
| 18678 | case down: | ||
| 18679 | 5998 | dy = 0.0001_zf; | |
| 18680 | 5998 | break; | |
| 18681 | } | ||
| 18682 | 25803 | zfix oldx(x), oldy(y); | |
| 18683 | 25803 | x = tx2; | |
| 18684 | 25803 | y = ty2; | |
| 18685 | 25803 | int laddercheck = -1; | |
| 18686 | 25803 | bool valid = scr_canmove(dx, dy, kb, true, &laddercheck); | |
| 18687 |
2/2✓ Branch 0 taken 25784 times.
✓ Branch 1 taken 19 times.
|
25803 | if (laddercheck > 0) valid = true; |
| 18688 | 25803 | x = oldx; | |
| 18689 | 25803 | y = oldy; | |
| 18690 |
2/2✓ Branch 0 taken 25752 times.
✓ Branch 1 taken 51 times.
|
25803 | if(valid) |
| 18691 | 25752 | return tmp; | |
| 18692 | 51 | } | |
| 18693 | 32918 | return std::nullopt; | |
| 18694 | 58670 | } | |
| 18695 | |||
| 18696 | 1069390 | bool HeroClass::movexy(zfix dx, zfix dy, bool kb, bool ign_sv, bool shove, bool earlyret) | |
| 18697 | { | ||
| 18698 | 1069390 | bool ret = true; | |
| 18699 | 1069390 | int ladderstuff = -1; | |
| 18700 |
8/10✓ Branch 0 taken 1042731 times.
✓ Branch 1 taken 26659 times.
✓ Branch 2 taken 761 times.
✓ Branch 3 taken 1041970 times.
✓ Branch 4 taken 559 times.
✓ Branch 5 taken 202 times.
✓ Branch 6 taken 559 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 559 times.
|
1069390 | bool sv = !ign_sv && sideview_mode() && !getOnSideviewLadder() && action != sideswimming && action != sideswimhit && action != sideswimattacking; |
| 18701 |
2/2✓ Branch 0 taken 1068831 times.
✓ Branch 1 taken 559 times.
|
1069390 | if(sv) |
| 18702 | 559 | dy = 0; | |
| 18703 |
4/4✓ Branch 0 taken 663910 times.
✓ Branch 1 taken 405480 times.
✓ Branch 2 taken 507992 times.
✓ Branch 3 taken 155918 times.
|
1069390 | if(dx && dy) |
| 18704 | 155918 | shove = false; | |
| 18705 | 1069390 | bool checkladder = dy < 0; | |
| 18706 | 2144462 | auto check_drown_fall = [&]() | |
| 18707 | { | ||
| 18708 |
1/2✓ Branch 0 taken 1075072 times.
✗ Branch 1 not taken.
|
1075072 | if (replay_compat_pitslide_bug()) |
| 18709 | 1075072 | return false; | |
| 18710 | ✗ | if (!ladderx && !laddery) | |
| 18711 | { | ||
| 18712 | ✗ | if (earlyret) // no side effects | |
| 18713 | { | ||
| 18714 | ✗ | if (check_pitslide() == -2 || onWater(true)) | |
| 18715 | ✗ | return true; | |
| 18716 | ✗ | } | |
| 18717 | else | ||
| 18718 | { | ||
| 18719 | ✗ | if (pitfall() || try_drown()) | |
| 18720 | ✗ | return true; // falling/drowning ends the movement instantly | |
| 18721 | } | ||
| 18722 | ✗ | } | |
| 18723 | ✗ | return false; | |
| 18724 | 1075072 | }; | |
| 18725 | |||
| 18726 | 1069390 | const int scl = 2; | |
| 18727 |
4/4✓ Branch 0 taken 174 times.
✓ Branch 1 taken 1069446 times.
✓ Branch 2 taken 230 times.
✓ Branch 3 taken 1069390 times.
|
1069620 | while(abs(dx) > scl || abs(dy) > scl) |
| 18728 | { | ||
| 18729 |
2/2✓ Branch 0 taken 174 times.
✓ Branch 1 taken 56 times.
|
230 | if(abs(dx) > abs(dy)) |
| 18730 | { | ||
| 18731 | 174 | int32_t tdx = dx.sign() * scl; | |
| 18732 |
2/2✓ Branch 0 taken 173 times.
✓ Branch 1 taken 1 times.
|
174 | if(movexy(tdx, 0, kb, ign_sv, shove, earlyret)) |
| 18733 | 173 | dx -= tdx; | |
| 18734 | else | ||
| 18735 | { | ||
| 18736 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | if(earlyret) return false; |
| 18737 | 1 | dx = tdx; | |
| 18738 | 1 | ret = false; | |
| 18739 | } | ||
| 18740 | 174 | } | |
| 18741 | else | ||
| 18742 | { | ||
| 18743 | 56 | int32_t tdy = dy.sign() * scl; | |
| 18744 |
1/2✓ Branch 0 taken 56 times.
✗ Branch 1 not taken.
|
56 | if(movexy(0, tdy, kb, ign_sv, shove, earlyret)) |
| 18745 | 56 | dy -= tdy; | |
| 18746 | else | ||
| 18747 | { | ||
| 18748 | ✗ | if(earlyret) return false; | |
| 18749 | ✗ | dy = tdy; | |
| 18750 | ✗ | ret = false; | |
| 18751 | } | ||
| 18752 | } | ||
| 18753 |
1/2✓ Branch 0 taken 230 times.
✗ Branch 1 not taken.
|
230 | if(check_drown_fall()) return false; |
| 18754 | } | ||
| 18755 | |||
| 18756 |
10/12✓ Branch 0 taken 624890 times.
✓ Branch 1 taken 444500 times.
✓ Branch 2 taken 371338 times.
✓ Branch 3 taken 253552 times.
✓ Branch 4 taken 371338 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 15737 times.
✓ Branch 7 taken 355601 times.
✓ Branch 8 taken 354355 times.
✓ Branch 9 taken 1246 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 354355 times.
|
1069390 | bool skipdmg = earlyret || get_qr(qr_LENIENT_SOLID_DAMAGE) || get_qr(qr_NOSOLIDDAMAGECOMBOS) || hclk || ((z>0||fakez>0) && !(hero_scr->flags2&fAIRCOMBOS)); |
| 18757 |
2/2✓ Branch 0 taken 405480 times.
✓ Branch 1 taken 663910 times.
|
1069390 | if(dx) |
| 18758 | { | ||
| 18759 |
2/2✓ Branch 0 taken 580383 times.
✓ Branch 1 taken 83527 times.
|
663910 | if(scr_canmove(dx, 0, kb, ign_sv, &ladderstuff)) |
| 18760 | { | ||
| 18761 |
2/2✓ Branch 0 taken 579458 times.
✓ Branch 1 taken 925 times.
|
580383 | if (ladderstuff == 1) |
| 18762 | { | ||
| 18763 |
2/2✓ Branch 0 taken 422 times.
✓ Branch 1 taken 503 times.
|
925 | zfix tx = (dx < 0 ? (x+dx) : (x+8+dx)); |
| 18764 | 925 | zfix tx2 = (dx < 0 ? 15 : 0); | |
| 18765 | 925 | zfix tx3 = (dx < 0 ? -8 : 8); | |
| 18766 | 925 | ladderx = TRUNCATE_HALF_TILE(tx.getInt()); | |
| 18767 | 925 | laddery = y.getTrunc(); | |
| 18768 |
4/4✓ Branch 0 taken 898 times.
✓ Branch 1 taken 27 times.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 919 times.
|
1030 | if (((iswaterex_z3(MAPCOMBO(ladderx+tx2,y+9), -1, ladderx+tx2,y+9) != 0) || getpitfall(ladderx+tx2,y+9)) |
| 18769 |
4/4✓ Branch 0 taken 78 times.
✓ Branch 1 taken 820 times.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 101 times.
|
925 | && ((iswaterex_z3(MAPCOMBO(ladderx+tx2,y+15), -1, ladderx+tx2,y+15) != 0) || getpitfall(ladderx+tx2,y+15))) |
| 18770 | { | ||
| 18771 | 6 | ladderdir = left; | |
| 18772 | 6 | ladderstart = dir; | |
| 18773 | 6 | } | |
| 18774 |
4/4✓ Branch 0 taken 744 times.
✓ Branch 1 taken 175 times.
✓ Branch 2 taken 199 times.
✓ Branch 3 taken 720 times.
|
1226 | else if (((iswaterex_z3(MAPCOMBO(ladderx+tx2+tx3,y+9), -1, ladderx+tx2+tx3,y+9) != 0) || getpitfall(ladderx+tx2+tx3,y+9)) |
| 18775 |
4/4✓ Branch 0 taken 132 times.
✓ Branch 1 taken 612 times.
✓ Branch 2 taken 147 times.
✓ Branch 3 taken 160 times.
|
919 | && ((iswaterex_z3(MAPCOMBO(ladderx+tx2+tx3,y+15), -1, ladderx+tx2+tx3,y+15) != 0) || getpitfall(ladderx+tx2+tx3,y+15))) |
| 18776 | { | ||
| 18777 | 199 | ladderx = TRUNCATE_HALF_TILE(tx.getInt()+tx3.getInt()); | |
| 18778 | 199 | ladderdir = left; | |
| 18779 | 199 | ladderstart = dir; | |
| 18780 | 199 | } | |
| 18781 | else | ||
| 18782 | { | ||
| 18783 | 720 | ladderx = 0; | |
| 18784 | 720 | laddery = 0; | |
| 18785 | } | ||
| 18786 | 925 | } | |
| 18787 |
2/2✓ Branch 0 taken 579458 times.
✓ Branch 1 taken 925 times.
|
580383 | if (ladderstuff > 0) ladderstuff = 0; |
| 18788 | 580383 | x += dx; | |
| 18789 | 580383 | } | |
| 18790 | else | ||
| 18791 | { | ||
| 18792 | 83527 | bool stopped = true; | |
| 18793 | 83527 | bool shoved = false; | |
| 18794 |
2/2✓ Branch 0 taken 18284 times.
✓ Branch 1 taken 65243 times.
|
83527 | if(shove) |
| 18795 | { | ||
| 18796 |
2/2✓ Branch 0 taken 27666 times.
✓ Branch 1 taken 37577 times.
|
65243 | zfix tx = (dx < 0 ? (x-4) : (x+20)); |
| 18797 | 65243 | int v=bigHitbox?0:8; | |
| 18798 | 65243 | zfix ly = y+v; | |
| 18799 | 65243 | zfix ry = y+15.9999_zf; | |
| 18800 | 65243 | zfix ly2 = y+v+6; | |
| 18801 | 65243 | zfix ry2 = y+9.9999_zf; | |
| 18802 | 65243 | auto mdir = GET_XDIR(dx); | |
| 18803 | 65243 | int laddershove = -1; | |
| 18804 | 65243 | int ladderhit = 0; | |
| 18805 | 65243 | bool onladder = (ladderx + laddery); | |
| 18806 | 65243 | bool hit_top = scr_walkflag(tx,ly,mdir,false, &laddershove); | |
| 18807 |
2/2✓ Branch 0 taken 65240 times.
✓ Branch 1 taken 3 times.
|
65243 | if (laddershove > 0) |
| 18808 | { | ||
| 18809 | 3 | hit_top = false; | |
| 18810 | 3 | ladderhit += 1; | |
| 18811 | 3 | } | |
| 18812 | 65243 | laddershove = -1; | |
| 18813 | 65243 | bool hit_bottom = scr_walkflag(tx,ry,mdir,false, &laddershove); | |
| 18814 |
2/2✓ Branch 0 taken 65241 times.
✓ Branch 1 taken 2 times.
|
65243 | if (laddershove > 0) |
| 18815 | { | ||
| 18816 | 2 | hit_bottom = false; | |
| 18817 | 2 | ladderhit += 2; | |
| 18818 | 2 | } | |
| 18819 | 65243 | laddershove = -1; | |
| 18820 | 65243 | bool hit_top2 = scr_walkflag(tx,ly2,mdir,false); | |
| 18821 | 65243 | bool hit_bottom2 = scr_walkflag(tx,ry2,mdir,false); | |
| 18822 |
3/4✓ Branch 0 taken 5157 times.
✓ Branch 1 taken 60086 times.
✓ Branch 2 taken 5157 times.
✗ Branch 3 not taken.
|
65243 | if (!hit_top && ladderhit == 2) |
| 18823 | { | ||
| 18824 | ✗ | hit_bottom = true; | |
| 18825 | ✗ | } | |
| 18826 |
3/4✓ Branch 0 taken 10097 times.
✓ Branch 1 taken 55146 times.
✓ Branch 2 taken 10097 times.
✗ Branch 3 not taken.
|
65243 | if (!hit_bottom && ladderhit == 1) |
| 18827 | { | ||
| 18828 | ✗ | hit_top = true; | |
| 18829 | ✗ | } | |
| 18830 |
2/2✓ Branch 0 taken 50223 times.
✓ Branch 1 taken 15020 times.
|
65243 | if(hit_top!=hit_bottom) |
| 18831 | { | ||
| 18832 |
2/2✓ Branch 0 taken 5040 times.
✓ Branch 1 taken 9980 times.
|
15020 | if(hit_bottom) //shove up |
| 18833 | { | ||
| 18834 |
6/6✓ Branch 0 taken 6 times.
✓ Branch 1 taken 5034 times.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 3 times.
✓ Branch 4 taken 3 times.
✓ Branch 5 taken 3 times.
|
5040 | if (onladder && (ladderdir == left || ladderdir == right) && !hit_bottom2) |
| 18835 | { | ||
| 18836 | 3 | y -= 1_zf; | |
| 18837 | 3 | shoved = true; | |
| 18838 | 3 | } | |
| 18839 |
5/6✓ Branch 0 taken 4299 times.
✓ Branch 1 taken 738 times.
✓ Branch 2 taken 722 times.
✓ Branch 3 taken 16 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 5037 times.
|
5037 | else if(skipdmg || !checkdamagecombos(tx,get_qr(qr_SENSITIVE_SOLID_DAMAGE)?int32_t(y+15):(v+bigHitbox?11:4))) |
| 18840 | { | ||
| 18841 |
2/2✓ Branch 0 taken 550 times.
✓ Branch 1 taken 4487 times.
|
5037 | if(optional<zfix> ty = get_solid_coord(tx,ry,up,mdir,false,ry-shove_offset, (ladderhit != 2))) |
| 18842 | { | ||
| 18843 |
2/2✓ Branch 0 taken 906 times.
✓ Branch 1 taken 3581 times.
|
4487 | zfix dy = zc_max(-1_zf,*ty-y); |
| 18844 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4487 times.
|
4487 | if((shoved = dy)) |
| 18845 | 4487 | movexy(0, dy, kb, true, false, false); | |
| 18846 | 4487 | } | |
| 18847 | 5037 | } | |
| 18848 | 5040 | } | |
| 18849 | else //shove down | ||
| 18850 | { | ||
| 18851 |
6/6✓ Branch 0 taken 5 times.
✓ Branch 1 taken 9975 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 4 times.
✓ Branch 4 taken 1 times.
✓ Branch 5 taken 4 times.
|
9980 | if (onladder && (ladderdir == left || ladderdir == right) && !hit_top2) |
| 18852 | { | ||
| 18853 | 4 | y += 1_zf; | |
| 18854 | 4 | shoved = true; | |
| 18855 | 4 | } | |
| 18856 |
3/4✓ Branch 0 taken 670 times.
✓ Branch 1 taken 9306 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 670 times.
|
9976 | else if(skipdmg || !checkdamagecombos(tx,v+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?0:4))) |
| 18857 | { | ||
| 18858 |
2/2✓ Branch 0 taken 550 times.
✓ Branch 1 taken 9426 times.
|
9976 | if(optional<zfix> ty = get_solid_coord(tx,ly,down,mdir,false,ly+shove_offset, (ladderhit != 1))) |
| 18859 | { | ||
| 18860 |
2/2✓ Branch 0 taken 805 times.
✓ Branch 1 taken 8621 times.
|
9426 | zfix dy = zc_min(1_zf,*ty-y); |
| 18861 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9426 times.
|
9426 | if((shoved = dy)) |
| 18862 | 9426 | movexy(0, dy, kb, true, false, false); | |
| 18863 | 9426 | } | |
| 18864 | 9976 | } | |
| 18865 | } | ||
| 18866 | |||
| 18867 |
4/4✓ Branch 0 taken 13920 times.
✓ Branch 1 taken 1100 times.
✓ Branch 2 taken 12091 times.
✓ Branch 3 taken 1829 times.
|
15020 | if(shoved && scr_canmove(dx, 0, kb, ign_sv)) |
| 18868 | { | ||
| 18869 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1829 times.
|
1829 | if(check_drown_fall()) return false; |
| 18870 | 1829 | x += dx; | |
| 18871 | 1829 | stopped = false; | |
| 18872 | 1829 | } | |
| 18873 | 15020 | } | |
| 18874 | 65243 | } | |
| 18875 |
2/2✓ Branch 0 taken 1829 times.
✓ Branch 1 taken 81698 times.
|
83527 | if(stopped) |
| 18876 | { | ||
| 18877 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 81698 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
81698 | if (ladderstuff > 0 && !shoved) |
| 18878 | { | ||
| 18879 | ✗ | zfix tx = (dx < 0 ? (x-12) : (x+20)); | |
| 18880 | ✗ | ladderx = TRUNCATE_HALF_TILE(tx.getInt()); | |
| 18881 | ✗ | laddery = y.getTrunc(); | |
| 18882 | ✗ | ladderdir = left; | |
| 18883 | ✗ | ladderstart = dir; | |
| 18884 | ✗ | x += dx; | |
| 18885 | ✗ | ladderstuff = 0; | |
| 18886 | ✗ | } | |
| 18887 |
2/2✓ Branch 0 taken 48997 times.
✓ Branch 1 taken 32701 times.
|
81698 | else if(earlyret) |
| 18888 | { | ||
| 18889 | 48997 | ret = false; | |
| 18890 | 48997 | } | |
| 18891 | else | ||
| 18892 | { | ||
| 18893 | 32701 | ret = false; | |
| 18894 | 32701 | int xsign = dx.sign(); | |
| 18895 |
2/2✓ Branch 0 taken 30598 times.
✓ Branch 1 taken 2103 times.
|
32701 | if(abs(dx) > 1) |
| 18896 | { | ||
| 18897 |
2/2✓ Branch 0 taken 1614 times.
✓ Branch 1 taken 30598 times.
|
32212 | while(scr_canmove(xsign, 0, kb, ign_sv)) |
| 18898 | { | ||
| 18899 | 1614 | x += xsign; | |
| 18900 | 1614 | dx -= xsign; | |
| 18901 | } | ||
| 18902 | 30598 | } | |
| 18903 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32701 times.
|
32701 | if(dx) |
| 18904 | { | ||
| 18905 | 32701 | dx.doDecBound(0,-9999, 0,9999); | |
| 18906 |
3/6✓ Branch 0 taken 32701 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 32701 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 32701 times.
✗ Branch 5 not taken.
|
517780 | dx = binary_search_zfix(dx.decsign(), dx, [&](zfix val, zfix& retval){ |
| 18907 |
2/2✓ Branch 0 taken 17198 times.
✓ Branch 1 taken 467881 times.
|
485079 | if(scr_canmove(val, 0, kb, ign_sv)) |
| 18908 | { | ||
| 18909 | 17198 | retval = val; | |
| 18910 | 17198 | return BSEARCH_CONTINUE_AWAY0; | |
| 18911 | } | ||
| 18912 | 467881 | else return BSEARCH_CONTINUE_TOWARD0; | |
| 18913 | 485079 | }); | |
| 18914 | 32701 | x += dx; | |
| 18915 | 32701 | } | |
| 18916 | } | ||
| 18917 | 81698 | } | |
| 18918 | } | ||
| 18919 | 663910 | } | |
| 18920 | 1069390 | ladderstuff = -1; | |
| 18921 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1069390 times.
|
1069390 | if(check_drown_fall()) return false; |
| 18922 |
2/2✓ Branch 0 taken 508954 times.
✓ Branch 1 taken 560436 times.
|
1069390 | if(dy) |
| 18923 | { | ||
| 18924 |
2/2✓ Branch 0 taken 441255 times.
✓ Branch 1 taken 119181 times.
|
560436 | if(scr_canmove(0, dy, kb, ign_sv, &ladderstuff)) |
| 18925 | { | ||
| 18926 |
2/2✓ Branch 0 taken 440476 times.
✓ Branch 1 taken 779 times.
|
441255 | if (ladderstuff == 1) |
| 18927 | { | ||
| 18928 |
2/2✓ Branch 0 taken 472 times.
✓ Branch 1 taken 307 times.
|
779 | zfix ty = (dy < 0 ? (y+(bigHitbox?0:8)+dy) : (y+8+dy)); |
| 18929 | 779 | zfix ty2 = (dy < 0 ? 15 : 0); | |
| 18930 | 779 | zfix ty3 = (dy < 0 ? -8 : 8); | |
| 18931 | |||
| 18932 | 779 | ladderx = x.getTrunc(); | |
| 18933 | 779 | laddery = TRUNCATE_HALF_TILE(ty.getInt()); | |
| 18934 |
4/4✓ Branch 0 taken 773 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 774 times.
|
789 | if (((iswaterex_z3(MAPCOMBO(x+4,laddery+ty2), -1, x+4,laddery+ty2) != 0) || getpitfall(x+4,laddery+ty2)) |
| 18935 |
4/4✓ Branch 0 taken 4 times.
✓ Branch 1 taken 769 times.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 7 times.
|
779 | && ((iswaterex_z3(MAPCOMBO(x+11,laddery+ty2), -1, x+11,laddery+ty2) != 0) || getpitfall(x+11,laddery+ty2))) |
| 18936 | { | ||
| 18937 | 5 | ladderdir = up; | |
| 18938 | 5 | ladderstart = dir; | |
| 18939 | 5 | } | |
| 18940 |
4/4✓ Branch 0 taken 680 times.
✓ Branch 1 taken 94 times.
✓ Branch 2 taken 128 times.
✓ Branch 3 taken 646 times.
|
911 | else if (((iswaterex_z3(MAPCOMBO(x+4,laddery+ty2+ty3), -1, x+4,laddery+ty2+ty3) != 0) || getpitfall(x+4,laddery+ty2+ty3)) |
| 18941 |
4/4✓ Branch 0 taken 43 times.
✓ Branch 1 taken 637 times.
✓ Branch 2 taken 50 times.
✓ Branch 3 taken 87 times.
|
774 | && ((iswaterex_z3(MAPCOMBO(x+11,laddery+ty2+ty3), -1, x+11,laddery+ty2+ty3) != 0) || getpitfall(x+11,laddery+ty2+ty3))) |
| 18942 | { | ||
| 18943 | 128 | laddery = TRUNCATE_HALF_TILE(ty.getInt() + ty3.getInt()); | |
| 18944 | 128 | ladderdir = up; | |
| 18945 | 128 | ladderstart = dir; | |
| 18946 | 128 | } | |
| 18947 | else | ||
| 18948 | { | ||
| 18949 | 646 | ladderx = 0; | |
| 18950 | 646 | laddery = 0; | |
| 18951 | } | ||
| 18952 | 779 | } | |
| 18953 |
2/2✓ Branch 0 taken 440476 times.
✓ Branch 1 taken 779 times.
|
441255 | if (ladderstuff > 0) ladderstuff = 0; |
| 18954 | 441255 | y += dy; | |
| 18955 | 441255 | } | |
| 18956 | else | ||
| 18957 | { | ||
| 18958 | 119181 | bool stopped = true; | |
| 18959 | 119181 | bool shoved = false; | |
| 18960 |
2/2✓ Branch 0 taken 18980 times.
✓ Branch 1 taken 100201 times.
|
119181 | if(shove) |
| 18961 | { | ||
| 18962 |
2/2✓ Branch 0 taken 71098 times.
✓ Branch 1 taken 29103 times.
|
100201 | zfix ty = (dy < 0 ? (y+(bigHitbox?0:8)-4) : (y+20)); |
| 18963 | 100201 | zfix lx = x; | |
| 18964 | 100201 | zfix rx = x+15.9999_zf; | |
| 18965 | 100201 | zfix lx2 = x+6; | |
| 18966 | 100201 | zfix rx2 = x+9.9999_zf; | |
| 18967 | 100201 | auto mdir = GET_YDIR(dy); | |
| 18968 | 100201 | int laddershove = -1; | |
| 18969 | 100201 | int ladderhit = 0; | |
| 18970 | 100201 | bool onladder = (ladderx + laddery); | |
| 18971 | 100201 | bool hit_left = scr_walkflag(lx,ty,mdir,false, &laddershove); | |
| 18972 |
1/2✓ Branch 0 taken 100201 times.
✗ Branch 1 not taken.
|
100201 | if (laddershove > 0) |
| 18973 | { | ||
| 18974 | ✗ | hit_left = false; | |
| 18975 | ✗ | ladderhit += 1; | |
| 18976 | ✗ | } | |
| 18977 | 100201 | laddershove = -1; | |
| 18978 | 100201 | bool hit_right = scr_walkflag(rx,ty,mdir,false, &laddershove); | |
| 18979 |
2/2✓ Branch 0 taken 100167 times.
✓ Branch 1 taken 34 times.
|
100201 | if (laddershove > 0) |
| 18980 | { | ||
| 18981 | 34 | hit_right = false; | |
| 18982 | 34 | ladderhit += 2; | |
| 18983 | 34 | } | |
| 18984 | 100201 | bool hit_left2 = scr_walkflag(lx2,ty,mdir,false); | |
| 18985 | 100201 | bool hit_right2 = scr_walkflag(rx2,ty,mdir,false); | |
| 18986 | 100201 | laddershove = -1; | |
| 18987 |
3/4✓ Branch 0 taken 23275 times.
✓ Branch 1 taken 76926 times.
✓ Branch 2 taken 23275 times.
✗ Branch 3 not taken.
|
100201 | if (!hit_left && ladderhit == 2) |
| 18988 | { | ||
| 18989 | ✗ | hit_right = true; | |
| 18990 | ✗ | } | |
| 18991 |
3/4✓ Branch 0 taken 20881 times.
✓ Branch 1 taken 79320 times.
✓ Branch 2 taken 20881 times.
✗ Branch 3 not taken.
|
100201 | if (!hit_right && ladderhit == 1) |
| 18992 | { | ||
| 18993 | ✗ | hit_left = true; | |
| 18994 | ✗ | } | |
| 18995 |
2/2✓ Branch 0 taken 56395 times.
✓ Branch 1 taken 43806 times.
|
100201 | if(hit_left!=hit_right) |
| 18996 | { | ||
| 18997 |
2/2✓ Branch 0 taken 23100 times.
✓ Branch 1 taken 20706 times.
|
43806 | if(hit_right) //shove left |
| 18998 | { | ||
| 18999 |
5/6✓ Branch 0 taken 96 times.
✓ Branch 1 taken 23004 times.
✓ Branch 2 taken 76 times.
✓ Branch 3 taken 20 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 76 times.
|
23100 | if (onladder && ladderdir <= down && !hit_right2) |
| 19000 | { | ||
| 19001 | 76 | x -= 1_zf; | |
| 19002 | 76 | shoved = true; | |
| 19003 | 76 | } | |
| 19004 |
4/4✓ Branch 0 taken 20776 times.
✓ Branch 1 taken 2248 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 23023 times.
|
23024 | else if(skipdmg || !checkdamagecombos(x+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?15:11),ty)) |
| 19005 | { | ||
| 19006 |
2/2✓ Branch 0 taken 16619 times.
✓ Branch 1 taken 6404 times.
|
23023 | if(optional<zfix> tx = get_solid_coord(rx,ty,left,mdir,false,rx-shove_offset, (ladderhit != 2))) |
| 19007 | { | ||
| 19008 |
2/2✓ Branch 0 taken 1370 times.
✓ Branch 1 taken 5034 times.
|
6404 | zfix dx = zc_max(-1_zf,*tx-x); |
| 19009 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6404 times.
|
6404 | if((shoved = dx)) |
| 19010 | 6404 | movexy(dx, 0, kb, true, false, false); | |
| 19011 | 6404 | } | |
| 19012 | 23023 | } | |
| 19013 | 23100 | } | |
| 19014 | else //shove right | ||
| 19015 | { | ||
| 19016 |
6/6✓ Branch 0 taken 80 times.
✓ Branch 1 taken 20626 times.
✓ Branch 2 taken 75 times.
✓ Branch 3 taken 5 times.
✓ Branch 4 taken 3 times.
✓ Branch 5 taken 72 times.
|
20706 | if (onladder && ladderdir <= down && !hit_left2) |
| 19017 | { | ||
| 19018 | 72 | x += 1_zf; | |
| 19019 | 72 | shoved = true; | |
| 19020 | 72 | } | |
| 19021 |
3/4✓ Branch 0 taken 18450 times.
✓ Branch 1 taken 2184 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 20634 times.
|
20634 | else if(skipdmg || !checkdamagecombos(x+(get_qr(qr_SENSITIVE_SOLID_DAMAGE)?0:4),ty)) |
| 19022 | { | ||
| 19023 |
2/2✓ Branch 0 taken 15199 times.
✓ Branch 1 taken 5435 times.
|
20634 | if(optional<zfix> tx = get_solid_coord(lx,ty,right,mdir,false,lx+shove_offset, (ladderhit != 1))) |
| 19024 | { | ||
| 19025 |
2/2✓ Branch 0 taken 3381 times.
✓ Branch 1 taken 2054 times.
|
5435 | zfix dx = zc_min(1_zf,*tx-x); |
| 19026 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5435 times.
|
5435 | if((shoved = dx)) |
| 19027 | 5435 | movexy(dx, 0, kb, true, false, false); | |
| 19028 | 5435 | } | |
| 19029 | 20634 | } | |
| 19030 | } | ||
| 19031 | |||
| 19032 |
4/4✓ Branch 0 taken 11987 times.
✓ Branch 1 taken 31819 times.
✓ Branch 2 taken 8364 times.
✓ Branch 3 taken 3623 times.
|
43806 | if(shoved && scr_canmove(0, dy, kb, ign_sv)) |
| 19033 | { | ||
| 19034 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3623 times.
|
3623 | if(check_drown_fall()) return false; |
| 19035 | 3623 | y += dy; | |
| 19036 | 3623 | stopped = false; | |
| 19037 | 3623 | } | |
| 19038 | 43806 | } | |
| 19039 | 100201 | } | |
| 19040 |
2/2✓ Branch 0 taken 3623 times.
✓ Branch 1 taken 115558 times.
|
119181 | if(stopped) |
| 19041 | { | ||
| 19042 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 115558 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
115558 | if (ladderstuff > 0 && !shoved) |
| 19043 | { | ||
| 19044 | ✗ | zfix ty = (dy < 0 ? (y-(bigHitbox?12:4)) : (y+20)); | |
| 19045 | ✗ | ladderx = x.getTrunc(); | |
| 19046 | ✗ | laddery = TRUNCATE_HALF_TILE(ty.getInt()); | |
| 19047 | ✗ | ladderdir = up; | |
| 19048 | ✗ | ladderstart = dir; | |
| 19049 | ✗ | y += dy; | |
| 19050 | ✗ | ladderstuff = 0; | |
| 19051 | ✗ | } | |
| 19052 | else | ||
| 19053 | { | ||
| 19054 |
2/2✓ Branch 0 taken 79867 times.
✓ Branch 1 taken 35691 times.
|
115558 | if(earlyret) return false; |
| 19055 | 35691 | ret = false; | |
| 19056 | 35691 | int ysign = dy.sign(); | |
| 19057 |
2/2✓ Branch 0 taken 3109 times.
✓ Branch 1 taken 32582 times.
|
35691 | if(abs(dy) > 1) |
| 19058 | { | ||
| 19059 |
2/2✓ Branch 0 taken 1445 times.
✓ Branch 1 taken 32582 times.
|
34027 | while(scr_canmove(0, ysign, kb, ign_sv)) |
| 19060 | { | ||
| 19061 | 1445 | y += ysign; | |
| 19062 | 1445 | dy -= ysign; | |
| 19063 | } | ||
| 19064 | 32582 | } | |
| 19065 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 35691 times.
|
35691 | if(dy) |
| 19066 | { | ||
| 19067 | 35691 | dy.doDecBound(0,-9999, 0,9999); | |
| 19068 |
3/6✓ Branch 0 taken 35691 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 35691 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 35691 times.
✗ Branch 5 not taken.
|
565314 | dy = binary_search_zfix(dy.decsign(), dy, [&](zfix val, zfix& retval){ |
| 19069 |
2/2✓ Branch 0 taken 20545 times.
✓ Branch 1 taken 509078 times.
|
529623 | if(scr_canmove(0, val, kb, ign_sv)) |
| 19070 | { | ||
| 19071 | 20545 | retval = val; | |
| 19072 | 20545 | return BSEARCH_CONTINUE_AWAY0; | |
| 19073 | } | ||
| 19074 | 509078 | else return BSEARCH_CONTINUE_TOWARD0; | |
| 19075 | 529623 | }); | |
| 19076 | 35691 | y += dy; | |
| 19077 | 35691 | } | |
| 19078 | } | ||
| 19079 | 35691 | } | |
| 19080 | } | ||
| 19081 | 480569 | } | |
| 19082 | |||
| 19083 |
2/2✓ Branch 0 taken 364633 times.
✓ Branch 1 taken 624890 times.
|
989523 | if(earlyret) |
| 19084 | 364633 | return ret; | |
| 19085 |
7/10✓ Branch 0 taken 160735 times.
✓ Branch 1 taken 464155 times.
✓ Branch 2 taken 156278 times.
✓ Branch 3 taken 4457 times.
✓ Branch 4 taken 130 times.
✓ Branch 5 taken 156148 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 130 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
624890 | if(dy < 0 && !ign_sv && sideview_mode() && IsSideSwim() && checkladder) |
| 19086 | { | ||
| 19087 | ✗ | if(!iswaterex_z3(MAPCOMBO(x, y+(bigHitbox?0:8)-2), -1, x, y+(bigHitbox?0:8) - 2, true, false) | |
| 19088 | ✗ | && !canSideviewLadderRemote(x, y-4) && scr_canmove(0, -2, kb, true) && (y+(bigHitbox?0:8) - 4) > 0) | |
| 19089 | { | ||
| 19090 | ✗ | if (game->get_sideswim_jump() != 0) | |
| 19091 | { | ||
| 19092 | ✗ | setFall(zfix(0-(FEATHERJUMP*(game->get_sideswim_jump()/10000.0)))); | |
| 19093 | ✗ | sfx(WAV_ZN1SPLASH,(int32_t)x); | |
| 19094 | ✗ | hopclk = 0; | |
| 19095 | ✗ | if (charging || spins) action = attacking; | |
| 19096 | ✗ | else action = none; | |
| 19097 | ✗ | } | |
| 19098 | else | ||
| 19099 | { | ||
| 19100 | ✗ | movexy(0,-1*dy,false,false,false); | |
| 19101 | } | ||
| 19102 | ✗ | } | |
| 19103 | ✗ | } | |
| 19104 | 624890 | return ret; | |
| 19105 | 1069390 | } | |
| 19106 | 3596 | bool HeroClass::can_movexy(zfix dx, zfix dy, bool kb, bool ign_sv, bool shove) | |
| 19107 | { | ||
| 19108 |
1/2✓ Branch 0 taken 3596 times.
✗ Branch 1 not taken.
|
7192 | return handle_movestate([&]() |
| 19109 | { | ||
| 19110 | 3596 | return movexy(dx,dy,kb,ign_sv,shove,true); | |
| 19111 | }); | ||
| 19112 | ✗ | } | |
| 19113 | ✗ | bool HeroClass::moveAtAngle(zfix degrees, zfix px, bool kb, bool ign_sv, bool shove, bool earlyret) | |
| 19114 | { | ||
| 19115 | ✗ | double v = degrees.getFloat() * PI / 180.0; | |
| 19116 | ✗ | zfix dx = zc::math::Cos(v)*px, dy = zc::math::Sin(v)*px; | |
| 19117 | ✗ | return movexy(dx, dy, kb, ign_sv, shove, earlyret); | |
| 19118 | } | ||
| 19119 | ✗ | bool HeroClass::can_moveAtAngle(zfix degrees, zfix px, bool kb, bool ign_sv, bool shove) | |
| 19120 | { | ||
| 19121 | ✗ | return handle_movestate([&]() | |
| 19122 | { | ||
| 19123 | ✗ | return moveAtAngle(degrees,px,kb,ign_sv,shove,true); | |
| 19124 | }); | ||
| 19125 | ✗ | } | |
| 19126 | 440764 | bool HeroClass::moveDir(int dir, zfix px, bool kb, bool ign_sv, bool shove, bool earlyret) | |
| 19127 | { | ||
| 19128 |
4/6✓ Branch 0 taken 2 times.
✓ Branch 1 taken 440762 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 2 times.
✗ Branch 5 not taken.
|
440764 | static const zfix diagrate = zslongToFix(7071); |
| 19129 |
6/13✓ Branch 0 taken 440764 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 440764 times.
✓ Branch 4 taken 128017 times.
✓ Branch 5 taken 84306 times.
✓ Branch 6 taken 110138 times.
✓ Branch 7 taken 118303 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
|
440764 | switch(NORMAL_DIR(dir)) |
| 19130 | { | ||
| 19131 | case up: | ||
| 19132 | 128017 | return movexy(0, -px, kb, ign_sv, shove, earlyret); | |
| 19133 | case down: | ||
| 19134 | 84306 | return movexy(0, px, kb, ign_sv, shove, earlyret); | |
| 19135 | case left: | ||
| 19136 | 110138 | return movexy(-px, 0, kb, ign_sv, shove, earlyret); | |
| 19137 | case right: | ||
| 19138 | 118303 | return movexy(px, 0, kb, ign_sv, shove, earlyret); | |
| 19139 | case r_up: | ||
| 19140 | ✗ | return movexy(px*diagrate, -px*diagrate, kb, ign_sv, shove, earlyret); | |
| 19141 | case r_down: | ||
| 19142 | ✗ | return movexy(px*diagrate, px*diagrate, kb, ign_sv, shove, earlyret); | |
| 19143 | case l_up: | ||
| 19144 | ✗ | return movexy(-px*diagrate, -px*diagrate, kb, ign_sv, shove, earlyret); | |
| 19145 | case l_down: | ||
| 19146 | ✗ | return movexy(-px*diagrate, px*diagrate, kb, ign_sv, shove, earlyret); | |
| 19147 | } | ||
| 19148 | ✗ | return false; | |
| 19149 | 440764 | } | |
| 19150 | 440764 | bool HeroClass::can_moveDir(int dir, zfix px, bool kb, bool ign_sv, bool shove) | |
| 19151 | { | ||
| 19152 |
1/2✓ Branch 0 taken 440764 times.
✗ Branch 1 not taken.
|
881528 | return handle_movestate([&]() |
| 19153 | { | ||
| 19154 | 440764 | return moveDir(dir,px,kb,ign_sv,shove,true); | |
| 19155 | }); | ||
| 19156 | ✗ | } | |
| 19157 | |||
| 19158 | |||
| 19159 | 907262 | bool HeroClass::premove() | |
| 19160 | { | ||
| 19161 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 907262 times.
|
907262 | if(is_autowalking()) return true; |
| 19162 |
2/2✓ Branch 0 taken 1012 times.
✓ Branch 1 taken 906250 times.
|
907262 | if(lstunclock) return false; |
| 19163 |
4/4✓ Branch 0 taken 3376 times.
✓ Branch 1 taken 902874 times.
✓ Branch 2 taken 109 times.
✓ Branch 3 taken 3267 times.
|
906250 | if(is_conveyor_stunned) return (convey_forcex || convey_forcey); |
| 19164 | 902874 | int32_t xoff=x.getInt()&7; | |
| 19165 | 902874 | int32_t yoff=y.getInt()&7; | |
| 19166 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 902874 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
902874 | if(NO_GRIDLOCK) |
| 19167 | { | ||
| 19168 | 902874 | xoff = 0; | |
| 19169 | 902874 | yoff = 0; | |
| 19170 | 902874 | } | |
| 19171 | 902874 | int32_t push=pushing; | |
| 19172 | 902874 | int32_t oldladderx=-1000, oldladdery=-1000; // moved here because linux complains "init crosses goto ~Koopa | |
| 19173 | |||
| 19174 | 902874 | tick_diving(); | |
| 19175 | |||
| 19176 |
2/2✓ Branch 0 taken 902354 times.
✓ Branch 1 taken 520 times.
|
902874 | if(action==rafting) |
| 19177 | { | ||
| 19178 | 520 | do_rafting(); | |
| 19179 | |||
| 19180 |
1/2✓ Branch 0 taken 520 times.
✗ Branch 1 not taken.
|
520 | if(action==rafting) |
| 19181 | { | ||
| 19182 | 520 | return false; | |
| 19183 | } | ||
| 19184 | |||
| 19185 | |||
| 19186 | ✗ | set_respawn_point(); | |
| 19187 | ✗ | trySideviewLadder(); | |
| 19188 | ✗ | } | |
| 19189 | |||
| 19190 | 902354 | int32_t olddirectwpn = directWpn; // To be reinstated if startwpn() fails | |
| 19191 | 902354 | int32_t btnwpn = -1; | |
| 19192 | |||
| 19193 | //&0xFFF removes the "bow & arrows" bitmask | ||
| 19194 | //The Quick Sword is allowed to interrupt attacks. | ||
| 19195 |
4/4✓ Branch 0 taken 891676 times.
✓ Branch 1 taken 10678 times.
✓ Branch 2 taken 600133 times.
✓ Branch 3 taken 291543 times.
|
902354 | int32_t currentSwordOrWand = (itemsbuf[dowpn].type == itype_wand || itemsbuf[dowpn].type == itype_sword)?dowpn:-1; |
| 19196 |
8/8✓ Branch 0 taken 790844 times.
✓ Branch 1 taken 111510 times.
✓ Branch 2 taken 790653 times.
✓ Branch 3 taken 191 times.
✓ Branch 4 taken 22385 times.
✓ Branch 5 taken 89316 times.
✓ Branch 6 taken 60460 times.
✓ Branch 7 taken 51241 times.
|
902354 | if((!attackclk && action!=attacking && action != sideswimattacking) || ((attack==wSword || attack==wWand) && (itemsbuf[currentSwordOrWand].flags & item_flag5))) |
| 19197 | { | ||
| 19198 |
2/2✓ Branch 0 taken 1412 times.
✓ Branch 1 taken 849701 times.
|
851113 | if (getInput(btnB, INPUT_PRESS | INPUT_DRUNK | INPUT_HERO_ACTION)) |
| 19199 | { | ||
| 19200 | 1412 | btnwpn=getItemFamily(itemsbuf,Bwpn); | |
| 19201 |
2/2✓ Branch 0 taken 1411 times.
✓ Branch 1 taken 1 times.
|
1412 | dowpn = NEG_OR_MASK(Bwpn,0xFFF); |
| 19202 | 1412 | directWpn = directItemB; | |
| 19203 | 1412 | } | |
| 19204 |
2/2✓ Branch 0 taken 5975 times.
✓ Branch 1 taken 843726 times.
|
849701 | else if (getInput(btnA, INPUT_PRESS | INPUT_DRUNK | INPUT_HERO_ACTION)) |
| 19205 | { | ||
| 19206 | 5975 | btnwpn=getItemFamily(itemsbuf,Awpn); | |
| 19207 |
2/2✓ Branch 0 taken 5973 times.
✓ Branch 1 taken 2 times.
|
5975 | dowpn = NEG_OR_MASK(Awpn,0xFFF); |
| 19208 | 5975 | directWpn = directItemA; | |
| 19209 | 5975 | } | |
| 19210 |
4/4✓ Branch 0 taken 351949 times.
✓ Branch 1 taken 491777 times.
✓ Branch 2 taken 351826 times.
✓ Branch 3 taken 123 times.
|
843726 | else if (get_qr(qr_SET_XBUTTON_ITEMS) && getInput(btnEx1, INPUT_PRESS | INPUT_DRUNK | INPUT_HERO_ACTION)) |
| 19211 | { | ||
| 19212 | 123 | btnwpn=getItemFamily(itemsbuf,Xwpn); | |
| 19213 |
1/2✓ Branch 0 taken 123 times.
✗ Branch 1 not taken.
|
123 | dowpn = NEG_OR_MASK(Xwpn,0xFFF); |
| 19214 | 123 | directWpn = directItemX; | |
| 19215 | 123 | } | |
| 19216 |
4/4✓ Branch 0 taken 351826 times.
✓ Branch 1 taken 491777 times.
✓ Branch 2 taken 351713 times.
✓ Branch 3 taken 113 times.
|
843603 | else if (get_qr(qr_SET_YBUTTON_ITEMS) && getInput(btnEx2, INPUT_PRESS | INPUT_DRUNK | INPUT_HERO_ACTION)) |
| 19217 | { | ||
| 19218 | 113 | btnwpn=getItemFamily(itemsbuf,Ywpn); | |
| 19219 |
1/2✓ Branch 0 taken 113 times.
✗ Branch 1 not taken.
|
113 | dowpn = NEG_OR_MASK(Ywpn,0xFFF); |
| 19220 | 113 | directWpn = directItemY; | |
| 19221 | 113 | } | |
| 19222 | |||
| 19223 |
2/2✓ Branch 0 taken 611400 times.
✓ Branch 1 taken 239713 times.
|
851113 | auto itmid = directWpn>-1 ? directWpn : current_item_id(btnwpn); |
| 19224 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 851113 times.
|
851113 | if (on_cooldown(itmid)) |
| 19225 | { | ||
| 19226 | ✗ | directWpn = olddirectwpn; | |
| 19227 | ✗ | btnwpn = -1; | |
| 19228 | ✗ | dowpn = -1; | |
| 19229 | ✗ | did_scriptb = false; | |
| 19230 | ✗ | } | |
| 19231 | else | ||
| 19232 | { | ||
| 19233 |
1/2✓ Branch 0 taken 851113 times.
✗ Branch 1 not taken.
|
851113 | if(directWpn >= MAXITEMS) directWpn = -1; |
| 19234 | |||
| 19235 | // The Quick Sword only allows repeated sword or wand swings. | ||
| 19236 |
7/8✓ Branch 0 taken 790653 times.
✓ Branch 1 taken 60460 times.
✓ Branch 2 taken 60460 times.
✓ Branch 3 taken 790653 times.
✓ Branch 4 taken 60159 times.
✓ Branch 5 taken 301 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 790954 times.
|
851113 | if((action==attacking||action==sideswimattacking) && ((attack==wSword && btnwpn!=itype_sword) || (attack==wWand && btnwpn!=itype_wand))) |
| 19237 | 60159 | btnwpn=-1; | |
| 19238 | } | ||
| 19239 | 851113 | } | |
| 19240 | |||
| 19241 |
2/2✓ Branch 0 taken 633891 times.
✓ Branch 1 taken 268463 times.
|
902354 | auto swordid = (directWpn>-1 ? directWpn : current_item_id(itype_sword)); |
| 19242 |
11/12✓ Branch 0 taken 885920 times.
✓ Branch 1 taken 16434 times.
✓ Branch 2 taken 880413 times.
✓ Branch 3 taken 5507 times.
✓ Branch 4 taken 588757 times.
✓ Branch 5 taken 291656 times.
✓ Branch 6 taken 588330 times.
✓ Branch 7 taken 427 times.
✓ Branch 8 taken 5969 times.
✓ Branch 9 taken 582361 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 5969 times.
|
902354 | if(can_attack() && (swordid > -1 && itemsbuf[swordid].type==itype_sword) && checkitem_jinx(swordid) && btnwpn==itype_sword && charging==0) |
| 19243 | { | ||
| 19244 |
2/2✓ Branch 0 taken 3867 times.
✓ Branch 1 taken 2102 times.
|
5969 | attackid=directWpn>-1 ? directWpn : current_item_id(itype_sword); |
| 19245 |
2/6✓ Branch 0 taken 5969 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5969 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
5969 | if(checkbunny(attackid) && (checkmagiccost(attackid) || !(itemsbuf[attackid].flags & item_flag6))) |
| 19246 | { | ||
| 19247 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 5969 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
5969 | if((itemsbuf[attackid].flags & item_flag6) && !(misc_internal_hero_flags & LF_PAID_SWORD_COST)) |
| 19248 | { | ||
| 19249 | ✗ | paymagiccost(attackid,true); | |
| 19250 | ✗ | misc_internal_hero_flags |= LF_PAID_SWORD_COST; | |
| 19251 | ✗ | } | |
| 19252 | 5969 | SetAttack(); | |
| 19253 | 5969 | attack=wSword; | |
| 19254 | |||
| 19255 | 5969 | attackclk=0; | |
| 19256 |
2/2✓ Branch 0 taken 3867 times.
✓ Branch 1 taken 2102 times.
|
5969 | sfx(itemsbuf[directWpn>-1 ? directWpn : current_item_id(itype_sword)].usesound, pan(x)); |
| 19257 | |||
| 19258 |
2/10✓ Branch 0 taken 5969 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5969 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
5969 | if(dowpn>-1 && itemsbuf[dowpn].script!=0 && !did_scripta && !(FFCore.doscript(ScriptType::Item, dowpn) && get_qr(qr_ITEMSCRIPTSKEEPRUNNING))) |
| 19259 | { | ||
| 19260 | ✗ | if(!checkmagiccost(dowpn)) | |
| 19261 | { | ||
| 19262 | ✗ | item_error(); | |
| 19263 | ✗ | } | |
| 19264 | else | ||
| 19265 | { | ||
| 19266 | //clear the item script stack for a new script | ||
| 19267 | ✗ | int i = dowpn; | |
| 19268 | ✗ | FFCore.reset_script_engine_data(ScriptType::Item, i); | |
| 19269 | ✗ | ZScriptVersion::RunScript(ScriptType::Item, itemsbuf[i].script, i); | |
| 19270 | ✗ | did_scripta=true; | |
| 19271 | } | ||
| 19272 | ✗ | } | |
| 19273 | 5969 | } | |
| 19274 | else | ||
| 19275 | { | ||
| 19276 | ✗ | item_error(); | |
| 19277 | } | ||
| 19278 | 5969 | } | |
| 19279 | else | ||
| 19280 | { | ||
| 19281 | 896385 | did_scripta=false; | |
| 19282 | } | ||
| 19283 | |||
| 19284 |
7/10✓ Branch 0 taken 895692 times.
✓ Branch 1 taken 6662 times.
✓ Branch 2 taken 895692 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 895692 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 895692 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 311 times.
✓ Branch 9 taken 895381 times.
|
902354 | if(action!=swimming && action != sideswimming && action != sideswimhit && action != sideswimattacking && !getOnSideviewLadder()) |
| 19285 | { | ||
| 19286 |
4/4✓ Branch 0 taken 183267 times.
✓ Branch 1 taken 712114 times.
✓ Branch 2 taken 183259 times.
✓ Branch 3 taken 8 times.
|
895381 | if (getInput(btnUp, INPUT_DRUNK | INPUT_HERO_ACTION) && canSideviewLadder()) |
| 19287 | { | ||
| 19288 | 8 | setOnSideviewLadder(true); | |
| 19289 | 8 | } | |
| 19290 |
4/4✓ Branch 0 taken 180576 times.
✓ Branch 1 taken 714797 times.
✓ Branch 2 taken 180575 times.
✓ Branch 3 taken 1 times.
|
895373 | else if (getInput(btnDown, INPUT_DRUNK | INPUT_HERO_ACTION) && canSideviewLadder(true)) |
| 19291 | { | ||
| 19292 | 1 | y+=1; | |
| 19293 | 1 | setOnSideviewLadder(true); | |
| 19294 | 1 | } | |
| 19295 | 895381 | } | |
| 19296 | |||
| 19297 | 902354 | int32_t wx=x; | |
| 19298 | 902354 | int32_t wy=y; | |
| 19299 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 902354 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
902354 | if(conv_forcedir > -1 && !spins) dir = conv_forcedir; |
| 19300 |
5/6✓ Branch 0 taken 697415 times.
✓ Branch 1 taken 204939 times.
✓ Branch 2 taken 320 times.
✓ Branch 3 taken 902034 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 320 times.
|
902354 | else if((action==none || action==walking) && getOnSideviewLadder() && (get_qr(qr_SIDEVIEWLADDER_FACEUP)!=0)) //Allow DIR to change if standing still on sideview ladder, and force-face up. |
| 19301 | { | ||
| 19302 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 320 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
320 | if((xoff==0)||diagonalMovement) |
| 19303 | { | ||
| 19304 |
2/2✓ Branch 0 taken 190 times.
✓ Branch 1 taken 130 times.
|
320 | if (getInput(btnUp, INPUT_DRUNK | INPUT_HERO_ACTION)) dir = up; |
| 19305 |
2/2✓ Branch 0 taken 297 times.
✓ Branch 1 taken 23 times.
|
320 | if (getInput(btnDown, INPUT_DRUNK | INPUT_HERO_ACTION)) dir = down; |
| 19306 | 320 | } | |
| 19307 | |||
| 19308 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 320 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
320 | if((yoff==0)||diagonalMovement) |
| 19309 | { | ||
| 19310 |
2/2✓ Branch 0 taken 305 times.
✓ Branch 1 taken 15 times.
|
320 | if (getInput(btnLeft, INPUT_DRUNK | INPUT_HERO_ACTION)) dir = left; |
| 19311 |
2/2✓ Branch 0 taken 266 times.
✓ Branch 1 taken 54 times.
|
320 | if (getInput(btnRight, INPUT_DRUNK | INPUT_HERO_ACTION)) dir = right; |
| 19312 | 320 | } | |
| 19313 | 320 | } | |
| 19314 | |||
| 19315 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 196278 times.
✓ Branch 2 taken 191974 times.
✓ Branch 3 taken 263259 times.
✓ Branch 4 taken 250843 times.
|
902354 | switch(dir) |
| 19316 | { | ||
| 19317 | case up: | ||
| 19318 | 196278 | wy-=16; | |
| 19319 | 196278 | break; | |
| 19320 | |||
| 19321 | case down: | ||
| 19322 | 191974 | wy+=16; | |
| 19323 | 191974 | break; | |
| 19324 | |||
| 19325 | case left: | ||
| 19326 | 263259 | wx-=16; | |
| 19327 | 263259 | break; | |
| 19328 | |||
| 19329 | case right: | ||
| 19330 | 250843 | wx+=16; | |
| 19331 | 250843 | break; | |
| 19332 | } | ||
| 19333 | |||
| 19334 | 902354 | do_lens(); | |
| 19335 | |||
| 19336 | 902354 | bool no_jinx = true; | |
| 19337 |
2/2✓ Branch 0 taken 894414 times.
✓ Branch 1 taken 7940 times.
|
902354 | bool liftonly = lift_wpn && (liftflags & LIFTFL_DIS_ITEMS); |
| 19338 |
2/2✓ Branch 0 taken 633891 times.
✓ Branch 1 taken 268463 times.
|
902354 | auto itmid = directWpn>-1 ? directWpn : current_item_id(btnwpn); |
| 19339 |
2/2✓ Branch 0 taken 7940 times.
✓ Branch 1 taken 894414 times.
|
902354 | if(liftonly) |
| 19340 | { | ||
| 19341 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 7940 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
7940 | if(replay_version_check(38) && btnwpn > -1) |
| 19342 | { | ||
| 19343 | ✗ | no_jinx = checkitem_jinx(itmid); | |
| 19344 | ✗ | if(no_jinx) | |
| 19345 | ✗ | startwpn(itmid); | |
| 19346 | ✗ | directWpn = olddirectwpn; | |
| 19347 | ✗ | } | |
| 19348 | 7940 | } | |
| 19349 |
6/8✓ Branch 0 taken 885920 times.
✓ Branch 1 taken 8494 times.
✓ Branch 2 taken 1627 times.
✓ Branch 3 taken 884293 times.
✓ Branch 4 taken 1627 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1627 times.
|
894414 | else if(can_attack() && btnwpn>itype_sword && charging==0 && btnwpn!=itype_rupee) // This depends on item 0 being a rupee... |
| 19350 | { | ||
| 19351 | 1627 | bool paidmagic = false; | |
| 19352 |
5/8✓ Branch 0 taken 1568 times.
✓ Branch 1 taken 59 times.
✓ Branch 2 taken 59 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 59 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 59 times.
|
1627 | if(btnwpn==itype_wand && (directWpn>-1 ? (!item_disabled(directWpn) ? itemsbuf[directWpn].type==itype_wand : false) : current_item(itype_wand))) |
| 19353 | { | ||
| 19354 |
1/2✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
|
59 | attackid=directWpn>-1 ? directWpn : current_item_id(itype_wand); |
| 19355 | 59 | no_jinx = checkitem_jinx(attackid); | |
| 19356 |
3/8✓ Branch 0 taken 59 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 59 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 59 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
59 | if(no_jinx && checkbunny(attackid) && ((!(itemsbuf[attackid].flags & item_flag6)) || checkmagiccost(attackid))) |
| 19357 | { | ||
| 19358 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 59 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
59 | if((itemsbuf[attackid].flags & item_flag6) && !(misc_internal_hero_flags & LF_PAID_WAND_COST)){ |
| 19359 | ✗ | paymagiccost(attackid,true); | |
| 19360 | ✗ | misc_internal_hero_flags |= LF_PAID_WAND_COST; | |
| 19361 | ✗ | } | |
| 19362 | 59 | SetAttack(); | |
| 19363 | 59 | attack=wWand; | |
| 19364 | 59 | attackclk=0; | |
| 19365 | 59 | } | |
| 19366 | else | ||
| 19367 | { | ||
| 19368 | ✗ | item_error(); | |
| 19369 | } | ||
| 19370 | 59 | } | |
| 19371 |
4/6✓ Branch 0 taken 160 times.
✓ Branch 1 taken 1408 times.
✓ Branch 2 taken 160 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 160 times.
|
1728 | else if((btnwpn==itype_hammer)&&!((action==attacking||action==sideswimattacking) && attack==wHammer) |
| 19372 |
3/6✗ Branch 0 not taken.
✓ Branch 1 taken 160 times.
✓ Branch 2 taken 160 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 160 times.
|
160 | && (directWpn>-1 ? (!item_disabled(directWpn) ? itemsbuf[directWpn].type==itype_hammer : false) : current_item(itype_hammer))) |
| 19373 | { | ||
| 19374 | 160 | no_jinx = checkitem_jinx(dowpn); | |
| 19375 |
3/6✓ Branch 0 taken 160 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 160 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 160 times.
|
160 | if(!(no_jinx && checkmagiccost(dowpn) && checkbunny(dowpn))) |
| 19376 | { | ||
| 19377 | ✗ | item_error(); | |
| 19378 | ✗ | } | |
| 19379 | else | ||
| 19380 | { | ||
| 19381 | 160 | paymagiccost(dowpn); | |
| 19382 | 160 | paidmagic = true; | |
| 19383 | 160 | SetAttack(); | |
| 19384 | 160 | attack=wHammer; | |
| 19385 |
1/2✓ Branch 0 taken 160 times.
✗ Branch 1 not taken.
|
160 | attackid=directWpn>-1 ? directWpn : current_item_id(itype_hammer); |
| 19386 | 160 | attackclk=0; | |
| 19387 | } | ||
| 19388 | 160 | } | |
| 19389 |
4/6✓ Branch 0 taken 592 times.
✓ Branch 1 taken 816 times.
✓ Branch 2 taken 592 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 592 times.
|
2000 | else if((btnwpn==itype_candle)&&!((action==attacking||action==sideswimattacking) && attack==wFire) |
| 19390 |
3/6✗ Branch 0 not taken.
✓ Branch 1 taken 592 times.
✓ Branch 2 taken 592 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 592 times.
|
592 | && (directWpn>-1 ? (!item_disabled(directWpn) ? itemsbuf[directWpn].type==itype_candle : false) : current_item(itype_candle))) |
| 19391 | { | ||
| 19392 | //checkbunny handled where magic cost is paid | ||
| 19393 |
1/2✓ Branch 0 taken 592 times.
✗ Branch 1 not taken.
|
592 | attackid=directWpn>-1 ? directWpn : current_item_id(itype_candle); |
| 19394 | 592 | no_jinx = checkitem_jinx(attackid); | |
| 19395 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 591 times.
|
592 | if(no_jinx) |
| 19396 | { | ||
| 19397 | 591 | SetAttack(); | |
| 19398 | 591 | attack=wFire; | |
| 19399 | 591 | attackclk=0; | |
| 19400 | 591 | } | |
| 19401 | 592 | } | |
| 19402 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 816 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
816 | else if((btnwpn==itype_cbyrna)&&!((action==attacking||action==sideswimattacking) && attack==wCByrna) |
| 19403 | ✗ | && (directWpn>-1 ? (!item_disabled(directWpn) ? itemsbuf[directWpn].type==itype_cbyrna : false) : current_item(itype_cbyrna))) | |
| 19404 | { | ||
| 19405 | ✗ | attackid=directWpn>-1 ? directWpn : current_item_id(itype_cbyrna); | |
| 19406 | ✗ | no_jinx = checkitem_jinx(attackid); | |
| 19407 | ✗ | if(no_jinx && checkbunny(attackid) && ((!(itemsbuf[attackid].flags & item_flag6)) || checkmagiccost(attackid))) | |
| 19408 | { | ||
| 19409 | ✗ | if((itemsbuf[attackid].flags & item_flag6) && !(misc_internal_hero_flags & LF_PAID_CBYRNA_COST)){ | |
| 19410 | ✗ | paymagiccost(attackid,true); | |
| 19411 | ✗ | misc_internal_hero_flags |= LF_PAID_CBYRNA_COST; | |
| 19412 | ✗ | } | |
| 19413 | ✗ | SetAttack(); | |
| 19414 | ✗ | attack=wCByrna; | |
| 19415 | ✗ | attackclk=0; | |
| 19416 | ✗ | } | |
| 19417 | else | ||
| 19418 | { | ||
| 19419 | ✗ | item_error(); | |
| 19420 | } | ||
| 19421 | ✗ | } | |
| 19422 |
4/6✓ Branch 0 taken 6 times.
✓ Branch 1 taken 810 times.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 6 times.
|
822 | else if((btnwpn==itype_bugnet)&&!((action==attacking||action==sideswimattacking) && attack==wBugNet) |
| 19423 |
3/6✗ Branch 0 not taken.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 6 times.
|
6 | && (directWpn>-1 ? (!item_disabled(directWpn) && itemsbuf[directWpn].type==itype_bugnet) : current_item(itype_bugnet))) |
| 19424 | { | ||
| 19425 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | attackid = directWpn>-1 ? directWpn : current_item_id(itype_bugnet); |
| 19426 | 6 | no_jinx = checkitem_jinx(attackid); | |
| 19427 |
3/6✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 6 times.
|
6 | if(no_jinx && checkbunny(attackid) && checkmagiccost(attackid)) |
| 19428 | { | ||
| 19429 | 6 | paymagiccost(attackid); | |
| 19430 | 6 | SetAttack(); | |
| 19431 | 6 | attack = wBugNet; | |
| 19432 | 6 | attackclk = 0; | |
| 19433 | 6 | sfx(itemsbuf[attackid].usesound); | |
| 19434 | 6 | } | |
| 19435 | else | ||
| 19436 | { | ||
| 19437 | ✗ | item_error(); | |
| 19438 | } | ||
| 19439 | 6 | } | |
| 19440 | else | ||
| 19441 | { | ||
| 19442 | 810 | no_jinx = checkitem_jinx(itmid); | |
| 19443 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 810 times.
|
810 | if(no_jinx) |
| 19444 | { | ||
| 19445 | 810 | paidmagic = startwpn(itmid); | |
| 19446 | |||
| 19447 |
2/2✓ Branch 0 taken 781 times.
✓ Branch 1 taken 29 times.
|
810 | if(paidmagic) |
| 19448 | { | ||
| 19449 |
5/10✓ Branch 0 taken 781 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 781 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 781 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 781 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 781 times.
|
781 | if(action==casting || action==drowning || action==lavadrowning || action == sideswimcasting || action==sidedrowning) |
| 19450 | { | ||
| 19451 | ; | ||
| 19452 | ✗ | } | |
| 19453 | else | ||
| 19454 | { | ||
| 19455 | 781 | SetAttack(); | |
| 19456 | 781 | attackclk=0; | |
| 19457 | 781 | attack=none; | |
| 19458 | |||
| 19459 |
2/2✓ Branch 0 taken 276 times.
✓ Branch 1 taken 505 times.
|
781 | if(btnwpn==itype_brang) |
| 19460 | { | ||
| 19461 | 276 | attack=wBrang; | |
| 19462 | 276 | } | |
| 19463 | } | ||
| 19464 | 781 | } | |
| 19465 | else | ||
| 19466 | { | ||
| 19467 | // Weapon not started: directWpn should be reset to prev. value. | ||
| 19468 | 29 | directWpn = olddirectwpn; | |
| 19469 | } | ||
| 19470 | 810 | } | |
| 19471 | } | ||
| 19472 | |||
| 19473 |
4/12✓ Branch 0 taken 1627 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1626 times.
✓ Branch 3 taken 1 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1626 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
1627 | if(dowpn>-1 && no_jinx && itemsbuf[dowpn].script!=0 && !did_scriptb && !(FFCore.doscript(ScriptType::Item, dowpn) && get_qr(qr_ITEMSCRIPTSKEEPRUNNING))) |
| 19474 | { | ||
| 19475 | ✗ | if(!((paidmagic || checkmagiccost(dowpn)) && checkbunny(dowpn))) | |
| 19476 | { | ||
| 19477 | ✗ | item_error(); | |
| 19478 | ✗ | } | |
| 19479 | else | ||
| 19480 | { | ||
| 19481 | // Only charge for magic if item's magic cost wasn't already charged | ||
| 19482 | // for the item's main use. | ||
| 19483 | ✗ | if(!paidmagic && attack!=wWand) | |
| 19484 | ✗ | paymagiccost(dowpn); | |
| 19485 | //clear the item script stack for a new script | ||
| 19486 | ✗ | int i = dowpn; | |
| 19487 | ✗ | FFCore.reset_script_engine_data(ScriptType::Item, i); | |
| 19488 | ✗ | ZScriptVersion::RunScript(ScriptType::Item, itemsbuf[i].script, i); | |
| 19489 | ✗ | did_scriptb=true; | |
| 19490 | } | ||
| 19491 | ✗ | } | |
| 19492 | |||
| 19493 |
7/12✓ Branch 0 taken 1626 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 1626 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1626 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1626 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1626 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 1626 times.
|
1627 | if(no_jinx && (action==casting || action==drowning || action==lavadrowning || action == sideswimcasting || action==sidedrowning)) |
| 19494 | { | ||
| 19495 | ✗ | return false; | |
| 19496 | } | ||
| 19497 |
2/2✓ Branch 0 taken 1626 times.
✓ Branch 1 taken 1 times.
|
1627 | if(!no_jinx) |
| 19498 | 1 | did_scriptb = false; | |
| 19499 | 1627 | } | |
| 19500 | else | ||
| 19501 | { | ||
| 19502 | 892787 | did_scriptb=false; | |
| 19503 | } | ||
| 19504 | |||
| 19505 |
5/6✓ Branch 0 taken 791144 times.
✓ Branch 1 taken 111210 times.
✓ Branch 2 taken 783387 times.
✓ Branch 3 taken 7757 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 783387 times.
|
902354 | if(attackclk || action==attacking || action==sideswimattacking) |
| 19506 | { | ||
| 19507 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 118967 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
118967 | if(conv_forcedir > -1 && !spins) dir = conv_forcedir; |
| 19508 |
4/8✓ Branch 0 taken 7757 times.
✓ Branch 1 taken 111210 times.
✓ Branch 2 taken 7757 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 7757 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
118967 | else if((attackclk==0) && action!=sideswimattacking && getOnSideviewLadder() && (get_qr(qr_SIDEVIEWLADDER_FACEUP)!=0)) //Allow DIR to change if standing still on sideview ladder, and force-face up. |
| 19509 | { | ||
| 19510 | ✗ | if((xoff==0)||diagonalMovement) | |
| 19511 | { | ||
| 19512 | ✗ | if (getInput(btnUp, INPUT_DRUNK | INPUT_HERO_ACTION)) dir = up; | |
| 19513 | ✗ | if (getInput(btnDown, INPUT_DRUNK | INPUT_HERO_ACTION)) dir = down; | |
| 19514 | ✗ | } | |
| 19515 | |||
| 19516 | ✗ | if((yoff==0)||diagonalMovement) | |
| 19517 | { | ||
| 19518 | ✗ | if (getInput(btnLeft, INPUT_DRUNK | INPUT_HERO_ACTION)) dir = left; | |
| 19519 | ✗ | if (getInput(btnRight, INPUT_DRUNK | INPUT_HERO_ACTION)) dir = right; | |
| 19520 | ✗ | } | |
| 19521 | ✗ | } | |
| 19522 | |||
| 19523 | 118967 | bool attacked = doattack(); | |
| 19524 | |||
| 19525 | // This section below interferes with script-setting Hero->Dir, so it comes after doattack | ||
| 19526 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 118967 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
118967 | if(conv_forcedir > -1 && !spins) dir = conv_forcedir; |
| 19527 |
11/12✓ Branch 0 taken 118772 times.
✓ Branch 1 taken 195 times.
✓ Branch 2 taken 87931 times.
✓ Branch 3 taken 30841 times.
✓ Branch 4 taken 21674 times.
✓ Branch 5 taken 66257 times.
✓ Branch 6 taken 15548 times.
✓ Branch 7 taken 6126 times.
✓ Branch 8 taken 15488 times.
✓ Branch 9 taken 60 times.
✗ Branch 10 not taken.
✓ Branch 11 taken 15488 times.
|
118967 | else if(!inlikelike && attackclk>4 && (attackclk&3)==0 && charging==0 && spins==0 && action!=sideswimattacking) |
| 19528 | { | ||
| 19529 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 15488 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
15488 | if((xoff==0)||diagonalMovement) |
| 19530 | { | ||
| 19531 |
2/2✓ Branch 0 taken 13415 times.
✓ Branch 1 taken 2073 times.
|
15488 | if (getInput(btnUp, INPUT_DRUNK | INPUT_HERO_ACTION)) dir = up; |
| 19532 |
2/2✓ Branch 0 taken 12242 times.
✓ Branch 1 taken 3246 times.
|
15488 | if (getInput(btnDown, INPUT_DRUNK | INPUT_HERO_ACTION)) dir = down; |
| 19533 | |||
| 19534 | 15488 | } | |
| 19535 | |||
| 19536 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 15488 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
15488 | if((yoff==0)||diagonalMovement) |
| 19537 | { | ||
| 19538 |
2/2✓ Branch 0 taken 11986 times.
✓ Branch 1 taken 3502 times.
|
15488 | if (getInput(btnLeft, INPUT_DRUNK | INPUT_HERO_ACTION)) dir = left; |
| 19539 |
2/2✓ Branch 0 taken 12803 times.
✓ Branch 1 taken 2685 times.
|
15488 | if (getInput(btnRight, INPUT_DRUNK | INPUT_HERO_ACTION)) dir = right; |
| 19540 | 15488 | } | |
| 19541 | 15488 | } | |
| 19542 | |||
| 19543 |
7/10✓ Branch 0 taken 111723 times.
✓ Branch 1 taken 7244 times.
✓ Branch 2 taken 103784 times.
✓ Branch 3 taken 7939 times.
✓ Branch 4 taken 103784 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 103784 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 103784 times.
|
118967 | if(attacked && (charging==0 && spins<=5) && jumping<1 && action!=sideswimattacking) |
| 19544 | { | ||
| 19545 | 103784 | return false; | |
| 19546 | } | ||
| 19547 |
2/2✓ Branch 0 taken 7939 times.
✓ Branch 1 taken 7244 times.
|
15183 | else if(!attacked) |
| 19548 | { | ||
| 19549 | // Spin attack - change direction | ||
| 19550 |
3/4✓ Branch 0 taken 88 times.
✓ Branch 1 taken 7156 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 88 times.
|
7244 | if(spins>1 && attack != wHammer) |
| 19551 | { | ||
| 19552 | 88 | spins--; | |
| 19553 | |||
| 19554 |
1/2✓ Branch 0 taken 88 times.
✗ Branch 1 not taken.
|
88 | if(spins%5==0) |
| 19555 | { | ||
| 19556 | ✗ | int id = currentscroll > -1 ? currentscroll : (current_item_id(spins>5 ? itype_spinscroll2 : itype_spinscroll)); | |
| 19557 | ✗ | sfx(itemsbuf[id].usesound,pan(x)); | |
| 19558 | ✗ | } | |
| 19559 | 88 | attackclk=1; | |
| 19560 | |||
| 19561 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 21 times.
✓ Branch 2 taken 22 times.
✓ Branch 3 taken 23 times.
✓ Branch 4 taken 22 times.
|
88 | switch(dir) |
| 19562 | { | ||
| 19563 | case up: | ||
| 19564 | 21 | dir=left; | |
| 19565 | 21 | break; | |
| 19566 | |||
| 19567 | case right: | ||
| 19568 | 22 | dir=up; | |
| 19569 | 22 | break; | |
| 19570 | |||
| 19571 | case down: | ||
| 19572 | 23 | dir=right; | |
| 19573 | 23 | break; | |
| 19574 | |||
| 19575 | case left: | ||
| 19576 | 22 | dir=down; | |
| 19577 | 22 | break; | |
| 19578 | } | ||
| 19579 | |||
| 19580 | 88 | return false; | |
| 19581 | } | ||
| 19582 | else | ||
| 19583 | { | ||
| 19584 | 7156 | spins=0; | |
| 19585 | } | ||
| 19586 | |||
| 19587 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7156 times.
|
7156 | if (IsSideSwim()) {action=sideswimming; FFCore.setHeroAction(sideswimming);} |
| 19588 | 7156 | else {action=none; FFCore.setHeroAction(none);} | |
| 19589 | 7156 | attackclk=0; | |
| 19590 | 7156 | charging=0; | |
| 19591 | 7156 | } | |
| 19592 | 15095 | } | |
| 19593 | 798482 | return true; | |
| 19594 | 907262 | } | |
| 19595 | 798641 | void HeroClass::movehero() | |
| 19596 | { | ||
| 19597 | 798641 | bool earlyret = false; | |
| 19598 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 798641 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
798641 | bool nohorz = (isdungeon() && (y<=26 || y>=world_h-42) && !get_qr(qr_FREEFORM) && !walk_through_walls); |
| 19599 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 798641 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
798641 | bool novert = (isdungeon() && (x<=26 || x>=world_w - 42) && !get_qr(qr_FREEFORM) && !walk_through_walls); |
| 19600 | 798641 | zfix dx, dy; | |
| 19601 | 798641 | auto push=pushing; | |
| 19602 | 798641 | pushing=0; | |
| 19603 | |||
| 19604 |
3/4✓ Branch 0 taken 798482 times.
✓ Branch 1 taken 159 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 798482 times.
|
798641 | if(!is_conveyor_stunned && !is_autowalking()) //these do not apply to conveyor auto-walk |
| 19605 | { | ||
| 19606 |
2/2✓ Branch 0 taken 117 times.
✓ Branch 1 taken 798365 times.
|
798482 | if(pitslide()) //Check pit's 'pull'. If true, then Hero cannot fight the pull. |
| 19607 | 117 | return; | |
| 19608 | |||
| 19609 |
2/2✓ Branch 0 taken 225131 times.
✓ Branch 1 taken 573234 times.
|
798365 | if(action==walking) //still walking |
| 19610 | { | ||
| 19611 |
9/10✓ Branch 0 taken 410413 times.
✓ Branch 1 taken 162821 times.
✓ Branch 2 taken 257673 times.
✓ Branch 3 taken 152740 times.
✓ Branch 4 taken 130046 times.
✓ Branch 5 taken 127627 times.
✓ Branch 6 taken 6853 times.
✓ Branch 7 taken 123193 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 6853 times.
|
573234 | if (!getInput(btnUp, INPUT_DRUNK | INPUT_HERO_ACTION) && !getInput(btnDown, INPUT_DRUNK | INPUT_HERO_ACTION) && !getInput(btnLeft, INPUT_DRUNK | INPUT_HERO_ACTION) && !getInput(btnRight, INPUT_DRUNK | INPUT_HERO_ACTION) && !autostep) |
| 19612 | { | ||
| 19613 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6853 times.
|
6853 | if(attackclk>0) SetAttack(); |
| 19614 | 6853 | else {action = none; FFCore.setHeroAction(none);} | |
| 19615 | 6853 | hero_count=-1; | |
| 19616 | 6853 | earlyret = true; | |
| 19617 | 6853 | goto newmove_slide; | |
| 19618 | } | ||
| 19619 | |||
| 19620 | 566381 | autostep=false; | |
| 19621 | 566381 | } // endif (action==walking) | |
| 19622 | |||
| 19623 |
15/24✓ Branch 0 taken 784850 times.
✓ Branch 1 taken 6662 times.
✓ Branch 2 taken 784850 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 784850 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 784850 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 784850 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 784850 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 784850 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 784850 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 784850 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 776911 times.
✓ Branch 19 taken 7939 times.
✓ Branch 20 taken 776911 times.
✗ Branch 21 not taken.
✓ Branch 22 taken 3222 times.
✓ Branch 23 taken 773689 times.
|
791512 | if((action!=swimming)&&(action!=sideswimming)&&(action !=sideswimhit)&&(action !=sideswimattacking)&&(action!=casting)&&(action!=sideswimcasting)&&(action!=drowning)&&(action!=sidedrowning)&&(action!=lavadrowning) && charging==0 && spins==0 && jumping<1) |
| 19624 | { | ||
| 19625 | 773689 | action=none; FFCore.setHeroAction(none); | |
| 19626 | 773689 | } | |
| 19627 | 791512 | } | |
| 19628 | |||
| 19629 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 791671 times.
|
1829276 | if(is_autowalking()) |
| 19630 | { | ||
| 19631 | ✗ | if(check_pitslide() > -1) | |
| 19632 | ✗ | try_hover(); | |
| 19633 | ✗ | } | |
| 19634 |
2/2✓ Branch 0 taken 159 times.
✓ Branch 1 taken 791512 times.
|
791671 | else if(is_conveyor_stunned) |
| 19635 | { | ||
| 19636 | 159 | dx = convey_forcex; | |
| 19637 | 159 | dy = convey_forcey; | |
| 19638 | 159 | convey_forcex = 0; | |
| 19639 | 159 | convey_forcey = 0; | |
| 19640 |
2/2✓ Branch 0 taken 158 times.
✓ Branch 1 taken 1 times.
|
159 | if(action != walking) |
| 19641 | { | ||
| 19642 | 1 | action = walking; FFCore.setHeroAction(walking); | |
| 19643 | 1 | } | |
| 19644 | 159 | } | |
| 19645 |
1/2✓ Branch 0 taken 791512 times.
✗ Branch 1 not taken.
|
791512 | else if(diagonalMovement) |
| 19646 | { | ||
| 19647 |
5/5✓ Branch 0 taken 195282 times.
✓ Branch 1 taken 128560 times.
✓ Branch 2 taken 123077 times.
✓ Branch 3 taken 173241 times.
✓ Branch 4 taken 171352 times.
|
791512 | switch(holddir) |
| 19648 | { | ||
| 19649 | case up: | ||
| 19650 |
2/2✓ Branch 0 taken 122967 times.
✓ Branch 1 taken 5593 times.
|
128560 | if (!getInput(btnUp, INPUT_HERO_ACTION)) |
| 19651 | { | ||
| 19652 | 5593 | holddir=-1; | |
| 19653 | 5593 | } | |
| 19654 | |||
| 19655 | 128560 | break; | |
| 19656 | |||
| 19657 | case down: | ||
| 19658 |
2/2✓ Branch 0 taken 117530 times.
✓ Branch 1 taken 5547 times.
|
123077 | if (!getInput(btnDown, INPUT_HERO_ACTION)) |
| 19659 | { | ||
| 19660 | 5547 | holddir=-1; | |
| 19661 | 5547 | } | |
| 19662 | |||
| 19663 | 123077 | break; | |
| 19664 | |||
| 19665 | case left: | ||
| 19666 |
2/2✓ Branch 0 taken 166987 times.
✓ Branch 1 taken 6254 times.
|
173241 | if (!getInput(btnLeft, INPUT_HERO_ACTION)) |
| 19667 | { | ||
| 19668 | 6254 | holddir=-1; | |
| 19669 | 6254 | } | |
| 19670 | |||
| 19671 | 173241 | break; | |
| 19672 | |||
| 19673 | case right: | ||
| 19674 |
2/2✓ Branch 0 taken 165257 times.
✓ Branch 1 taken 6095 times.
|
171352 | if (!getInput(btnRight, INPUT_HERO_ACTION)) |
| 19675 | { | ||
| 19676 | 6095 | holddir=-1; | |
| 19677 | 6095 | } | |
| 19678 | |||
| 19679 | 171352 | break; | |
| 19680 | |||
| 19681 | default: | ||
| 19682 | 195282 | break; | |
| 19683 | } //end switch | ||
| 19684 | |||
| 19685 |
6/6✓ Branch 0 taken 170302 times.
✓ Branch 1 taken 621210 times.
✓ Branch 2 taken 164699 times.
✓ Branch 3 taken 5603 times.
✓ Branch 4 taken 122967 times.
✓ Branch 5 taken 128570 times.
|
791512 | if (getInput(btnUp, INPUT_DRUNK | INPUT_HERO_ACTION) && (holddir == -1 || holddir == up) && !novert) |
| 19686 | { | ||
| 19687 |
5/10✓ Branch 0 taken 127686 times.
✓ Branch 1 taken 884 times.
✓ Branch 2 taken 127686 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 127686 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 127686 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
128570 | if(charging==0 && spins==0 && action != sideswimattacking && !(IsSideSwim() && get_qr(qr_SIDESWIMDIR))) |
| 19688 | { | ||
| 19689 | 127686 | dir=up; | |
| 19690 | 127686 | } | |
| 19691 | 128570 | holddir=up; | |
| 19692 | |||
| 19693 |
5/6✓ Branch 0 taken 19969 times.
✓ Branch 1 taken 108601 times.
✓ Branch 2 taken 19942 times.
✓ Branch 3 taken 27 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 19942 times.
|
128570 | if (getInput(btnRight, INPUT_DRUNK | INPUT_HERO_ACTION) && shiftdir != left && !nohorz) |
| 19694 | { | ||
| 19695 | 19942 | shiftdir=right; | |
| 19696 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 19942 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
19942 | if (IsSideSwim() && get_qr(qr_SIDESWIMDIR) && (charging==0 && spins==0)) dir = right; |
| 19697 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 19942 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
19942 | if (!IsSideSwim() || (charging==0 && spins==0)) sideswimdir = right; |
| 19698 | 19942 | } | |
| 19699 |
5/6✓ Branch 0 taken 19236 times.
✓ Branch 1 taken 89392 times.
✓ Branch 2 taken 19213 times.
✓ Branch 3 taken 23 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 19213 times.
|
108628 | else if (getInput(btnLeft, INPUT_DRUNK | INPUT_HERO_ACTION) && shiftdir != right && !nohorz) |
| 19700 | { | ||
| 19701 | 19213 | shiftdir=left; | |
| 19702 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 19213 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
19213 | if (IsSideSwim() && get_qr(qr_SIDESWIMDIR) && (charging==0 && spins==0)) dir = left; |
| 19703 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 19213 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
19213 | if (!IsSideSwim() || (charging==0 && spins==0)) sideswimdir = left; |
| 19704 | 19213 | } | |
| 19705 | else | ||
| 19706 | { | ||
| 19707 | 89415 | shiftdir=-1; | |
| 19708 | } | ||
| 19709 | 128570 | } | |
| 19710 |
6/6✓ Branch 0 taken 160553 times.
✓ Branch 1 taken 748323 times.
✓ Branch 2 taken 154999 times.
✓ Branch 3 taken 5554 times.
✓ Branch 4 taken 37469 times.
✓ Branch 5 taken 123084 times.
|
908876 | else if (getInput(btnDown, INPUT_DRUNK | INPUT_HERO_ACTION) && (holddir == -1 || holddir == down) && !novert) |
| 19711 | { | ||
| 19712 |
5/10✓ Branch 0 taken 122028 times.
✓ Branch 1 taken 1056 times.
✓ Branch 2 taken 122028 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 122028 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 122028 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
123084 | if(charging==0 && spins==0 && action != sideswimattacking && !(IsSideSwim() && get_qr(qr_SIDESWIMDIR))) |
| 19713 | { | ||
| 19714 | 122028 | dir=down; | |
| 19715 | 122028 | } | |
| 19716 | 123084 | holddir=down; | |
| 19717 | |||
| 19718 |
5/6✓ Branch 0 taken 17571 times.
✓ Branch 1 taken 105513 times.
✓ Branch 2 taken 17527 times.
✓ Branch 3 taken 44 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 17527 times.
|
123084 | if (getInput(btnRight, INPUT_DRUNK | INPUT_HERO_ACTION) && shiftdir != left && !nohorz) |
| 19719 | { | ||
| 19720 | 17527 | shiftdir=right; | |
| 19721 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 17527 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
17527 | if (IsSideSwim() && get_qr(qr_SIDESWIMDIR) && (charging==0 && spins==0)) dir = right; |
| 19722 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 17527 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
17527 | if (!IsSideSwim() || (charging==0 && spins==0)) sideswimdir = right; |
| 19723 | 17527 | } | |
| 19724 |
5/6✓ Branch 0 taken 19215 times.
✓ Branch 1 taken 86342 times.
✓ Branch 2 taken 19187 times.
✓ Branch 3 taken 28 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 19187 times.
|
105557 | else if (getInput(btnLeft, INPUT_DRUNK | INPUT_HERO_ACTION) && shiftdir != right && !nohorz) |
| 19725 | { | ||
| 19726 | 19187 | shiftdir=left; | |
| 19727 |
1/8✗ Branch 0 not taken.
✓ Branch 1 taken 19187 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
19187 | if (IsSideSwim() && get_qr(qr_SIDESWIMDIR) && (charging==0 && spins==0)) dir = left; |
| 19728 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 19187 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
19187 | if (!IsSideSwim() || (charging==0 && spins==0)) sideswimdir = left; |
| 19729 | 19187 | } | |
| 19730 | else | ||
| 19731 | { | ||
| 19732 | 86370 | shiftdir=-1; | |
| 19733 | } | ||
| 19734 | 123084 | } | |
| 19735 |
6/6✓ Branch 0 taken 173389 times.
✓ Branch 1 taken 612403 times.
✓ Branch 2 taken 167127 times.
✓ Branch 3 taken 6262 times.
✓ Branch 4 taken 140 times.
✓ Branch 5 taken 173249 times.
|
785792 | else if (getInput(btnLeft, INPUT_DRUNK | INPUT_HERO_ACTION) && (holddir == -1 || holddir == left) && !nohorz) |
| 19736 | { | ||
| 19737 |
4/6✓ Branch 0 taken 171364 times.
✓ Branch 1 taken 1885 times.
✓ Branch 2 taken 171364 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 171364 times.
|
173249 | if(charging==0 && spins==0 && action != sideswimattacking) |
| 19738 | { | ||
| 19739 | 171364 | dir=left; | |
| 19740 | 171364 | } | |
| 19741 | 173249 | sideswimdir = left; | |
| 19742 | 173249 | holddir=left; | |
| 19743 | |||
| 19744 |
5/6✓ Branch 0 taken 19779 times.
✓ Branch 1 taken 153470 times.
✓ Branch 2 taken 19770 times.
✓ Branch 3 taken 9 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 19770 times.
|
173249 | if (getInput(btnUp, INPUT_DRUNK | INPUT_HERO_ACTION) && shiftdir != down && !novert) |
| 19745 | { | ||
| 19746 | 19770 | shiftdir=up; | |
| 19747 | 19770 | } | |
| 19748 |
5/6✓ Branch 0 taken 18379 times.
✓ Branch 1 taken 135100 times.
✓ Branch 2 taken 18367 times.
✓ Branch 3 taken 12 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 18367 times.
|
153479 | else if (getInput(btnDown, INPUT_DRUNK | INPUT_HERO_ACTION) && shiftdir != up && !novert) |
| 19749 | { | ||
| 19750 | 18367 | shiftdir=down; | |
| 19751 | 18367 | } | |
| 19752 | else | ||
| 19753 | { | ||
| 19754 | 135112 | shiftdir=-1; | |
| 19755 | } | ||
| 19756 | 173249 | } | |
| 19757 |
5/6✓ Branch 0 taken 171357 times.
✓ Branch 1 taken 441186 times.
✓ Branch 2 taken 165257 times.
✓ Branch 3 taken 6100 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 171357 times.
|
612543 | else if (getInput(btnRight, INPUT_DRUNK | INPUT_HERO_ACTION) && (holddir == -1 || holddir == right) && !nohorz) |
| 19758 | { | ||
| 19759 |
4/6✓ Branch 0 taken 169568 times.
✓ Branch 1 taken 1789 times.
✓ Branch 2 taken 169568 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 169568 times.
|
171357 | if(charging==0 && spins==0 && action != sideswimattacking) |
| 19760 | { | ||
| 19761 | 169568 | dir=right; | |
| 19762 | 169568 | } | |
| 19763 | 171357 | sideswimdir = right; | |
| 19764 | 171357 | holddir=right; | |
| 19765 | |||
| 19766 |
5/6✓ Branch 0 taken 21953 times.
✓ Branch 1 taken 149404 times.
✓ Branch 2 taken 21950 times.
✓ Branch 3 taken 3 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 21950 times.
|
171357 | if (getInput(btnUp, INPUT_DRUNK | INPUT_HERO_ACTION) && shiftdir != down && !novert) |
| 19767 | { | ||
| 19768 | 21950 | shiftdir=up; | |
| 19769 | 21950 | } | |
| 19770 |
5/6✓ Branch 0 taken 19088 times.
✓ Branch 1 taken 130319 times.
✓ Branch 2 taken 19081 times.
✓ Branch 3 taken 7 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 19081 times.
|
149407 | else if (getInput(btnDown, INPUT_DRUNK | INPUT_HERO_ACTION) && shiftdir != up && !novert) |
| 19771 | { | ||
| 19772 | 19081 | shiftdir=down; | |
| 19773 | 19081 | } | |
| 19774 | else | ||
| 19775 | { | ||
| 19776 | 130326 | shiftdir=-1; | |
| 19777 | } | ||
| 19778 | 171357 | } | |
| 19779 | else | ||
| 19780 | { | ||
| 19781 | 441186 | int32_t wtry = iswaterex_z3(MAPCOMBO(x,y+15), -1, x,y+15, true, false); | |
| 19782 | 441186 | int32_t wtry8 = iswaterex_z3(MAPCOMBO(x+15,y+15), -1, x+15,y+15, true, false); | |
| 19783 | 441186 | int32_t wtrx = iswaterex_z3(MAPCOMBO(x,y+(bigHitbox?0:8)), -1, x,y+(bigHitbox?0:8), true, false); | |
| 19784 | 441186 | int32_t wtrx8 = iswaterex_z3(MAPCOMBO(x+15,y+(bigHitbox?0:8)), -1, x+15,y+(bigHitbox?0:8), true, false); | |
| 19785 | 441186 | int32_t wtrc = iswaterex_z3(MAPCOMBO(x+8,y+(bigHitbox?8:12)), -1, x+8,y+(bigHitbox?8:12), true, false); | |
| 19786 | |||
| 19787 |
10/12✓ Branch 0 taken 32660 times.
✓ Branch 1 taken 408526 times.
✓ Branch 2 taken 32603 times.
✓ Branch 3 taken 57 times.
✓ Branch 4 taken 189 times.
✓ Branch 5 taken 32414 times.
✓ Branch 6 taken 32576 times.
✓ Branch 7 taken 27 times.
✓ Branch 8 taken 32576 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 32576 times.
✗ Branch 11 not taken.
|
441186 | if(can_use_item(itype_flippers,i_flippers)&¤t_item(itype_flippers) >= combobuf[wtrc].attribytes[0]&&(!(combobuf[wtrc].usrflags&cflag1) || (itemsbuf[current_item_id(itype_flippers)].flags & item_flag3))&&!(ladderx+laddery)&&z==0&&fakez==0) |
| 19788 | { | ||
| 19789 |
8/12✓ Branch 0 taken 589 times.
✓ Branch 1 taken 31987 times.
✓ Branch 2 taken 311 times.
✓ Branch 3 taken 278 times.
✓ Branch 4 taken 294 times.
✓ Branch 5 taken 17 times.
✓ Branch 6 taken 294 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 294 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
32576 | if(wtrx&&wtrx8&&wtry&&wtry8 && !DRIEDLAKE) |
| 19790 | { | ||
| 19791 | //action=swimming; | ||
| 19792 |
2/12✓ Branch 0 taken 294 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 294 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
294 | if(action !=none && action != swimming && action != sideswimming && action != sideswimhit && action != sideswimattacking && !isSideViewHero()) |
| 19793 | { | ||
| 19794 | ✗ | hopclk = 0xFF; | |
| 19795 | ✗ | } | |
| 19796 | 294 | } | |
| 19797 | 32576 | } | |
| 19798 | 441186 | earlyret = true; | |
| 19799 | } | ||
| 19800 |
2/2✓ Branch 0 taken 441186 times.
✓ Branch 1 taken 596260 times.
|
1037446 | if(earlyret) |
| 19801 | 441186 | dx = dy = 0; | |
| 19802 | 596260 | else get_move(holddir,dx,dy,dir); | |
| 19803 | 1037446 | } | |
| 19804 | else //4-way | ||
| 19805 | { | ||
| 19806 | ✗ | shiftdir = -1; | |
| 19807 | ✗ | holddir = -1; | |
| 19808 | ✗ | if (!novert && getInput(btnUp, INPUT_DRUNK | INPUT_HERO_ACTION)) | |
| 19809 | { | ||
| 19810 | ✗ | holddir = dir = up; | |
| 19811 | ✗ | } | |
| 19812 | ✗ | else if (!novert && getInput(btnDown, INPUT_DRUNK | INPUT_HERO_ACTION)) | |
| 19813 | { | ||
| 19814 | ✗ | holddir = dir = down; | |
| 19815 | ✗ | } | |
| 19816 | ✗ | else if (!nohorz && getInput(btnLeft, INPUT_DRUNK | INPUT_HERO_ACTION)) | |
| 19817 | { | ||
| 19818 | ✗ | holddir = dir = left; | |
| 19819 | ✗ | } | |
| 19820 | ✗ | else if (!nohorz && getInput(btnRight, INPUT_DRUNK | INPUT_HERO_ACTION)) | |
| 19821 | { | ||
| 19822 | ✗ | holddir = dir = right; | |
| 19823 | ✗ | } | |
| 19824 | ✗ | get_move(holddir,dx,dy,dir); | |
| 19825 | } | ||
| 19826 | |||
| 19827 | newmove_slide: | ||
| 19828 |
3/4✓ Branch 0 taken 159 times.
✓ Branch 1 taken 1044299 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 159 times.
|
1044458 | if(conv_forcedir > -1 && !spins) |
| 19829 | 159 | dir = conv_forcedir; | |
| 19830 |
3/4✓ Branch 0 taken 798365 times.
✓ Branch 1 taken 246093 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 798365 times.
|
1044458 | if(!is_conveyor_stunned && !is_autowalking()) |
| 19831 | { | ||
| 19832 |
6/8✓ Branch 0 taken 796637 times.
✓ Branch 1 taken 1728 times.
✓ Branch 2 taken 796637 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2204 times.
✓ Branch 5 taken 794433 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 2204 times.
|
798365 | bool is_inair = (z > 0 || fakez > 0) || (sideview_mode() && !get_qr(qr_BROKEN_ICY_FLOOR_SIDEVIEW) && !isStanding(true)); |
| 19833 | 798365 | auto ic = ice_combo; | |
| 19834 |
2/2✓ Branch 0 taken 3346 times.
✓ Branch 1 taken 795019 times.
|
798365 | if(!is_inair) //maintain momentum when jumping |
| 19835 | { | ||
| 19836 | 795019 | const int sens = 2; | |
| 19837 |
3/4✓ Branch 0 taken 586 times.
✓ Branch 1 taken 794433 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 586 times.
|
795019 | if(sideview_mode() && !get_qr(qr_BROKEN_ICY_FLOOR_SIDEVIEW)) // check *below you* in sideview |
| 19838 | { | ||
| 19839 | 586 | int xs[] = {x+sens, x+15-sens}; | |
| 19840 | 586 | bool found = false; | |
| 19841 |
2/2✓ Branch 0 taken 586 times.
✓ Branch 1 taken 1172 times.
|
1758 | for(int q = 0; q < 2; ++q) |
| 19842 | { | ||
| 19843 | 1172 | auto ice = get_icy(xs[q], y+16, ICY_PLAYER); | |
| 19844 |
1/2✓ Branch 0 taken 1172 times.
✗ Branch 1 not taken.
|
1172 | if(ice) |
| 19845 | { | ||
| 19846 | ✗ | ic = ice_combo = ice; | |
| 19847 | ✗ | found = true; | |
| 19848 | ✗ | break; | |
| 19849 | } | ||
| 19850 | 1172 | } | |
| 19851 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 586 times.
|
586 | if(!found) |
| 19852 | 586 | ic = ice_combo = 0; | |
| 19853 | 586 | } | |
| 19854 | else | ||
| 19855 | { | ||
| 19856 | 794433 | auto ty = y+(bigHitbox?0:8); | |
| 19857 | 794433 | int xs[] = {x+7, x+sens, x+sens, x+15-sens, x+15-sens}; | |
| 19858 | 794433 | int ys[] = {y+(bigHitbox?8:12), ty+sens, y+15-sens, ty+sens, y+15-sens}; | |
| 19859 | 794433 | bool found = false; | |
| 19860 |
2/2✓ Branch 0 taken 794433 times.
✓ Branch 1 taken 3972165 times.
|
4766598 | for(int q = 0; q < 5; ++q) |
| 19861 | { | ||
| 19862 | 3972165 | auto ice = get_icy(xs[q], ys[q], ICY_PLAYER); | |
| 19863 |
1/2✓ Branch 0 taken 3972165 times.
✗ Branch 1 not taken.
|
3972165 | if(ice) |
| 19864 | { | ||
| 19865 | ✗ | ic = ice_combo = ice; | |
| 19866 | ✗ | found = true; | |
| 19867 | ✗ | break; | |
| 19868 | } | ||
| 19869 | 3972165 | } | |
| 19870 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 794433 times.
|
794433 | if(!found) |
| 19871 | 794433 | ic = ice_combo = 0; | |
| 19872 | } | ||
| 19873 | 795019 | } | |
| 19874 |
2/2✓ Branch 0 taken 798205 times.
✓ Branch 1 taken 160 times.
|
798365 | if(script_ice_combo) |
| 19875 | { | ||
| 19876 |
2/4✓ Branch 0 taken 160 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 160 times.
|
160 | if((unsigned(script_ice_combo) < MAXCOMBOS) && check_icy(combobuf[script_ice_combo], ICY_PLAYER)) |
| 19877 | 160 | ic = script_ice_combo; | |
| 19878 | ✗ | else ic = 0; | |
| 19879 | 160 | } | |
| 19880 |
2/2✓ Branch 0 taken 160 times.
✓ Branch 1 taken 798205 times.
|
798365 | if(ic) |
| 19881 | { | ||
| 19882 | 160 | handle_slide(combobuf[ic], dx, dy); | |
| 19883 | 160 | earlyret = false; | |
| 19884 | 160 | } | |
| 19885 | 798205 | else clear_ice(); | |
| 19886 | 798365 | } | |
| 19887 | 246093 | else clear_ice(); | |
| 19888 |
2/2✓ Branch 0 taken 201945 times.
✓ Branch 1 taken 842513 times.
|
1044458 | if(earlyret) |
| 19889 | 201945 | return; | |
| 19890 | |||
| 19891 |
2/2✓ Branch 0 taken 777441 times.
✓ Branch 1 taken 65072 times.
|
842513 | if(!new_engine_move(dx,dy)) |
| 19892 | 65072 | pushing = push+1; | |
| 19893 | 1044575 | } | |
| 19894 | |||
| 19895 | 971780 | void HeroClass::get_move(int movedir, zfix& dx, zfix& dy, int32_t& facedir) | |
| 19896 | { | ||
| 19897 | 971780 | dx = 0; dy = 0; | |
| 19898 |
6/8✓ Branch 0 taken 596106 times.
✓ Branch 1 taken 375674 times.
✓ Branch 2 taken 596106 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 596106 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 375828 times.
✓ Branch 7 taken 971934 times.
|
971780 | if(inlikelike || lstunclock > 0 || is_conveyor_stunned || movedir < 0) |
| 19899 | 751502 | return; | |
| 19900 | |||
| 19901 | 971934 | zfix base_movepix(zfix(steprate) / 100); | |
| 19902 | 971934 | zfix movepix(base_movepix); | |
| 19903 | 971934 | zfix up_step(zfix(game->get_sideswim_up()) / 100); | |
| 19904 | 971934 | zfix left_step(zfix(game->get_sideswim_side()) / 100); | |
| 19905 | 971934 | zfix right_step(zfix(game->get_sideswim_side()) / 100); | |
| 19906 | 971934 | zfix down_step(zfix(game->get_sideswim_down()) / 100); | |
| 19907 | 971934 | std::vector<zfix*> steps; | |
| 19908 |
2/2✓ Branch 0 taken 596106 times.
✓ Branch 1 taken 375828 times.
|
971934 | steps.push_back(&movepix); |
| 19909 |
1/2✓ Branch 0 taken 596106 times.
✗ Branch 1 not taken.
|
596106 | steps.push_back(&up_step); |
| 19910 |
1/2✓ Branch 0 taken 596106 times.
✗ Branch 1 not taken.
|
596106 | steps.push_back(&left_step); |
| 19911 |
1/2✓ Branch 0 taken 596106 times.
✗ Branch 1 not taken.
|
596106 | steps.push_back(&right_step); |
| 19912 |
1/2✓ Branch 0 taken 596106 times.
✗ Branch 1 not taken.
|
596106 | steps.push_back(&down_step); |
| 19913 | |||
| 19914 |
1/2✓ Branch 0 taken 596106 times.
✗ Branch 1 not taken.
|
596106 | mod_steps(steps); |
| 19915 | |||
| 19916 |
2/4✓ Branch 0 taken 596106 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 596106 times.
✗ Branch 3 not taken.
|
596106 | up_step = -up_step; |
| 19917 |
2/4✓ Branch 0 taken 596106 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 596106 times.
✗ Branch 3 not taken.
|
596106 | left_step = -left_step; |
| 19918 | |||
| 19919 | |||
| 19920 |
1/2✓ Branch 0 taken 596106 times.
✗ Branch 1 not taken.
|
596106 | zfix step(movepix); |
| 19921 |
1/2✓ Branch 0 taken 596106 times.
✗ Branch 1 not taken.
|
596106 | zfix step_diag(movepix); |
| 19922 | |||
| 19923 | |||
| 19924 |
1/2✓ Branch 0 taken 596106 times.
✗ Branch 1 not taken.
|
596106 | if (diagonalMovement) |
| 19925 | { | ||
| 19926 |
6/6✓ Branch 0 taken 467605 times.
✓ Branch 1 taken 128501 times.
✓ Branch 2 taken 88172 times.
✓ Branch 3 taken 555777 times.
✓ Branch 4 taken 213183 times.
✓ Branch 5 taken 14850 times.
|
898919 | if (((movedir == up || movedir == down) && (shiftdir == left || shiftdir == right)) || |
| 19927 |
4/4✓ Branch 0 taken 347026 times.
✓ Branch 1 taken 208751 times.
✓ Branch 2 taken 94062 times.
✓ Branch 3 taken 441088 times.
|
555777 | (movedir == left || movedir == right) && (shiftdir == up || shiftdir == down)) |
| 19928 | { | ||
| 19929 |
4/6✓ Branch 0 taken 155018 times.
✓ Branch 1 taken 375828 times.
✓ Branch 2 taken 155018 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 155018 times.
✗ Branch 5 not taken.
|
530846 | step = STEP_DIAGONAL(step); |
| 19930 |
3/6✓ Branch 0 taken 155018 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 155018 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 155018 times.
✗ Branch 5 not taken.
|
155018 | up_step = STEP_DIAGONAL(up_step); |
| 19931 |
3/6✓ Branch 0 taken 155018 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 155018 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 155018 times.
✗ Branch 5 not taken.
|
155018 | left_step = STEP_DIAGONAL(left_step); |
| 19932 |
3/6✓ Branch 0 taken 155018 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 155018 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 155018 times.
✗ Branch 5 not taken.
|
155018 | right_step = STEP_DIAGONAL(right_step); |
| 19933 |
3/6✓ Branch 0 taken 155018 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 155018 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 155018 times.
✗ Branch 5 not taken.
|
155018 | down_step = STEP_DIAGONAL(down_step); |
| 19934 | 155018 | } | |
| 19935 |
4/5✓ Branch 0 taken 128501 times.
✓ Branch 1 taken 123079 times.
✓ Branch 2 taken 173216 times.
✓ Branch 3 taken 171310 times.
✗ Branch 4 not taken.
|
596106 | switch (movedir) |
| 19936 | { | ||
| 19937 | case up: | ||
| 19938 |
3/3✓ Branch 0 taken 19210 times.
✓ Branch 1 taken 19942 times.
✓ Branch 2 taken 89349 times.
|
128501 | switch (shiftdir) |
| 19939 | { | ||
| 19940 | case left: | ||
| 19941 |
4/10✓ Branch 0 taken 19210 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 19210 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 19210 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 19210 times.
✗ Branch 9 not taken.
|
19210 | dx = IsSideSwim() ? left_step : -step; |
| 19942 | 19210 | break; | |
| 19943 | case right: | ||
| 19944 |
3/6✓ Branch 0 taken 19942 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 19942 times.
✓ Branch 4 taken 19942 times.
✗ Branch 5 not taken.
|
19942 | dx = IsSideSwim() ? right_step : step; |
| 19945 | 19942 | break; | |
| 19946 | } | ||
| 19947 |
2/4✓ Branch 0 taken 128501 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 128501 times.
|
128501 | if (IsSideSwim()) |
| 19948 | { | ||
| 19949 | ✗ | dy = up_step; | |
| 19950 | ✗ | } | |
| 19951 |
2/4✓ Branch 0 taken 128501 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 128501 times.
✗ Branch 3 not taken.
|
128501 | else dy = -step; |
| 19952 | 128501 | break; | |
| 19953 | case down: | ||
| 19954 |
3/3✓ Branch 0 taken 19187 times.
✓ Branch 1 taken 17525 times.
✓ Branch 2 taken 86367 times.
|
123079 | switch (shiftdir) |
| 19955 | { | ||
| 19956 | case left: | ||
| 19957 |
2/4✓ Branch 0 taken 19187 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 19187 times.
✗ Branch 3 not taken.
|
19187 | dx = -step; |
| 19958 |
2/6✓ Branch 0 taken 19187 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 19187 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
19187 | if (IsSideSwim()) dx = left_step; |
| 19959 | 19187 | break; | |
| 19960 | case right: | ||
| 19961 |
1/2✓ Branch 0 taken 17525 times.
✗ Branch 1 not taken.
|
17525 | dx = step; |
| 19962 |
2/6✓ Branch 0 taken 17525 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 17525 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
17525 | if (IsSideSwim()) dx = right_step; |
| 19963 | 17525 | break; | |
| 19964 | } | ||
| 19965 |
3/6✓ Branch 0 taken 123079 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 123079 times.
✓ Branch 4 taken 123079 times.
✗ Branch 5 not taken.
|
123079 | dy = IsSideSwim() ? down_step : step; |
| 19966 | 123079 | break; | |
| 19967 | case left: | ||
| 19968 |
3/3✓ Branch 0 taken 19765 times.
✓ Branch 1 taken 18362 times.
✓ Branch 2 taken 135089 times.
|
173216 | switch (shiftdir) |
| 19969 | { | ||
| 19970 | case up: | ||
| 19971 |
2/4✓ Branch 0 taken 19765 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 19765 times.
|
19765 | if (IsSideSwim()) |
| 19972 | { | ||
| 19973 | ✗ | dy = up_step; | |
| 19974 | ✗ | } | |
| 19975 |
2/4✓ Branch 0 taken 19765 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 19765 times.
✗ Branch 3 not taken.
|
19765 | else dy = -step; |
| 19976 | 19765 | break; | |
| 19977 | case down: | ||
| 19978 |
1/2✓ Branch 0 taken 18362 times.
✗ Branch 1 not taken.
|
18362 | dy = step; |
| 19979 |
2/6✓ Branch 0 taken 18362 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 18362 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
18362 | if (IsSideSwim()) dy = down_step; |
| 19980 | 18362 | break; | |
| 19981 | } | ||
| 19982 |
4/10✓ Branch 0 taken 173216 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 173216 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 173216 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 173216 times.
✗ Branch 9 not taken.
|
173216 | dx = IsSideSwim() ? left_step : -step; |
| 19983 | 173216 | break; | |
| 19984 | case right: | ||
| 19985 |
3/3✓ Branch 0 taken 21948 times.
✓ Branch 1 taken 19079 times.
✓ Branch 2 taken 130283 times.
|
171310 | switch (shiftdir) |
| 19986 | { | ||
| 19987 | case up: | ||
| 19988 |
4/8✓ Branch 0 taken 21948 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 21948 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 21948 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 21948 times.
✗ Branch 7 not taken.
|
21948 | if (!IsSideSwim()) dy = -step; |
| 19989 |
2/4✓ Branch 0 taken 21948 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 21948 times.
|
21948 | if (IsSideSwim()) |
| 19990 | { | ||
| 19991 | ✗ | dy = up_step; | |
| 19992 | ✗ | } | |
| 19993 | 21948 | break; | |
| 19994 | case down: | ||
| 19995 |
1/2✓ Branch 0 taken 19079 times.
✗ Branch 1 not taken.
|
19079 | dy = step; |
| 19996 |
2/6✓ Branch 0 taken 19079 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 19079 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
19079 | if (IsSideSwim()) dy = down_step; |
| 19997 | 19079 | break; | |
| 19998 | } | ||
| 19999 |
3/6✓ Branch 0 taken 171310 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 171310 times.
✓ Branch 4 taken 171310 times.
✗ Branch 5 not taken.
|
171310 | dx = IsSideSwim() ? right_step : step; |
| 20000 | 171310 | break; | |
| 20001 | }; | ||
| 20002 | 596106 | } | |
| 20003 | else | ||
| 20004 | { | ||
| 20005 | ✗ | switch (movedir) | |
| 20006 | { | ||
| 20007 | case up: | ||
| 20008 | ✗ | dy = IsSideSwim() ? up_step : -step; | |
| 20009 | ✗ | break; | |
| 20010 | case down: | ||
| 20011 | ✗ | dy = IsSideSwim() ? down_step : step; | |
| 20012 | ✗ | break; | |
| 20013 | case left: | ||
| 20014 | ✗ | dx = IsSideSwim() ? left_step : -step; | |
| 20015 | ✗ | break; | |
| 20016 | case right: | ||
| 20017 | ✗ | dx = IsSideSwim() ? right_step : step; | |
| 20018 | ✗ | break; | |
| 20019 | }; | ||
| 20020 | } | ||
| 20021 | |||
| 20022 |
5/8✓ Branch 0 taken 596106 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 761 times.
✓ Branch 3 taken 595345 times.
✓ Branch 4 taken 761 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 761 times.
|
596106 | if (isSideViewHero() && slopeid) |
| 20023 | { | ||
| 20024 | ✗ | dy += (dx*slopeid); | |
| 20025 | ✗ | } | |
| 20026 | |||
| 20027 |
9/18✓ Branch 0 taken 5614 times.
✓ Branch 1 taken 590492 times.
✓ Branch 2 taken 590644 times.
✓ Branch 3 taken 5462 times.
✓ Branch 4 taken 590492 times.
✓ Branch 5 taken 152 times.
✓ Branch 6 taken 590492 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 590492 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 590492 times.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
596106 | if((charging==0 || attack==wHammer) && spins==0 && attackclk!=HAMMERCHARGEFRAME && action != sideswimattacking && !(IsSideSwim() && get_qr(qr_SIDESWIMDIR) && (movedir == up || movedir == down))) //!DIRECTION SET |
| 20028 | { | ||
| 20029 | 590492 | facedir = movedir; | |
| 20030 | 590492 | } | |
| 20031 |
2/14✓ Branch 0 taken 5614 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5614 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
|
5614 | else if (IsSideSwim() && get_qr(qr_SIDESWIMDIR) && (movedir == up || movedir == down) && (shiftdir == left || shiftdir == right) && (charging==0 && spins==0)) |
| 20032 | { | ||
| 20033 | ✗ | facedir = shiftdir; | |
| 20034 | ✗ | } | |
| 20035 | 1347916 | } | |
| 20036 | |||
| 20037 | 596579 | bool HeroClass::new_engine_move(zfix dx, zfix dy) //no collision check | |
| 20038 | { | ||
| 20039 |
5/6✓ Branch 0 taken 175920 times.
✓ Branch 1 taken 420659 times.
✓ Branch 2 taken 154 times.
✓ Branch 3 taken 175766 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 154 times.
|
596579 | if(!dx && !dy && !is_autowalking()) return true; |
| 20040 |
5/8✓ Branch 0 taken 590135 times.
✓ Branch 1 taken 6290 times.
✓ Branch 2 taken 590135 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 590135 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 590135 times.
|
596425 | if(action != swimming && action != sideswimming && action != sideswimhit && action != sideswimattacking) |
| 20041 | { | ||
| 20042 | 590135 | herostep(); | |
| 20043 | |||
| 20044 | //ack... don't walk if in midair! -DD | ||
| 20045 |
12/14✓ Branch 0 taken 584521 times.
✓ Branch 1 taken 5614 times.
✓ Branch 2 taken 584521 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 583538 times.
✓ Branch 5 taken 983 times.
✓ Branch 6 taken 583538 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 761 times.
✓ Branch 9 taken 582777 times.
✓ Branch 10 taken 652 times.
✓ Branch 11 taken 109 times.
✓ Branch 12 taken 200 times.
✓ Branch 13 taken 452 times.
|
590135 | if(charging==0 && spins==0 && z==0 && fakez==0 && !(isSideViewHero() && !on_sideview_solid_oldpos(this) && !getOnSideviewLadder())) |
| 20046 | { | ||
| 20047 | 583086 | action=walking; FFCore.setHeroAction(walking); | |
| 20048 | 583086 | } | |
| 20049 | |||
| 20050 |
2/2✓ Branch 0 taken 558834 times.
✓ Branch 1 taken 31301 times.
|
590135 | if(++hero_count > (16*hero_animation_speed)) |
| 20051 | 31301 | hero_count=0; | |
| 20052 | 590135 | } | |
| 20053 |
2/2✓ Branch 0 taken 3148 times.
✓ Branch 1 taken 3142 times.
|
6290 | else if(!(frame & 1)) |
| 20054 | { | ||
| 20055 | 3142 | herostep(); | |
| 20056 | 3142 | } | |
| 20057 | |||
| 20058 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 596425 times.
|
596425 | if(is_autowalking()) |
| 20059 | ✗ | autowalk_move(); | |
| 20060 |
4/4✓ Branch 0 taken 5614 times.
✓ Branch 1 taken 590811 times.
✓ Branch 2 taken 5462 times.
✓ Branch 3 taken 152 times.
|
596425 | else if(charging==0 || attack!=wHammer) |
| 20061 | 596273 | return movexy(dx,dy,false,false,true); | |
| 20062 | 152 | return true; | |
| 20063 | 596579 | } | |
| 20064 | |||
| 20065 | 7461833 | void HeroClass::moveOld(int32_t d2) | |
| 20066 | { | ||
| 20067 | static bool totalskip = false; | ||
| 20068 | |||
| 20069 |
3/6✓ Branch 0 taken 7461833 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7461833 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 7461833 times.
|
7461833 | if( inlikelike || lstunclock > 0 || is_conveyor_stunned) |
| 20070 | ✗ | return; | |
| 20071 | |||
| 20072 | 7461833 | int32_t dx=0,dy=0; | |
| 20073 | 7461833 | int32_t xstep=lsteps[x.getInt()&7]; | |
| 20074 | 7461833 | int32_t ystep=lsteps[y.getInt()&7]; | |
| 20075 | 7461833 | int32_t z3skip=0; | |
| 20076 | 7461833 | int32_t z3diagskip=0; | |
| 20077 |
5/6✓ Branch 0 taken 200742 times.
✓ Branch 1 taken 7261091 times.
✓ Branch 2 taken 200680 times.
✓ Branch 3 taken 62 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 62 times.
|
14722986 | bool slowcombo = (combo_class_buf[combobuf[MAPCOMBO(x+7,y+8)].type].slow_movement && ((z==0 && fakez == 0) || hero_scr->flags2&fAIRCOMBOS)) || |
| 20078 |
5/6✓ Branch 0 taken 190641 times.
✓ Branch 1 taken 7070512 times.
✓ Branch 2 taken 104043 times.
✓ Branch 3 taken 86598 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 104043 times.
|
7261153 | (isSideViewHero() && (on_sideview_solid_oldpos(this)||getOnSideviewLadder()) && combo_class_buf[combobuf[MAPCOMBO(x+7,y+8)].type].slow_movement); |
| 20079 |
2/2✓ Branch 0 taken 7436018 times.
✓ Branch 1 taken 25815 times.
|
7461833 | bool slowcharging = charging>0 && (itemsbuf[getWpnPressed(itype_sword)].flags & item_flag10); |
| 20080 | 7461833 | bool is_swimming = (action == swimming); | |
| 20081 | |||
| 20082 | //slow walk combo, or charging, moves at 2/3 speed | ||
| 20083 | if( | ||
| 20084 |
4/4✓ Branch 0 taken 7360999 times.
✓ Branch 1 taken 100834 times.
✓ Branch 2 taken 201043 times.
✓ Branch 3 taken 7159956 times.
|
7562667 | (!is_swimming && (slowcharging ^ slowcombo))|| |
| 20085 |
2/2✓ Branch 0 taken 100834 times.
✓ Branch 1 taken 7159956 times.
|
7260790 | (is_swimming && (zinit.hero_swim_speed>60)) |
| 20086 | ) | ||
| 20087 | { | ||
| 20088 | 301877 | totalskip = false; | |
| 20089 | |||
| 20090 |
2/2✓ Branch 0 taken 49244 times.
✓ Branch 1 taken 252633 times.
|
301877 | if(diagonalMovement) |
| 20091 | { | ||
| 20092 | 49244 | skipstep=(skipstep+1)%6; | |
| 20093 | |||
| 20094 |
2/2✓ Branch 0 taken 25024 times.
✓ Branch 1 taken 24220 times.
|
49244 | if(skipstep%2==0) z3skip=1; |
| 20095 | 25024 | else z3skip=0; | |
| 20096 | |||
| 20097 |
2/2✓ Branch 0 taken 33205 times.
✓ Branch 1 taken 16039 times.
|
49244 | if(skipstep%3==0) z3diagskip=1; |
| 20098 | 33205 | else z3diagskip=0; | |
| 20099 | 49244 | } | |
| 20100 | else | ||
| 20101 | { | ||
| 20102 |
2/2✓ Branch 0 taken 165339 times.
✓ Branch 1 taken 87294 times.
|
252633 | if(d2<left) |
| 20103 | { | ||
| 20104 |
2/2✓ Branch 0 taken 99954 times.
✓ Branch 1 taken 65385 times.
|
165339 | if(ystep>1) |
| 20105 | { | ||
| 20106 | 65385 | skipstep^=1; | |
| 20107 | 65385 | ystep=skipstep; | |
| 20108 | 65385 | } | |
| 20109 | 165339 | } | |
| 20110 | else | ||
| 20111 | { | ||
| 20112 |
2/2✓ Branch 0 taken 53050 times.
✓ Branch 1 taken 34244 times.
|
87294 | if(xstep>1) |
| 20113 | { | ||
| 20114 | 34244 | skipstep^=1; | |
| 20115 | 34244 | xstep=skipstep; | |
| 20116 | 34244 | } | |
| 20117 | } | ||
| 20118 | } | ||
| 20119 | 301877 | } | |
| 20120 | // else if(is_swimming || (slowcharging && slowcombo)) | ||
| 20121 | else if( | ||
| 20122 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 7159956 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
7160067 | (is_swimming && (zinit.hero_swim_speed<60))|| |
| 20123 |
2/2✓ Branch 0 taken 111 times.
✓ Branch 1 taken 7159845 times.
|
7159956 | (slowcharging && slowcombo) |
| 20124 | ) | ||
| 20125 | { | ||
| 20126 | //swimming, or charging on a slow combo, moves at 1/2 speed | ||
| 20127 | 111 | totalskip = !totalskip; | |
| 20128 | |||
| 20129 |
1/2✓ Branch 0 taken 111 times.
✗ Branch 1 not taken.
|
111 | if(diagonalMovement) |
| 20130 | { | ||
| 20131 | ✗ | skipstep=0; | |
| 20132 | ✗ | } | |
| 20133 | 111 | } | |
| 20134 | else | ||
| 20135 | { | ||
| 20136 | 7159845 | totalskip = false; | |
| 20137 | |||
| 20138 |
2/2✓ Branch 0 taken 5124956 times.
✓ Branch 1 taken 2034889 times.
|
7159845 | if(diagonalMovement) |
| 20139 | { | ||
| 20140 | 2034889 | skipstep=0; | |
| 20141 | 2034889 | } | |
| 20142 | } | ||
| 20143 | |||
| 20144 |
2/2✓ Branch 0 taken 56 times.
✓ Branch 1 taken 7461777 times.
|
7461833 | if(!totalskip) |
| 20145 | { | ||
| 20146 |
2/2✓ Branch 0 taken 2084133 times.
✓ Branch 1 taken 5377644 times.
|
7461777 | if(diagonalMovement) |
| 20147 | { | ||
| 20148 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 446218 times.
✓ Branch 2 taken 376935 times.
✓ Branch 3 taken 662678 times.
✓ Branch 4 taken 598302 times.
|
2084133 | switch(d2) |
| 20149 | { | ||
| 20150 | case up: | ||
| 20151 |
2/2✓ Branch 0 taken 45459 times.
✓ Branch 1 taken 400759 times.
|
446218 | if(shiftdir==left) |
| 20152 | { | ||
| 20153 |
2/2✓ Branch 0 taken 35961 times.
✓ Branch 1 taken 9498 times.
|
45459 | if(walkable) |
| 20154 | { | ||
| 20155 | 35961 | dy-=1-z3diagskip; | |
| 20156 | 35961 | dx-=1-z3diagskip; | |
| 20157 | 35961 | z3step=2; | |
| 20158 | 35961 | } | |
| 20159 | else | ||
| 20160 | { | ||
| 20161 | 9498 | dx-=1-z3diagskip; | |
| 20162 | 9498 | z3step=2; | |
| 20163 | } | ||
| 20164 | 45459 | } | |
| 20165 |
2/2✓ Branch 0 taken 54669 times.
✓ Branch 1 taken 346090 times.
|
400759 | else if(shiftdir==right) |
| 20166 | { | ||
| 20167 |
2/2✓ Branch 0 taken 43543 times.
✓ Branch 1 taken 11126 times.
|
54669 | if(walkable) |
| 20168 | { | ||
| 20169 | 43543 | dy-=1-z3diagskip; | |
| 20170 | 43543 | dx+=1-z3diagskip; | |
| 20171 | 43543 | z3step=2; | |
| 20172 | 43543 | } | |
| 20173 | else | ||
| 20174 | { | ||
| 20175 | 11126 | dx+=1-z3diagskip; | |
| 20176 | 11126 | z3step=2; | |
| 20177 | } | ||
| 20178 | 54669 | } | |
| 20179 | else | ||
| 20180 | { | ||
| 20181 |
2/2✓ Branch 0 taken 62104 times.
✓ Branch 1 taken 283986 times.
|
346090 | if(walkable) |
| 20182 | { | ||
| 20183 | 283986 | dy-=z3step-z3skip; | |
| 20184 | 283986 | z3step=(z3step%2)+1; | |
| 20185 | 283986 | } | |
| 20186 | } | ||
| 20187 | |||
| 20188 | 446218 | break; | |
| 20189 | |||
| 20190 | case down: | ||
| 20191 |
2/2✓ Branch 0 taken 50975 times.
✓ Branch 1 taken 325960 times.
|
376935 | if(shiftdir==left) |
| 20192 | { | ||
| 20193 |
2/2✓ Branch 0 taken 38415 times.
✓ Branch 1 taken 12560 times.
|
50975 | if(walkable) |
| 20194 | { | ||
| 20195 | 38415 | dy+=1-z3diagskip; | |
| 20196 | 38415 | dx-=1-z3diagskip; | |
| 20197 | 38415 | z3step=2; | |
| 20198 | 38415 | } | |
| 20199 | else | ||
| 20200 | { | ||
| 20201 | 12560 | dx-=1-z3diagskip; | |
| 20202 | 12560 | z3step=2; | |
| 20203 | } | ||
| 20204 | 50975 | } | |
| 20205 |
2/2✓ Branch 0 taken 52314 times.
✓ Branch 1 taken 273646 times.
|
325960 | else if(shiftdir==right) |
| 20206 | { | ||
| 20207 |
2/2✓ Branch 0 taken 39775 times.
✓ Branch 1 taken 12539 times.
|
52314 | if(walkable) |
| 20208 | { | ||
| 20209 | 39775 | dy+=1-z3diagskip; | |
| 20210 | 39775 | dx+=1-z3diagskip; | |
| 20211 | 39775 | z3step=2; | |
| 20212 | 39775 | } | |
| 20213 | else | ||
| 20214 | { | ||
| 20215 | 12539 | dx+=1-z3diagskip; | |
| 20216 | 12539 | z3step=2; | |
| 20217 | } | ||
| 20218 | 52314 | } | |
| 20219 | else | ||
| 20220 | { | ||
| 20221 |
2/2✓ Branch 0 taken 47541 times.
✓ Branch 1 taken 226105 times.
|
273646 | if(walkable) |
| 20222 | { | ||
| 20223 | 226105 | dy+=z3step-z3skip; | |
| 20224 | 226105 | z3step=(z3step%2)+1; | |
| 20225 | 226105 | } | |
| 20226 | } | ||
| 20227 | |||
| 20228 | 376935 | break; | |
| 20229 | |||
| 20230 | case right: | ||
| 20231 |
2/2✓ Branch 0 taken 592932 times.
✓ Branch 1 taken 69746 times.
|
662678 | if(shiftdir==up) |
| 20232 | { | ||
| 20233 |
2/2✓ Branch 0 taken 58004 times.
✓ Branch 1 taken 11742 times.
|
69746 | if(walkable) |
| 20234 | { | ||
| 20235 | 58004 | dy-=1-z3diagskip; | |
| 20236 | 58004 | dx+=1-z3diagskip; | |
| 20237 | 58004 | z3step=2; | |
| 20238 | 58004 | } | |
| 20239 | else | ||
| 20240 | { | ||
| 20241 | 11742 | dy-=1-z3diagskip; | |
| 20242 | 11742 | z3step=2; | |
| 20243 | } | ||
| 20244 | 69746 | } | |
| 20245 |
2/2✓ Branch 0 taken 54368 times.
✓ Branch 1 taken 538564 times.
|
592932 | else if(shiftdir==down) |
| 20246 | { | ||
| 20247 |
2/2✓ Branch 0 taken 45042 times.
✓ Branch 1 taken 9326 times.
|
54368 | if(walkable) |
| 20248 | { | ||
| 20249 | 45042 | dy+=1-z3diagskip; | |
| 20250 | 45042 | dx+=1-z3diagskip; | |
| 20251 | 45042 | z3step=2; | |
| 20252 | 45042 | } | |
| 20253 | else | ||
| 20254 | { | ||
| 20255 | 9326 | dy+=1-z3diagskip; | |
| 20256 | 9326 | z3step=2; | |
| 20257 | } | ||
| 20258 | 54368 | } | |
| 20259 | else | ||
| 20260 | { | ||
| 20261 |
2/2✓ Branch 0 taken 61923 times.
✓ Branch 1 taken 476641 times.
|
538564 | if(walkable) |
| 20262 | { | ||
| 20263 | 476641 | dx+=z3step-z3skip; | |
| 20264 | 476641 | z3step=(z3step%2)+1; | |
| 20265 | 476641 | } | |
| 20266 | } | ||
| 20267 | |||
| 20268 | 662678 | break; | |
| 20269 | |||
| 20270 | case left: | ||
| 20271 |
2/2✓ Branch 0 taken 532641 times.
✓ Branch 1 taken 65661 times.
|
598302 | if(shiftdir==up) |
| 20272 | { | ||
| 20273 |
2/2✓ Branch 0 taken 55678 times.
✓ Branch 1 taken 9983 times.
|
65661 | if(walkable) |
| 20274 | { | ||
| 20275 | 55678 | dy-=1-z3diagskip; | |
| 20276 | 55678 | dx-=1-z3diagskip; | |
| 20277 | 55678 | z3step=2; | |
| 20278 | 55678 | } | |
| 20279 | else | ||
| 20280 | { | ||
| 20281 | 9983 | dy-=1-z3diagskip; | |
| 20282 | 9983 | z3step=2; | |
| 20283 | } | ||
| 20284 | 65661 | } | |
| 20285 |
2/2✓ Branch 0 taken 50757 times.
✓ Branch 1 taken 481884 times.
|
532641 | else if(shiftdir==down) |
| 20286 | { | ||
| 20287 |
2/2✓ Branch 0 taken 42812 times.
✓ Branch 1 taken 7945 times.
|
50757 | if(walkable) |
| 20288 | { | ||
| 20289 | 42812 | dy+=1-z3diagskip; | |
| 20290 | 42812 | dx-=1-z3diagskip; | |
| 20291 | 42812 | z3step=2; | |
| 20292 | 42812 | } | |
| 20293 | else | ||
| 20294 | { | ||
| 20295 | 7945 | dy+=1-z3diagskip; | |
| 20296 | 7945 | z3step=2; | |
| 20297 | } | ||
| 20298 | 50757 | } | |
| 20299 | else | ||
| 20300 | { | ||
| 20301 |
2/2✓ Branch 0 taken 50775 times.
✓ Branch 1 taken 431109 times.
|
481884 | if(walkable) |
| 20302 | { | ||
| 20303 | 431109 | dx-=z3step-z3skip; | |
| 20304 | 431109 | z3step=(z3step%2)+1; | |
| 20305 | 431109 | } | |
| 20306 | } | ||
| 20307 | |||
| 20308 | 598302 | break; | |
| 20309 | } | ||
| 20310 | 2084133 | } | |
| 20311 | else | ||
| 20312 | { | ||
| 20313 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 1268161 times.
✓ Branch 2 taken 1035864 times.
✓ Branch 3 taken 1490695 times.
✓ Branch 4 taken 1582924 times.
|
5377644 | switch(d2) |
| 20314 | { | ||
| 20315 | case up: | ||
| 20316 |
7/14✓ Branch 0 taken 308 times.
✓ Branch 1 taken 1267853 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 308 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 308 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 308 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 308 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 308 times.
|
1268161 | if(!isSideViewHero() || (ladderx && laddery && ladderdir==up) || getOnSideviewLadder() || action == sideswimming || action == sideswimhit || action == sideswimattacking) dy-=ystep; |
| 20317 | |||
| 20318 | 1268161 | break; | |
| 20319 | |||
| 20320 | case down: | ||
| 20321 |
7/14✓ Branch 0 taken 54 times.
✓ Branch 1 taken 1035810 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 54 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 54 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 54 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 54 times.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✓ Branch 13 taken 54 times.
|
1035864 | if(!isSideViewHero() || (ladderx && laddery && ladderdir==up) || getOnSideviewLadder() || action == sideswimming || action == sideswimhit || action == sideswimattacking) dy+=ystep; |
| 20322 | |||
| 20323 | 1035864 | break; | |
| 20324 | |||
| 20325 | case left: | ||
| 20326 | 1490695 | dx-=xstep; | |
| 20327 | 1490695 | break; | |
| 20328 | |||
| 20329 | case right: | ||
| 20330 | 1582924 | dx+=xstep; | |
| 20331 | 1582924 | break; | |
| 20332 | } | ||
| 20333 | } | ||
| 20334 | 7461777 | } | |
| 20335 | |||
| 20336 |
8/16✓ Branch 0 taken 25815 times.
✓ Branch 1 taken 7436018 times.
✓ Branch 2 taken 7435739 times.
✓ Branch 3 taken 26094 times.
✓ Branch 4 taken 7435470 times.
✓ Branch 5 taken 269 times.
✓ Branch 6 taken 7435470 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 7435470 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
7461833 | if((charging==0 || attack==wHammer) && spins==0 && attackclk!=HAMMERCHARGEFRAME && action != sideswimattacking && !(IsSideSwim() && get_qr(qr_SIDESWIMDIR) && (d2 == up || d2 == down))) //!DIRECTION SET |
| 20337 | { | ||
| 20338 | 7435470 | dir=d2; | |
| 20339 | 7435470 | } | |
| 20340 |
1/12✗ Branch 0 not taken.
✓ Branch 1 taken 26363 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
26363 | else if (IsSideSwim() && get_qr(qr_SIDESWIMDIR) && (d2 == up || d2 == down) && (shiftdir == left || shiftdir == right) && (charging==0 && spins==0)) |
| 20341 | { | ||
| 20342 | ✗ | dir = shiftdir; | |
| 20343 | ✗ | } | |
| 20344 | |||
| 20345 |
3/4✓ Branch 0 taken 7360999 times.
✓ Branch 1 taken 100834 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 7360999 times.
|
7461833 | if(action != swimming && !IsSideSwim()) |
| 20346 | { | ||
| 20347 | 7360999 | herostep(); | |
| 20348 | |||
| 20349 | //ack... don't walk if in midair! -DD | ||
| 20350 |
12/14✓ Branch 0 taken 7335184 times.
✓ Branch 1 taken 25815 times.
✓ Branch 2 taken 7334905 times.
✓ Branch 3 taken 279 times.
✓ Branch 4 taken 7325040 times.
✓ Branch 5 taken 9865 times.
✓ Branch 6 taken 7325040 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 190641 times.
✓ Branch 9 taken 7134399 times.
✓ Branch 10 taken 104043 times.
✓ Branch 11 taken 86598 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 104043 times.
|
7360999 | if(charging==0 && spins==0 && z==0 && fakez==0 && !(isSideViewHero() && !on_sideview_solid_oldpos(this) && !getOnSideviewLadder())) |
| 20351 | { | ||
| 20352 | 7220997 | action=walking; FFCore.setHeroAction(walking); | |
| 20353 | 7220997 | } | |
| 20354 | |||
| 20355 |
2/2✓ Branch 0 taken 6967261 times.
✓ Branch 1 taken 393738 times.
|
7360999 | if(++hero_count > (16*hero_animation_speed)) |
| 20356 | 393738 | hero_count=0; | |
| 20357 | 7360999 | } | |
| 20358 |
2/2✓ Branch 0 taken 50397 times.
✓ Branch 1 taken 50437 times.
|
100834 | else if(!(frame & 1)) |
| 20359 | { | ||
| 20360 | 50437 | herostep(); | |
| 20361 | 50437 | } | |
| 20362 | |||
| 20363 |
3/4✓ Branch 0 taken 25815 times.
✓ Branch 1 taken 7436018 times.
✓ Branch 2 taken 25815 times.
✗ Branch 3 not taken.
|
7461833 | if(charging==0 || attack!=wHammer) |
| 20364 | { | ||
| 20365 | 7461833 | sprite::move((zfix)dx,(zfix)dy); | |
| 20366 | 7461833 | } | |
| 20367 | 7461833 | } | |
| 20368 | 7832512 | void HeroClass::moveOld2(int32_t d2, int32_t forceRate) | |
| 20369 | { | ||
| 20370 |
4/6✓ Branch 0 taken 7829913 times.
✓ Branch 1 taken 2599 times.
✓ Branch 2 taken 7829913 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 7829913 times.
|
7832512 | if( inlikelike || lstunclock > 0 || is_conveyor_stunned) |
| 20371 | 2599 | return; | |
| 20372 | |||
| 20373 |
3/4✓ Branch 0 taken 7461833 times.
✓ Branch 1 taken 368080 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 7461833 times.
|
7829913 | if(!get_qr(qr_NEW_HERO_MOVEMENT) && !IsSideSwim()) |
| 20374 | { | ||
| 20375 | 7461833 | moveOld(d2); | |
| 20376 | 7461833 | return; | |
| 20377 | } | ||
| 20378 | |||
| 20379 |
4/8✓ Branch 0 taken 9005 times.
✓ Branch 1 taken 359075 times.
✓ Branch 2 taken 9005 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 9005 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
727155 | bool slowcombo = (combo_class_buf[combobuf[MAPCOMBO(x+7,y+8)].type].slow_movement && _effectflag(x+7,y+8,1, -1) && ((z==0 && fakez==0) || hero_scr->flags2&fAIRCOMBOS)) || |
| 20380 |
5/6✓ Branch 0 taken 2454 times.
✓ Branch 1 taken 356621 times.
✓ Branch 2 taken 1050 times.
✓ Branch 3 taken 1404 times.
✓ Branch 4 taken 2454 times.
✗ Branch 5 not taken.
|
359075 | (isSideViewHero() && (on_sideview_solid_oldpos(this)||getOnSideviewLadder()) && combo_class_buf[combobuf[MAPCOMBO(x+7,y+8)].type].slow_movement && _effectflag(x+7,y+8,1, -1)); |
| 20381 | //!DIMITODO: add QR for slow combos under hero | ||
| 20382 |
4/4✓ Branch 0 taken 359075 times.
✓ Branch 1 taken 9005 times.
✓ Branch 2 taken 9005 times.
✓ Branch 3 taken 18010 times.
|
386090 | if(slowcombo) for (int32_t i = 1; i <= 2; ++i) |
| 20383 | { | ||
| 20384 |
2/2✓ Branch 0 taken 584 times.
✓ Branch 1 taken 17426 times.
|
18010 | if (get_scr_layer_valid(current_screen, i)) |
| 20385 | { | ||
| 20386 |
2/2✓ Branch 0 taken 11904 times.
✓ Branch 1 taken 5522 times.
|
17426 | if (get_qr(qr_OLD_BRIDGE_COMBOS)) |
| 20387 | { | ||
| 20388 |
2/4✓ Branch 0 taken 11904 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 11904 times.
✗ Branch 3 not taken.
|
11904 | if (combobuf[MAPCOMBO2(i-1,x+7,y+8)].type == cBRIDGE && !_walkflag_layer(x+7,y+8)) |
| 20389 | { | ||
| 20390 | ✗ | slowcombo = false; | |
| 20391 | ✗ | break; | |
| 20392 | } | ||
| 20393 | 11904 | } | |
| 20394 | else | ||
| 20395 | { | ||
| 20396 |
2/4✓ Branch 0 taken 5522 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5522 times.
✗ Branch 3 not taken.
|
5522 | if (combobuf[MAPCOMBO2(i-1,x+7,y+8)].type == cBRIDGE && _effectflag_layer(x+7,y+8)) |
| 20397 | { | ||
| 20398 | ✗ | slowcombo = false; | |
| 20399 | ✗ | break; | |
| 20400 | } | ||
| 20401 | } | ||
| 20402 | 17426 | } | |
| 20403 | 27015 | } | |
| 20404 |
2/2✓ Branch 0 taken 365811 times.
✓ Branch 1 taken 2269 times.
|
368080 | bool slowcharging = charging>0 && (itemsbuf[getWpnPressed(itype_sword)].flags & item_flag10); |
| 20405 | 368080 | bool is_swimming = (action == swimming); | |
| 20406 | 368080 | bool fastSwim = (zinit.hero_swim_speed>60); | |
| 20407 | 368080 | zfix rate(steprate); | |
| 20408 | 368080 | int32_t shieldid = getCurrentActiveShield(); | |
| 20409 |
1/2✓ Branch 0 taken 368080 times.
✗ Branch 1 not taken.
|
368080 | if(shieldid > -1) |
| 20410 | { | ||
| 20411 | ✗ | itemdata const& shield = itemsbuf[shieldid]; | |
| 20412 | ✗ | if(shield.flags & item_flag10) //Change Speed flag | |
| 20413 | { | ||
| 20414 | ✗ | zfix perc = shield.misc7; | |
| 20415 | ✗ | perc /= 100; | |
| 20416 | ✗ | if(perc < 0) | |
| 20417 | ✗ | perc = (perc*-1)+1; | |
| 20418 | ✗ | rate = (rate * perc) + shield.misc8; | |
| 20419 | ✗ | } | |
| 20420 | ✗ | } | |
| 20421 | |||
| 20422 | 368080 | zfix dx, dy; | |
| 20423 | 368080 | zfix movepix(rate / 100); | |
| 20424 | 368080 | zfix step(movepix); | |
| 20425 | 368080 | zfix step_diag(movepix); | |
| 20426 | 368080 | zfix up_step(game->get_sideswim_up() / -100.0); | |
| 20427 | 368080 | zfix left_step(game->get_sideswim_side() / -100.0); | |
| 20428 | 368080 | zfix right_step(game->get_sideswim_side() / 100.0); | |
| 20429 | 368080 | zfix down_step(game->get_sideswim_down() / 100.0); | |
| 20430 | 368080 | bool checkladder = false; | |
| 20431 | |||
| 20432 |
2/2✓ Branch 0 taken 367877 times.
✓ Branch 1 taken 203 times.
|
368080 | if(hero_newstep > movepix) hero_newstep = movepix; |
| 20433 |
2/2✓ Branch 0 taken 367877 times.
✓ Branch 1 taken 203 times.
|
368080 | if(hero_newstep_diag > movepix) hero_newstep_diag = movepix; |
| 20434 | //2/3 speed | ||
| 20435 |
5/6✗ Branch 0 not taken.
✓ Branch 1 taken 368080 times.
✓ Branch 2 taken 356888 times.
✓ Branch 3 taken 356888 times.
✓ Branch 4 taken 368080 times.
✓ Branch 5 taken 356888 times.
|
368080 | if((is_swimming && fastSwim) || (!is_swimming && (slowcharging ^ slowcombo))) |
| 20436 | { | ||
| 20437 | 724968 | step = ((step / 3.0) * 2); | |
| 20438 | 724968 | step_diag = ((step_diag / 3.0) * 2); | |
| 20439 | 724968 | up_step = ((up_step / 3.0) * 2); | |
| 20440 | 724968 | left_step = ((left_step / 3.0) * 2); | |
| 20441 | 724968 | right_step = ((right_step / 3.0) * 2); | |
| 20442 | 724968 | down_step = ((down_step / 3.0) * 2); | |
| 20443 | 724968 | } | |
| 20444 | //1/2 speed | ||
| 20445 |
3/6✗ Branch 0 not taken.
✓ Branch 1 taken 356888 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✓ Branch 4 taken 31 times.
✓ Branch 5 taken 356857 times.
|
356888 | else if((is_swimming && !fastSwim) || (slowcharging && slowcombo)) |
| 20446 | { | ||
| 20447 | 31 | step /= 2; | |
| 20448 | 31 | step_diag /= 2; | |
| 20449 | 31 | up_step /= 2; | |
| 20450 | 31 | left_step /= 2; | |
| 20451 | 31 | right_step /= 2; | |
| 20452 | 31 | down_step /= 2; | |
| 20453 | 31 | } | |
| 20454 | //normal speed | ||
| 20455 | else | ||
| 20456 | { | ||
| 20457 | //no modification | ||
| 20458 | } | ||
| 20459 | |||
| 20460 |
1/2✓ Branch 0 taken 368080 times.
✗ Branch 1 not taken.
|
368080 | if(diagonalMovement) |
| 20461 | { | ||
| 20462 |
6/6✓ Branch 0 taken 290293 times.
✓ Branch 1 taken 77787 times.
✓ Branch 2 taken 311341 times.
✓ Branch 3 taken 21048 times.
✓ Branch 4 taken 136480 times.
✓ Branch 5 taken 252648 times.
|
560267 | if(((d2 == up || d2 == down) && (shiftdir == left || shiftdir == right)) || |
| 20463 |
4/4✓ Branch 0 taken 227037 times.
✓ Branch 1 taken 205989 times.
✓ Branch 2 taken 14854 times.
✓ Branch 3 taken 212183 times.
|
21048 | (d2 == left || d2 == right) && (shiftdir == up || shiftdir == down)) |
| 20464 | { | ||
| 20465 |
3/4✓ Branch 0 taken 75915 times.
✓ Branch 1 taken 104 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 75915 times.
|
581315 | if(hero_newstep > 0 && hero_newstep_diag > 0) |
| 20466 | { | ||
| 20467 | 75915 | step = STEP_DIAGONAL(step); | |
| 20468 | 75915 | step_diag = STEP_DIAGONAL(step_diag); | |
| 20469 | 75915 | up_step = STEP_DIAGONAL(up_step); | |
| 20470 | 75915 | left_step = STEP_DIAGONAL(left_step); | |
| 20471 | 75915 | right_step = STEP_DIAGONAL(right_step); | |
| 20472 | 75915 | down_step = STEP_DIAGONAL(down_step); | |
| 20473 | 75915 | } | |
| 20474 | 76019 | } | |
| 20475 |
2/2✓ Branch 0 taken 253483 times.
✓ Branch 1 taken 34719 times.
|
288202 | if(hero_newstep < step) step = hero_newstep; //handle collision |
| 20476 |
2/2✓ Branch 0 taken 276732 times.
✓ Branch 1 taken 11470 times.
|
288202 | if(hero_newstep_diag < step_diag) step_diag = hero_newstep_diag; //handle collision |
| 20477 |
5/5✓ Branch 0 taken 79878 times.
✓ Branch 1 taken 77787 times.
✓ Branch 2 taken 76444 times.
✓ Branch 3 taken 105525 times.
✓ Branch 4 taken 108324 times.
|
288202 | switch(d2) |
| 20478 | { | ||
| 20479 | case up: | ||
| 20480 |
3/3✓ Branch 0 taken 61709 times.
✓ Branch 1 taken 7704 times.
✓ Branch 2 taken 8374 times.
|
77787 | switch(shiftdir) |
| 20481 | { | ||
| 20482 | case left: | ||
| 20483 | 7704 | dx = -step_diag; | |
| 20484 |
1/2✓ Branch 0 taken 7704 times.
✗ Branch 1 not taken.
|
7704 | if (IsSideSwim()) dx = left_step; |
| 20485 | 7704 | break; | |
| 20486 | case right: | ||
| 20487 | 8374 | dx = step_diag; | |
| 20488 |
1/2✓ Branch 0 taken 8374 times.
✗ Branch 1 not taken.
|
8374 | if (IsSideSwim()) dx = right_step; |
| 20489 | 8374 | break; | |
| 20490 | } | ||
| 20491 |
2/2✓ Branch 0 taken 11035 times.
✓ Branch 1 taken 66752 times.
|
77787 | if(walkable) |
| 20492 | { | ||
| 20493 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 66752 times.
|
66752 | if (!IsSideSwim()) dy = -step; |
| 20494 |
1/2✓ Branch 0 taken 66752 times.
✗ Branch 1 not taken.
|
66752 | if (IsSideSwim()) |
| 20495 | { | ||
| 20496 | ✗ | dy = up_step; | |
| 20497 | ✗ | if (!iswaterex_z3(MAPCOMBO(x,y+8-(bigHitbox*8)+floor(up_step)), -1, x, y+8-(bigHitbox*8)-2, true, false)) checkladder = true; | |
| 20498 | ✗ | } | |
| 20499 | 66752 | } | |
| 20500 | 77787 | break; | |
| 20501 | case down: | ||
| 20502 |
3/3✓ Branch 0 taken 57004 times.
✓ Branch 1 taken 10047 times.
✓ Branch 2 taken 9393 times.
|
76444 | switch(shiftdir) |
| 20503 | { | ||
| 20504 | case left: | ||
| 20505 | 10047 | dx = -step_diag; | |
| 20506 |
1/2✓ Branch 0 taken 10047 times.
✗ Branch 1 not taken.
|
10047 | if (IsSideSwim()) dx = left_step; |
| 20507 | 10047 | break; | |
| 20508 | case right: | ||
| 20509 | 9393 | dx = step_diag; | |
| 20510 |
1/2✓ Branch 0 taken 9393 times.
✗ Branch 1 not taken.
|
9393 | if (IsSideSwim()) dx = right_step; |
| 20511 | 9393 | break; | |
| 20512 | } | ||
| 20513 |
2/2✓ Branch 0 taken 8382 times.
✓ Branch 1 taken 68062 times.
|
76444 | if(walkable) |
| 20514 | { | ||
| 20515 | 68062 | dy = step; | |
| 20516 |
1/2✓ Branch 0 taken 68062 times.
✗ Branch 1 not taken.
|
68062 | if (IsSideSwim()) dy = down_step; |
| 20517 | 68062 | } | |
| 20518 | 76444 | break; | |
| 20519 | case left: | ||
| 20520 |
3/3✓ Branch 0 taken 85010 times.
✓ Branch 1 taken 10934 times.
✓ Branch 2 taken 9581 times.
|
105525 | switch(shiftdir) |
| 20521 | { | ||
| 20522 | case up: | ||
| 20523 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10934 times.
|
10934 | if (!IsSideSwim()) dy = -step_diag; |
| 20524 |
1/2✓ Branch 0 taken 10934 times.
✗ Branch 1 not taken.
|
10934 | if (IsSideSwim()) |
| 20525 | { | ||
| 20526 | ✗ | dy = up_step; | |
| 20527 | ✗ | if (!iswaterex_z3(MAPCOMBO(x,y+8-(bigHitbox*8)+floor(up_step)), -1, x, y+8-(bigHitbox*8)-2, true, false)) checkladder = true; | |
| 20528 | ✗ | } | |
| 20529 | 10934 | break; | |
| 20530 | case down: | ||
| 20531 | 9581 | dy = step_diag; | |
| 20532 |
1/2✓ Branch 0 taken 9581 times.
✗ Branch 1 not taken.
|
9581 | if (IsSideSwim()) dy = down_step; |
| 20533 | 9581 | break; | |
| 20534 | } | ||
| 20535 |
2/2✓ Branch 0 taken 9965 times.
✓ Branch 1 taken 95560 times.
|
105525 | if(walkable) |
| 20536 | { | ||
| 20537 | 95560 | dx = -step; | |
| 20538 |
1/2✓ Branch 0 taken 95560 times.
✗ Branch 1 not taken.
|
95560 | if (IsSideSwim()) dx = left_step; |
| 20539 | 95560 | } | |
| 20540 | 105525 | break; | |
| 20541 | case right: | ||
| 20542 |
3/3✓ Branch 0 taken 88338 times.
✓ Branch 1 taken 10728 times.
✓ Branch 2 taken 9258 times.
|
108324 | switch(shiftdir) |
| 20543 | { | ||
| 20544 | case up: | ||
| 20545 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10728 times.
|
10728 | if (!IsSideSwim()) dy = -step_diag; |
| 20546 |
1/2✓ Branch 0 taken 10728 times.
✗ Branch 1 not taken.
|
10728 | if (IsSideSwim()) |
| 20547 | { | ||
| 20548 | ✗ | dy = up_step; | |
| 20549 | ✗ | if (!iswaterex_z3(MAPCOMBO(x,y+8-(bigHitbox*8)+floor(up_step)), -1, x, y+8-(bigHitbox*8)-2, true, false)) checkladder = true; | |
| 20550 | ✗ | } | |
| 20551 | 10728 | break; | |
| 20552 | case down: | ||
| 20553 | 9258 | dy = step_diag; | |
| 20554 |
1/2✓ Branch 0 taken 9258 times.
✗ Branch 1 not taken.
|
9258 | if (IsSideSwim()) dy = down_step; |
| 20555 | 9258 | break; | |
| 20556 | } | ||
| 20557 |
2/2✓ Branch 0 taken 10374 times.
✓ Branch 1 taken 97950 times.
|
108324 | if(walkable) |
| 20558 | { | ||
| 20559 | 97950 | dx = step; | |
| 20560 |
1/2✓ Branch 0 taken 97950 times.
✗ Branch 1 not taken.
|
97950 | if (IsSideSwim()) dx = right_step; |
| 20561 | 97950 | } | |
| 20562 | 108324 | break; | |
| 20563 | }; | ||
| 20564 | 447958 | } | |
| 20565 | else | ||
| 20566 | { | ||
| 20567 | ✗ | if(hero_newstep < step) step = hero_newstep; //handle collision | |
| 20568 | ✗ | switch(d2) | |
| 20569 | { | ||
| 20570 | case up: | ||
| 20571 | ✗ | dy -= step; | |
| 20572 | ✗ | if (IsSideSwim()) dy = up_step; | |
| 20573 | ✗ | break; | |
| 20574 | case down: | ||
| 20575 | ✗ | dy += step; | |
| 20576 | ✗ | if (IsSideSwim()) dy = down_step; | |
| 20577 | ✗ | break; | |
| 20578 | case left: | ||
| 20579 | ✗ | dx -= step; | |
| 20580 | ✗ | if (IsSideSwim()) dx = left_step; | |
| 20581 | ✗ | break; | |
| 20582 | case right: | ||
| 20583 | ✗ | dx += step; | |
| 20584 | ✗ | if (IsSideSwim()) dx = right_step; | |
| 20585 | ✗ | break; | |
| 20586 | }; | ||
| 20587 | } | ||
| 20588 | 447958 | hero_newstep = movepix; | |
| 20589 | 447958 | hero_newstep_diag = movepix; | |
| 20590 | |||
| 20591 |
7/16✓ Branch 0 taken 2269 times.
✓ Branch 1 taken 445689 times.
✓ Branch 2 taken 365811 times.
✓ Branch 3 taken 82147 times.
✓ Branch 4 taken 365811 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 365811 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 365811 times.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
|
447958 | if((charging==0 || attack==wHammer) && spins==0 && attackclk!=HAMMERCHARGEFRAME && action != sideswimattacking && !(IsSideSwim() && get_qr(qr_SIDESWIMDIR) && (d2 == up || d2 == down))) //!DIRECTION SET |
| 20592 | { | ||
| 20593 | 365811 | dir=d2; | |
| 20594 | 365811 | } | |
| 20595 |
1/12✗ Branch 0 not taken.
✓ Branch 1 taken 82147 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
82147 | else if (IsSideSwim() && get_qr(qr_SIDESWIMDIR) && (d2 == up || d2 == down) && (shiftdir == left || shiftdir == right) && (charging==0 && spins==0)) |
| 20596 | { | ||
| 20597 | ✗ | dir = shiftdir; | |
| 20598 | ✗ | } | |
| 20599 |
2/2✓ Branch 0 taken 447701 times.
✓ Branch 1 taken 257 times.
|
447958 | if(forceRate > -1) |
| 20600 | { | ||
| 20601 | 257 | checkladder = false; | |
| 20602 |
2/3✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 245 times.
|
257 | switch(dir) |
| 20603 | { | ||
| 20604 | case right: | ||
| 20605 | case r_up: | ||
| 20606 | case r_down: | ||
| 20607 | 12 | dx = zfix(forceRate) / 100; | |
| 20608 | 12 | break; | |
| 20609 | case left: | ||
| 20610 | case l_up: | ||
| 20611 | case l_down: | ||
| 20612 | ✗ | dx = zfix(-forceRate) / 100; | |
| 20613 | ✗ | break; | |
| 20614 | default: | ||
| 20615 | 245 | dx = 0; | |
| 20616 | 245 | } | |
| 20617 |
3/3✓ Branch 0 taken 17 times.
✓ Branch 1 taken 228 times.
✓ Branch 2 taken 12 times.
|
257 | switch(dir) |
| 20618 | { | ||
| 20619 | case down: | ||
| 20620 | case r_down: | ||
| 20621 | case l_down: | ||
| 20622 | 17 | dy = zfix(forceRate) / 100; | |
| 20623 | 17 | break; | |
| 20624 | case up: | ||
| 20625 | case r_up: | ||
| 20626 | case l_up: | ||
| 20627 | 228 | dy = zfix(-forceRate) / 100; | |
| 20628 | 228 | break; | |
| 20629 | default: | ||
| 20630 | 12 | dy = 0; | |
| 20631 | 12 | } | |
| 20632 | 257 | } | |
| 20633 |
4/4✓ Branch 0 taken 2454 times.
✓ Branch 1 taken 445504 times.
✓ Branch 2 taken 1716 times.
✓ Branch 3 taken 738 times.
|
447958 | if (isSideViewHero() && slopeid) |
| 20634 | { | ||
| 20635 | 738 | dy += (dx * slopeid); | |
| 20636 | 738 | } | |
| 20637 |
4/4✓ Branch 0 taken 139312 times.
✓ Branch 1 taken 308646 times.
✓ Branch 2 taken 111086 times.
✓ Branch 3 taken 28226 times.
|
447958 | if(dx == 0 && dy == 0) return; |
| 20638 |
5/8✓ Branch 0 taken 339854 times.
✓ Branch 1 taken 79878 times.
✓ Branch 2 taken 339854 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 339854 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 339854 times.
|
419732 | if(action != swimming && action != sideswimming && action != sideswimhit && action != sideswimattacking) |
| 20639 | { | ||
| 20640 | 339854 | herostep(); | |
| 20641 | |||
| 20642 | //ack... don't walk if in midair! -DD | ||
| 20643 |
11/14✓ Branch 0 taken 337851 times.
✓ Branch 1 taken 2003 times.
✓ Branch 2 taken 337851 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 335538 times.
✓ Branch 5 taken 2313 times.
✓ Branch 6 taken 335538 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 2390 times.
✓ Branch 9 taken 333148 times.
✓ Branch 10 taken 1016 times.
✓ Branch 11 taken 1374 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 1016 times.
|
339854 | if(charging==0 && spins==0 && z==0 && fakez==0 && !(isSideViewHero() && !on_sideview_solid_oldpos(this) && !getOnSideviewLadder())) |
| 20644 | { | ||
| 20645 | 334522 | action=walking; FFCore.setHeroAction(walking); | |
| 20646 | 334522 | } | |
| 20647 | |||
| 20648 |
2/2✓ Branch 0 taken 321950 times.
✓ Branch 1 taken 17904 times.
|
339854 | if(++hero_count > (16*hero_animation_speed)) |
| 20649 | 17904 | hero_count=0; | |
| 20650 | 339854 | } | |
| 20651 |
1/2✓ Branch 0 taken 79878 times.
✗ Branch 1 not taken.
|
79878 | else if(!(frame & 1)) |
| 20652 | { | ||
| 20653 | ✗ | herostep(); | |
| 20654 | ✗ | } | |
| 20655 | |||
| 20656 |
4/4✓ Branch 0 taken 2003 times.
✓ Branch 1 taken 417729 times.
✓ Branch 2 taken 77875 times.
✓ Branch 3 taken 75872 times.
|
419732 | if(charging==0 || attack!=wHammer) |
| 20657 | { | ||
| 20658 | 495604 | sprite::move(dx, dy); | |
| 20659 | 495604 | WalkflagInfo info; | |
| 20660 | 495604 | info = walkflag(x,y+8-(bigHitbox*8)-4,2,up); | |
| 20661 | 495604 | execute(info); | |
| 20662 |
2/8✗ Branch 0 not taken.
✓ Branch 1 taken 339854 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✓ Branch 6 taken 339854 times.
✗ Branch 7 not taken.
|
495604 | if (checkladder && !canSideviewLadderRemote(x, y-4) && !info.isUnwalkable() && (y + 8 - (bigHitbox * 8) - 4) > 0) |
| 20663 | { | ||
| 20664 | ✗ | if (game->get_sideswim_jump() != 0) | |
| 20665 | { | ||
| 20666 | ✗ | setFall(zfix(0-(FEATHERJUMP*(game->get_sideswim_jump()/10000.0)))); | |
| 20667 | ✗ | sfx(WAV_ZN1SPLASH,(int32_t)x); | |
| 20668 | ✗ | hopclk = 0; | |
| 20669 | ✗ | if (charging || spins) action = attacking; | |
| 20670 | ✗ | else action = none; | |
| 20671 | ✗ | } | |
| 20672 | else | ||
| 20673 | { | ||
| 20674 | ✗ | sprite::move(0_zf, zfix(-1*dy)); | |
| 20675 | } | ||
| 20676 | ✗ | } | |
| 20677 | 339854 | } | |
| 20678 | 7908384 | } | |
| 20679 | |||
| 20680 | ✗ | void HeroClass::start_auto_walk(const combined_handle_t& target) | |
| 20681 | { | ||
| 20682 | ✗ | auto& cmb = target.combo(); | |
| 20683 | ✗ | if(cmb.type != cCUTSCENEEFFECT || cmb.attribytes[0] != CUTEFF_PLAYER_WALK) return; | |
| 20684 | |||
| 20685 | ✗ | zfix dx = zslongToFix(cmb.attributes[0]), dy = zslongToFix(cmb.attributes[1]); | |
| 20686 | ✗ | if(cmb.usrflags & cflag1) | |
| 20687 | { | ||
| 20688 | ✗ | auto [cx, cy] = target.center_xy(); | |
| 20689 | ✗ | dx += cx-8; | |
| 20690 | ✗ | dy += cy-8; | |
| 20691 | ✗ | } | |
| 20692 | ✗ | else if(cmb.usrflags & cflag2) | |
| 20693 | { | ||
| 20694 | ✗ | dx += x; | |
| 20695 | ✗ | dy += y; | |
| 20696 | ✗ | } | |
| 20697 | |||
| 20698 | ✗ | reset_hookshot(); | |
| 20699 | |||
| 20700 | ✗ | autowalk_dest_x = dx; | |
| 20701 | ✗ | autowalk_dest_y = dy; | |
| 20702 | ✗ | autowalk_combo_id = target.data(); | |
| 20703 | ✗ | autowalk_handle = target; | |
| 20704 | ✗ | } | |
| 20705 | 38976 | void HeroClass::finish_auto_walk() | |
| 20706 | { | ||
| 20707 |
1/2✓ Branch 0 taken 38976 times.
✗ Branch 1 not taken.
|
38976 | if(!autowalk_handle) return; |
| 20708 | |||
| 20709 | ✗ | if(autowalk_combo_id >= 0 && autowalk_handle.data() == autowalk_combo_id) | |
| 20710 | { | ||
| 20711 | ✗ | auto& cmb = autowalk_handle.combo(); | |
| 20712 | ✗ | if(cmb.type == cCUTSCENEEFFECT && cmb.attribytes[0] == CUTEFF_PLAYER_WALK) | |
| 20713 | ✗ | do_trigger_ctype_causes(autowalk_handle); | |
| 20714 | ✗ | } | |
| 20715 | ✗ | autowalk_handle = rpos_handle_t(); | |
| 20716 | ✗ | autowalk_combo_id = -1; | |
| 20717 | ✗ | autowalk_dest_x = autowalk_dest_y = 0; | |
| 20718 | 38976 | } | |
| 20719 | |||
| 20720 | ✗ | void HeroClass::autowalk_move() | |
| 20721 | { | ||
| 20722 | ✗ | if(x == autowalk_dest_x && y == autowalk_dest_y) // reached destination already | |
| 20723 | { | ||
| 20724 | ✗ | finish_auto_walk(); | |
| 20725 | ✗ | return; | |
| 20726 | } | ||
| 20727 | |||
| 20728 | ✗ | zfix pix_dist; | |
| 20729 | ✗ | if(autowalk_combo_id > -1) | |
| 20730 | { | ||
| 20731 | ✗ | newcombo const& cmb = combobuf[autowalk_combo_id]; | |
| 20732 | ✗ | if(cmb.type == cCUTSCENEEFFECT && cmb.attribytes[0] == CUTEFF_PLAYER_WALK) | |
| 20733 | { | ||
| 20734 | ✗ | if(cmb.attributes[2]) | |
| 20735 | ✗ | pix_dist = zslongToFix(cmb.attributes[2]); | |
| 20736 | ✗ | } | |
| 20737 | ✗ | } | |
| 20738 | ✗ | if(!pix_dist) | |
| 20739 | { | ||
| 20740 | ✗ | pix_dist = steprate / 100_zf; | |
| 20741 | ✗ | vector<zfix*> vec = { &pix_dist }; | |
| 20742 | ✗ | mod_steps(vec); | |
| 20743 | ✗ | if(!pix_dist) // ensure not stuck | |
| 20744 | ✗ | pix_dist = 1; | |
| 20745 | ✗ | } | |
| 20746 | |||
| 20747 | // -1, 0, or 1 | ||
| 20748 | ✗ | int dir_x = (autowalk_dest_x > x) - (autowalk_dest_x < x); | |
| 20749 | ✗ | int dir_y = (autowalk_dest_y > y) - (autowalk_dest_y < y); | |
| 20750 | |||
| 20751 | double _MSVC2022_tmp1, _MSVC2022_tmp2; | ||
| 20752 | ✗ | double angle = atan2_MSVC2022_FIX(double(autowalk_dest_y-y),double(autowalk_dest_x-x)); | |
| 20753 | ✗ | zfix dx, dy; | |
| 20754 | ✗ | if(x != autowalk_dest_x) | |
| 20755 | ✗ | dx = zc::math::Cos(angle)*pix_dist; | |
| 20756 | ✗ | if(y != autowalk_dest_y) | |
| 20757 | ✗ | dy = zc::math::Sin(angle)*pix_dist; | |
| 20758 | |||
| 20759 | ✗ | zfix cur_dest_x = x+dx, cur_dest_y = y+dy; | |
| 20760 | // check if this move will reach or pass the destination, and make it land exactly on the destination instead | ||
| 20761 | ✗ | if(dir_x != ((autowalk_dest_x > cur_dest_x) - (autowalk_dest_x < cur_dest_x))) | |
| 20762 | { | ||
| 20763 | ✗ | cur_dest_x = autowalk_dest_x; | |
| 20764 | ✗ | dx = cur_dest_x - x; | |
| 20765 | ✗ | } | |
| 20766 | ✗ | if(dir_y != ((autowalk_dest_y > cur_dest_y) - (autowalk_dest_y < cur_dest_y))) | |
| 20767 | { | ||
| 20768 | ✗ | cur_dest_y = autowalk_dest_y; | |
| 20769 | ✗ | dy = cur_dest_y - y; | |
| 20770 | ✗ | } | |
| 20771 | |||
| 20772 | ✗ | movexy(dx, dy, false, true, false, true); // try to move for purposes such as the ladder | |
| 20773 | ✗ | x = cur_dest_x; y = cur_dest_y; // ... but just set the x/y to be sure nothing got in the way | |
| 20774 | |||
| 20775 | ✗ | if(dx || dy) | |
| 20776 | { | ||
| 20777 | ✗ | if(abs(dx) > abs(dy)) | |
| 20778 | { | ||
| 20779 | ✗ | if(dx < 0) dir = left; | |
| 20780 | ✗ | else dir = right; | |
| 20781 | ✗ | } | |
| 20782 | else | ||
| 20783 | { | ||
| 20784 | ✗ | if(dy < 0) dir = up; | |
| 20785 | ✗ | else dir = down; | |
| 20786 | } | ||
| 20787 | ✗ | } | |
| 20788 | |||
| 20789 | ✗ | if(x == autowalk_dest_x && y == autowalk_dest_y) // reached destination | |
| 20790 | ✗ | finish_auto_walk(); | |
| 20791 | ✗ | } | |
| 20792 | |||
| 20793 | 395414030 | bool HeroClass::is_autowalking() const | |
| 20794 | { | ||
| 20795 | 395414030 | return autowalk_combo_id >= 0; | |
| 20796 | } | ||
| 20797 | 292834002 | bool HeroClass::no_control() const | |
| 20798 | { | ||
| 20799 | 292834002 | return is_autowalking(); // can possibly add other stuff here later, like maybe a script bool? | |
| 20800 | } | ||
| 20801 | 32524935 | HeroClass::WalkflagInfo HeroClass::walkflag(zfix fx,zfix fy,int32_t cnt,byte d2) | |
| 20802 | { | ||
| 20803 | 32524935 | return walkflag(fx.getInt(), fy.getInt(), cnt, d2); | |
| 20804 | } | ||
| 20805 | 32524935 | HeroClass::WalkflagInfo HeroClass::walkflag(int32_t wx,int32_t wy,int32_t cnt,byte d2) | |
| 20806 | { | ||
| 20807 | 32524935 | WalkflagInfo ret; | |
| 20808 | |||
| 20809 |
2/2✓ Branch 0 taken 189113 times.
✓ Branch 1 taken 32335822 times.
|
32524935 | if (!is_in_world_bounds(wx, wy)) |
| 20810 | { | ||
| 20811 | 189113 | ret.setUnwalkable(false); | |
| 20812 | 189113 | return ret; | |
| 20813 | } | ||
| 20814 | |||
| 20815 |
2/2✓ Branch 0 taken 45484 times.
✓ Branch 1 taken 32290338 times.
|
32335822 | if(walk_through_walls) |
| 20816 | { | ||
| 20817 | 45484 | ret.setUnwalkable(false); | |
| 20818 | 45484 | return ret; | |
| 20819 | } | ||
| 20820 | |||
| 20821 |
4/4✓ Branch 0 taken 547849 times.
✓ Branch 1 taken 31742489 times.
✓ Branch 2 taken 522813 times.
✓ Branch 3 taken 25036 times.
|
32290338 | if(blockpath && wy<(bigHitbox?80:88)) |
| 20822 | { | ||
| 20823 | 25036 | ret.setUnwalkable(true); | |
| 20824 | 25036 | return ret; | |
| 20825 | } | ||
| 20826 | |||
| 20827 |
4/4✓ Branch 0 taken 507805 times.
✓ Branch 1 taken 31757497 times.
✓ Branch 2 taken 317946 times.
✓ Branch 3 taken 189859 times.
|
32265302 | if(mblock2.active() && mblock2.hit(wx,wy,0,1,1,1)) |
| 20828 | { | ||
| 20829 | 189859 | ret.setUnwalkable(true); | |
| 20830 | 189859 | return ret; | |
| 20831 | } | ||
| 20832 | |||
| 20833 |
2/2✓ Branch 0 taken 1100 times.
✓ Branch 1 taken 32074343 times.
|
32075443 | if (collide_object(wx, wy,1, 1)) |
| 20834 | { | ||
| 20835 | 1100 | ret.setUnwalkable(true); | |
| 20836 | 1100 | return ret; | |
| 20837 | } | ||
| 20838 | |||
| 20839 |
16/18✓ Branch 0 taken 15316175 times.
✓ Branch 1 taken 16758168 times.
✓ Branch 2 taken 14864682 times.
✓ Branch 3 taken 451493 times.
✓ Branch 4 taken 14343660 times.
✓ Branch 5 taken 521022 times.
✓ Branch 6 taken 517624 times.
✓ Branch 7 taken 3398 times.
✓ Branch 8 taken 517624 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 517624 times.
✓ Branch 12 taken 2095 times.
✓ Branch 13 taken 1303 times.
✓ Branch 14 taken 239159 times.
✓ Branch 15 taken 281863 times.
✓ Branch 16 taken 31083 times.
✓ Branch 17 taken 32043260 times.
|
32386648 | if(isdungeon() && cur_screen<128 && wy<(bigHitbox?32:40) && (((diagonalMovement||NO_GRIDLOCK)?(x<=112||x>=128):x!=120) || _walkflag(120,24,2,get_standing_z_state())) |
| 20840 |
2/2✓ Branch 0 taken 30442 times.
✓ Branch 1 taken 208717 times.
|
521022 | && !get_qr(qr_FREEFORM)) |
| 20841 | { | ||
| 20842 | 31083 | ret.setUnwalkable(true); | |
| 20843 | 31083 | return ret; | |
| 20844 | } | ||
| 20845 | |||
| 20846 | 32043260 | bool wf = _walkflag(wx,wy,cnt,get_standing_z_state()); | |
| 20847 | |||
| 20848 |
6/6✓ Branch 0 taken 15285092 times.
✓ Branch 1 taken 16758168 times.
✓ Branch 2 taken 14833599 times.
✓ Branch 3 taken 451493 times.
✓ Branch 4 taken 6357215 times.
✓ Branch 5 taken 8476384 times.
|
32043260 | if(isdungeon() && cur_screen<128 && !get_qr(qr_FREEFORM)) |
| 20849 | { | ||
| 20850 |
3/6✓ Branch 0 taken 8476384 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8476384 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 8476384 times.
|
8476384 | if((diagonalMovement||NO_GRIDLOCK)) |
| 20851 | { | ||
| 20852 | ✗ | if(wx>=112&&wx<120&&wy<40&&wy>=32) wf=true; | |
| 20853 | |||
| 20854 | ✗ | if(wx>=136&&wx<144&&wy<40&&wy>=32) wf=true; | |
| 20855 | ✗ | } | |
| 20856 | 8476384 | } | |
| 20857 | //All problems related to exiting water are probably here. -Z | ||
| 20858 |
3/4✓ Branch 0 taken 31365930 times.
✓ Branch 1 taken 677330 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 31365930 times.
|
32043260 | if(action==swimming || IsSideSwim()) |
| 20859 | { | ||
| 20860 |
2/2✓ Branch 0 taken 645181 times.
✓ Branch 1 taken 32149 times.
|
677330 | if(!wf) |
| 20861 | { | ||
| 20862 | 32149 | bool isthissolid = false; | |
| 20863 |
2/2✓ Branch 0 taken 5887 times.
✓ Branch 1 taken 26262 times.
|
38460 | if (_walkflag(x+7,y+(bigHitbox?6:11),1,get_standing_z_state()) |
| 20864 |
2/2✓ Branch 0 taken 6311 times.
✓ Branch 1 taken 25838 times.
|
32149 | || _walkflag(x+7,y+(bigHitbox?9:12),1,get_standing_z_state()) |
| 20865 |
2/2✓ Branch 0 taken 6289 times.
✓ Branch 1 taken 22 times.
|
6311 | || _walkflag(x+8,y+(bigHitbox?6:11),1,get_standing_z_state()) |
| 20866 |
2/2✓ Branch 0 taken 402 times.
✓ Branch 1 taken 5887 times.
|
32551 | || _walkflag(x+8,y+(bigHitbox?9:12),1,get_standing_z_state())) isthissolid = true; |
| 20867 | //This checks if Hero is currently swimming in solid water (cause even if the QR "No Hopping" is enabled, he should still hop out of solid water) - Dimi | ||
| 20868 | |||
| 20869 | |||
| 20870 |
5/6✓ Branch 0 taken 7310 times.
✓ Branch 1 taken 24839 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 7310 times.
✓ Branch 4 taken 15125 times.
✓ Branch 5 taken 46824 times.
|
56988 | if(landswim>= (get_qr(qr_DROWN) && isSwimming() ? 1 |
| 20871 |
2/2✓ Branch 0 taken 2107 times.
✓ Branch 1 taken 22732 times.
|
24839 | : (!diagonalMovement) ? 1 : (get_qr(qr_NO_HOPPING)?1:22))) |
| 20872 | { | ||
| 20873 | //Check for out of bounds for swimming | ||
| 20874 | 15125 | bool changehop = true; | |
| 20875 | |||
| 20876 |
5/6✓ Branch 0 taken 1828 times.
✓ Branch 1 taken 13297 times.
✓ Branch 2 taken 1828 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 13224 times.
✓ Branch 5 taken 11786 times.
|
15125 | if((diagonalMovement||NO_GRIDLOCK)) |
| 20877 | { | ||
| 20878 |
2/4✓ Branch 0 taken 73 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 73 times.
|
26521 | if(wx<0||wy<0) |
| 20879 | ✗ | changehop = false; | |
| 20880 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 73 times.
|
73 | else if(wx>world_w - 8) |
| 20881 | ✗ | changehop = false; | |
| 20882 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 73 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
73 | else if(wx>world_w - 16&&cnt==2) |
| 20883 | ✗ | changehop = false; | |
| 20884 |
2/2✓ Branch 0 taken 70 times.
✓ Branch 1 taken 3 times.
|
73 | else if(wy>world_h - (show_bottom_8px ? 0 : 8)) |
| 20885 | 3 | changehop = false; | |
| 20886 | 73 | } | |
| 20887 |
3/4✓ Branch 0 taken 1901 times.
✓ Branch 1 taken 9958 times.
✓ Branch 2 taken 11859 times.
✗ Branch 3 not taken.
|
11859 | if ((get_qr(qr_NO_HOPPING) || CanSideSwim()) && !isthissolid) changehop = false; |
| 20888 | //This may be where the hang-up for exiting water exists. -Z | ||
| 20889 | // hop out of the water | ||
| 20890 |
2/2✓ Branch 0 taken 9961 times.
✓ Branch 1 taken 1898 times.
|
11859 | if(changehop) |
| 20891 | 1898 | ret.setHopClk(1); | |
| 20892 | 11859 | } | |
| 20893 | else | ||
| 20894 | { | ||
| 20895 |
6/6✓ Branch 0 taken 26109 times.
✓ Branch 1 taken 20715 times.
✓ Branch 2 taken 26027 times.
✓ Branch 3 taken 20797 times.
✓ Branch 4 taken 16813 times.
✓ Branch 5 taken 9214 times.
|
46824 | if((!(get_qr(qr_NO_HOPPING) || CanSideSwim()) || isthissolid) && (dir==d2 || shiftdir==d2)) |
| 20896 | { | ||
| 20897 |
2/2✓ Branch 0 taken 1936 times.
✓ Branch 1 taken 7515 times.
|
26027 | if(d2==left) |
| 20898 | { | ||
| 20899 |
4/4✓ Branch 0 taken 1660 times.
✓ Branch 1 taken 276 times.
✓ Branch 2 taken 1656 times.
✓ Branch 3 taken 280 times.
|
3596 | if(!iswaterex_z3(MAPCOMBO(x-1,y+(bigHitbox?6:11)), -1, x-1,y+(bigHitbox?6:11)) && |
| 20900 |
2/2✓ Branch 0 taken 1658 times.
✓ Branch 1 taken 2 times.
|
1660 | !iswaterex_z3(MAPCOMBO(x-1,y+(bigHitbox?9:12)), -1, x-1,y+(bigHitbox?9:12)) && |
| 20901 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1656 times.
|
1658 | !_walkflag(x-1,y+(bigHitbox?6:11),1,get_standing_z_state()) && |
| 20902 | 1656 | !_walkflag(x-1,y+(bigHitbox?9:12),1,get_standing_z_state())) | |
| 20903 | { | ||
| 20904 | 1656 | ret.setHopDir(d2); | |
| 20905 | 1656 | ret.setIlswim(true); | |
| 20906 | 1656 | } | |
| 20907 | 280 | else ret.setIlswim(false); | |
| 20908 | 1936 | } | |
| 20909 |
2/2✓ Branch 0 taken 5751 times.
✓ Branch 1 taken 1764 times.
|
7515 | else if(d2==right) |
| 20910 | { | ||
| 20911 |
4/4✓ Branch 0 taken 1654 times.
✓ Branch 1 taken 4097 times.
✓ Branch 2 taken 1654 times.
✓ Branch 3 taken 4097 times.
|
7405 | if(!iswaterex_z3(MAPCOMBO(x+16,y+(bigHitbox?6:11)), -1, x+16,y+(bigHitbox?6:11)) && |
| 20912 |
1/2✓ Branch 0 taken 1654 times.
✗ Branch 1 not taken.
|
1654 | !iswaterex_z3(MAPCOMBO(x+16,y+(bigHitbox?9:12)), -1, x+16,y+(bigHitbox?9:12)) && |
| 20913 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1654 times.
|
1654 | !_walkflag(x+16,y+(bigHitbox?6:11),1,get_standing_z_state()) && |
| 20914 | 1654 | !_walkflag(x+16,y+(bigHitbox?9:12),1,get_standing_z_state())) | |
| 20915 | { | ||
| 20916 | 1654 | ret.setHopDir(d2); | |
| 20917 | 1654 | ret.setIlswim(true); | |
| 20918 | 1654 | } | |
| 20919 | 4097 | else ret.setIlswim(false); | |
| 20920 | 5751 | } | |
| 20921 |
2/2✓ Branch 0 taken 1002 times.
✓ Branch 1 taken 762 times.
|
1764 | else if(d2==up) |
| 20922 | { | ||
| 20923 |
4/4✓ Branch 0 taken 541 times.
✓ Branch 1 taken 221 times.
✓ Branch 2 taken 539 times.
✓ Branch 3 taken 223 times.
|
1303 | if(!iswaterex_z3(MAPCOMBO(x+7,y+(bigHitbox?0:8)-1), -1, x+7,y+(bigHitbox?0:8)-1) && |
| 20924 |
1/2✓ Branch 0 taken 541 times.
✗ Branch 1 not taken.
|
541 | !iswaterex_z3(MAPCOMBO(x+8,y+(bigHitbox?0:8)-1), -1, x+8,y+(bigHitbox?0:8)-1) && |
| 20925 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 539 times.
|
541 | !_walkflag(x+7,y+(bigHitbox?0:8)-1,1,get_standing_z_state()) && |
| 20926 | 539 | !_walkflag(x+8,y+(bigHitbox?0:8)-1,1,get_standing_z_state())) | |
| 20927 | { | ||
| 20928 | 539 | ret.setHopDir(d2); | |
| 20929 | 539 | ret.setIlswim(true); | |
| 20930 | 539 | } | |
| 20931 | 223 | else ret.setIlswim(false); | |
| 20932 | 762 | } | |
| 20933 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1002 times.
|
1002 | else if(d2==down) |
| 20934 | { | ||
| 20935 |
4/4✓ Branch 0 taken 351 times.
✓ Branch 1 taken 651 times.
✓ Branch 2 taken 351 times.
✓ Branch 3 taken 651 times.
|
1353 | if(!iswaterex_z3(MAPCOMBO(x+7,y+16), -1, x+7,y+16) && |
| 20936 |
1/2✓ Branch 0 taken 351 times.
✗ Branch 1 not taken.
|
351 | !iswaterex_z3(MAPCOMBO(x+8,y+16), -1, x+8,y+16) && |
| 20937 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 351 times.
|
351 | !_walkflag(x+7,y+16,1,get_standing_z_state()) && |
| 20938 | 351 | !_walkflag(x+8,y+16,1,get_standing_z_state())) | |
| 20939 | { | ||
| 20940 | 351 | ret.setHopDir(d2); | |
| 20941 | 351 | ret.setIlswim(true); | |
| 20942 | 351 | } | |
| 20943 | 651 | else ret.setIlswim(false); | |
| 20944 | 1002 | } | |
| 20945 | 9451 | } | |
| 20946 | |||
| 20947 |
2/4✓ Branch 0 taken 30248 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 30248 times.
|
30248 | if(wx<0||wy<0); |
| 20948 |
2/2✓ Branch 0 taken 4422 times.
✓ Branch 1 taken 25826 times.
|
30248 | else if(wx > world_w - 8); |
| 20949 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 25826 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
25826 | else if(wx > world_w - 16 &&cnt==2); |
| 20950 |
2/2✓ Branch 0 taken 774 times.
✓ Branch 1 taken 25052 times.
|
25826 | else if(wy > world_h - (show_bottom_8px ? 0 : 8)); |
| 20951 |
4/4✓ Branch 0 taken 6428 times.
✓ Branch 1 taken 18624 times.
✓ Branch 2 taken 29 times.
✓ Branch 3 taken 6399 times.
|
25052 | else if(get_qr(qr_DROWN) && !ilswim); |
| 20952 |
2/2✓ Branch 0 taken 1558 times.
✓ Branch 1 taken 17095 times.
|
18653 | else if(iswaterex_z3(MAPCOMBO(wx,wy), -1, wx,wy)) //!DIMI: weird duplicate function here before. Was water bugged this whole time, or was it just an unneccessary duplicate? |
| 20953 | { | ||
| 20954 | 1558 | ret.setUnwalkable(false); | |
| 20955 | 1558 | return ret; | |
| 20956 | } | ||
| 20957 | else | ||
| 20958 | { | ||
| 20959 | 17095 | ret.setUnwalkable(true); | |
| 20960 | 17095 | return ret; | |
| 20961 | } | ||
| 20962 | } | ||
| 20963 | 23454 | } | |
| 20964 | else | ||
| 20965 | { | ||
| 20966 |
4/4✓ Branch 0 taken 595014 times.
✓ Branch 1 taken 50167 times.
✓ Branch 2 taken 538487 times.
✓ Branch 3 taken 56527 times.
|
645181 | if (d2>=left && iswaterex_z3(MAPCOMBO(wx,wy), -1, wx,wy)) |
| 20967 | { | ||
| 20968 | 538487 | ret.setUnwalkable(false); | |
| 20969 | 538487 | return ret; | |
| 20970 | } | ||
| 20971 |
6/6✓ Branch 0 taken 50167 times.
✓ Branch 1 taken 56527 times.
✓ Branch 2 taken 10796 times.
✓ Branch 3 taken 39371 times.
✓ Branch 4 taken 38171 times.
✓ Branch 5 taken 68523 times.
|
106694 | else if (d2<=down && iswaterex_z3(MAPCOMBO(wx,wy), -1, wx,wy) && iswaterex_z3(MAPCOMBO(x+8,wy), -1, x+8,wy)) |
| 20972 | { | ||
| 20973 | 38171 | ret.setUnwalkable(false); | |
| 20974 | 38171 | return ret; | |
| 20975 | } | ||
| 20976 | } | ||
| 20977 | 91977 | } | |
| 20978 |
2/2✓ Branch 0 taken 384504 times.
✓ Branch 1 taken 30981426 times.
|
31365930 | else if(ladderx+laddery) // ladder is being used |
| 20979 | { | ||
| 20980 |
6/6✓ Branch 0 taken 27069 times.
✓ Branch 1 taken 357435 times.
✓ Branch 2 taken 1989 times.
✓ Branch 3 taken 25080 times.
✓ Branch 4 taken 1936 times.
✓ Branch 5 taken 53 times.
|
384504 | int32_t lx = !(get_qr(qr_DROWN)&&iswaterex_z3(MAPCOMBO(x+4,y+11), -1, x+4,y+11)&&!_walkflag(x+4,y+11,1,get_standing_z_state())) ? zfix(wx) : x; |
| 20981 |
6/6✓ Branch 0 taken 27069 times.
✓ Branch 1 taken 357435 times.
✓ Branch 2 taken 1989 times.
✓ Branch 3 taken 25080 times.
✓ Branch 4 taken 1936 times.
✓ Branch 5 taken 53 times.
|
384504 | int32_t ly = !(get_qr(qr_DROWN)&&iswaterex_z3(MAPCOMBO(x+4,y+11), -1, x+4,y+11)&&!_walkflag(x+4,y+11,1,get_standing_z_state())) ? zfix(wy) : y; |
| 20982 | |||
| 20983 |
4/6✓ Branch 0 taken 363296 times.
✓ Branch 1 taken 21208 times.
✓ Branch 2 taken 363296 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 363296 times.
|
384504 | if((diagonalMovement||NO_GRIDLOCK)) |
| 20984 | { | ||
| 20985 |
2/2✓ Branch 0 taken 13575 times.
✓ Branch 1 taken 7633 times.
|
21208 | if(ladderdir==up) |
| 20986 | { | ||
| 20987 |
2/2✓ Branch 0 taken 3363 times.
✓ Branch 1 taken 4270 times.
|
7633 | if(abs(ly-(laddery+8))<=8) // ly is between laddery (laddery+8-8) and laddery+16 (laddery+8+8) |
| 20988 | { | ||
| 20989 | 4270 | bool temp = false; | |
| 20990 | |||
| 20991 |
2/2✓ Branch 0 taken 1391 times.
✓ Branch 1 taken 2879 times.
|
4270 | if(!(abs(lx-(ladderx+8))<=8)) |
| 20992 | 2879 | temp = true; | |
| 20993 | |||
| 20994 |
2/2✓ Branch 0 taken 3290 times.
✓ Branch 1 taken 980 times.
|
4270 | if(cnt==2) |
| 20995 |
1/2✓ Branch 0 taken 980 times.
✗ Branch 1 not taken.
|
980 | if(!(abs((lx+8)-(ladderx+8))<=8)) |
| 20996 | ✗ | temp=true; | |
| 20997 | |||
| 20998 |
2/2✓ Branch 0 taken 2879 times.
✓ Branch 1 taken 1391 times.
|
4270 | if(!temp) |
| 20999 | { | ||
| 21000 | 1391 | ret.setUnwalkable(false); | |
| 21001 | 1391 | return ret; | |
| 21002 | } | ||
| 21003 | |||
| 21004 |
5/6✓ Branch 0 taken 2879 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2125 times.
✓ Branch 3 taken 754 times.
✓ Branch 4 taken 122 times.
✓ Branch 5 taken 2757 times.
|
2879 | if(current_item_power(itype_ladder)<2 && (d2==left || d2==right) && !isSideViewHero()) |
| 21005 | { | ||
| 21006 | 2757 | ret.setUnwalkable(true); | |
| 21007 | 2757 | return ret; | |
| 21008 | } | ||
| 21009 | 122 | } | |
| 21010 | 3485 | } | |
| 21011 | else | ||
| 21012 | { | ||
| 21013 |
2/2✓ Branch 0 taken 7020 times.
✓ Branch 1 taken 6555 times.
|
13575 | if(abs(lx-(ladderx+8))<=8) |
| 21014 | { | ||
| 21015 |
2/2✓ Branch 0 taken 4323 times.
✓ Branch 1 taken 2232 times.
|
6555 | if(abs(ly-(laddery+(bigHitbox?8:12)))<=(bigHitbox?8:4)) |
| 21016 | { | ||
| 21017 | 4323 | ret.setUnwalkable(false); | |
| 21018 | 4323 | return ret; | |
| 21019 | } | ||
| 21020 | |||
| 21021 |
6/6✓ Branch 0 taken 2220 times.
✓ Branch 1 taken 12 times.
✓ Branch 2 taken 1785 times.
✓ Branch 3 taken 435 times.
✓ Branch 4 taken 916 times.
✓ Branch 5 taken 869 times.
|
2232 | if(current_item_power(itype_ladder)<2 && (d2==up || d2==down)) |
| 21022 | { | ||
| 21023 | 1351 | ret.setUnwalkable(true); | |
| 21024 | 1351 | return ret; | |
| 21025 | } | ||
| 21026 | |||
| 21027 |
3/4✓ Branch 0 taken 40 times.
✓ Branch 1 taken 841 times.
✓ Branch 2 taken 40 times.
✗ Branch 3 not taken.
|
881 | if((abs(ly-laddery+8)<=8) && d2<=down) |
| 21028 | { | ||
| 21029 | ✗ | ret.setUnwalkable(false); | |
| 21030 | ✗ | return ret; | |
| 21031 | } | ||
| 21032 | 881 | } | |
| 21033 | } | ||
| 21034 | 11386 | } // diagonalMovement | |
| 21035 | else | ||
| 21036 | { | ||
| 21037 |
2/2✓ Branch 0 taken 222358 times.
✓ Branch 1 taken 140938 times.
|
363296 | if((d2&2)==ladderdir) // same direction |
| 21038 | { | ||
| 21039 |
3/3✓ Branch 0 taken 13729 times.
✓ Branch 1 taken 196539 times.
✓ Branch 2 taken 12090 times.
|
222358 | switch(d2) |
| 21040 | { | ||
| 21041 | case up: | ||
| 21042 |
2/2✓ Branch 0 taken 8605 times.
✓ Branch 1 taken 3485 times.
|
12090 | if(y.getInt()<=laddery) |
| 21043 | { | ||
| 21044 |
2/2✓ Branch 0 taken 970 times.
✓ Branch 1 taken 7635 times.
|
8605 | ret.setUnwalkable(_walkflag(ladderx,laddery-8,1,get_standing_z_state()) || |
| 21045 | 7635 | _walkflag(ladderx+8,laddery-8,1,get_standing_z_state())); | |
| 21046 | 8605 | return ret; | |
| 21047 | |||
| 21048 | } | ||
| 21049 | |||
| 21050 | [[fallthrough]]; | ||
| 21051 | case down: | ||
| 21052 |
2/2✓ Branch 0 taken 9176 times.
✓ Branch 1 taken 8038 times.
|
17214 | if(TRUNCATE_TILE(wy)==laddery) |
| 21053 | { | ||
| 21054 | 9176 | ret.setUnwalkable(false); | |
| 21055 | 9176 | return ret; | |
| 21056 | } | ||
| 21057 | |||
| 21058 | 8038 | break; | |
| 21059 | |||
| 21060 | default: | ||
| 21061 |
2/2✓ Branch 0 taken 74354 times.
✓ Branch 1 taken 122185 times.
|
196539 | if(TRUNCATE_TILE(wx)==ladderx) |
| 21062 | { | ||
| 21063 | 74354 | ret.setUnwalkable(false); | |
| 21064 | 74354 | return ret; | |
| 21065 | } | ||
| 21066 | 122185 | } | |
| 21067 | |||
| 21068 |
2/2✓ Branch 0 taken 8038 times.
✓ Branch 1 taken 122185 times.
|
130223 | if(d2<=down) |
| 21069 | { | ||
| 21070 |
2/2✓ Branch 0 taken 1060 times.
✓ Branch 1 taken 6978 times.
|
8038 | ret.setUnwalkable(_walkflag(ladderx,wy,1,get_standing_z_state()) || _walkflag(ladderx+8,wy,1,get_standing_z_state())); |
| 21071 | 8038 | return ret; | |
| 21072 | } | ||
| 21073 | |||
| 21074 |
2/2✓ Branch 0 taken 29654 times.
✓ Branch 1 taken 92531 times.
|
122185 | ret.setUnwalkable(_walkflag(TRUNCATE_TILE(wx),wy,1,get_standing_z_state()) || _walkflag(TRUNCATE_TILE(wx)+8,wy,1,get_standing_z_state())); |
| 21075 | 122185 | return ret; | |
| 21076 | } | ||
| 21077 | |||
| 21078 | // different dir | ||
| 21079 |
3/8✓ Branch 0 taken 140509 times.
✓ Branch 1 taken 429 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 140509 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
140938 | if(current_item_power(itype_ladder)<2 && !(isSideViewHero() && (d2==left || d2==right))) |
| 21080 | { | ||
| 21081 | 140509 | ret.setUnwalkable(true); | |
| 21082 | 140509 | return ret; | |
| 21083 | } | ||
| 21084 | |||
| 21085 |
5/6✓ Branch 0 taken 372 times.
✓ Branch 1 taken 57 times.
✓ Branch 2 taken 372 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 352 times.
✓ Branch 5 taken 20 times.
|
429 | if(wy>=laddery && wy<=laddery+16 && d2<=down) |
| 21086 | { | ||
| 21087 | 20 | ret.setUnwalkable(false); | |
| 21088 | 20 | return ret; | |
| 21089 | } | ||
| 21090 | } | ||
| 21091 | 11795 | } | |
| 21092 |
6/6✓ Branch 0 taken 25667623 times.
✓ Branch 1 taken 5313803 times.
✓ Branch 2 taken 25284177 times.
✓ Branch 3 taken 383446 times.
✓ Branch 4 taken 6699214 times.
✓ Branch 5 taken 18584963 times.
|
30981426 | else if(wf || isSideViewHero() || get_qr(qr_DROWN)) |
| 21093 | { | ||
| 21094 | // see if it's a good spot for the ladder or for swimming | ||
| 21095 | 12396463 | bool unwalkablex = _walkflag(wx,wy,1,get_standing_z_state()); //will be used later for the ladder -DD | |
| 21096 | 12396463 | bool unwalkablex8 = _walkflag(x+8,wy,1,get_standing_z_state()); | |
| 21097 | |||
| 21098 |
2/2✓ Branch 0 taken 3562450 times.
✓ Branch 1 taken 8834013 times.
|
12396463 | if(get_qr(qr_DROWN)) |
| 21099 | { | ||
| 21100 | // Drowning changes the following attributes: | ||
| 21101 | // * Dangerous water is also walkable, so ignore the previous | ||
| 21102 | // definitions of unwalkablex and unwalkablex8. | ||
| 21103 | // * Instead, prevent the ladder from being used in the | ||
| 21104 | // one frame where Hero has landed on water before drowning. | ||
| 21105 | 8834013 | unwalkablex = unwalkablex8 = !iswaterex_z3(MAPCOMBO(x+4,y+11), -1, x+4,y+11); | |
| 21106 | 8834013 | } | |
| 21107 | |||
| 21108 | // check if he can swim | ||
| 21109 |
5/6✓ Branch 0 taken 2582531 times.
✓ Branch 1 taken 9813932 times.
✓ Branch 2 taken 2579567 times.
✓ Branch 3 taken 2964 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 2579567 times.
|
12396463 | if(current_item(itype_flippers) && z==0 && fakez==0) |
| 21110 | { | ||
| 21111 | 2579567 | int32_t wtrx = iswaterex_z3(MAPCOMBO(wx,wy), -1, wx,wy); | |
| 21112 | 2579567 | int32_t wtrx8 = iswaterex_z3(MAPCOMBO(x+8,wy), -1, x+8,wy); //!DIMI: Still not sure if this should be x + 8... | |
| 21113 |
2/6✓ Branch 0 taken 2579567 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2579567 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
2579567 | if (current_item(itype_flippers) >= combobuf[wtrx8].attribytes[0] && (!(combobuf[wtrx8].usrflags&cflag1) || (itemsbuf[current_item_id(itype_flippers)].flags & item_flag3))) //Don't swim if the water's required level is too high! -Dimi |
| 21114 | { | ||
| 21115 | //ladder ignores water combos that are now walkable thanks to flippers -DD | ||
| 21116 |
2/2✓ Branch 0 taken 13116 times.
✓ Branch 1 taken 2566451 times.
|
2579567 | unwalkablex = unwalkablex && (!wtrx); |
| 21117 |
2/2✓ Branch 0 taken 1358908 times.
✓ Branch 1 taken 1220659 times.
|
2579567 | unwalkablex8 = unwalkablex8 && (!wtrx8); |
| 21118 | |||
| 21119 |
2/2✓ Branch 0 taken 62 times.
✓ Branch 1 taken 2579505 times.
|
2579567 | if(landswim >= 22) |
| 21120 | { | ||
| 21121 | 62 | ret.setHopClk(2); | |
| 21122 | 62 | ret.setUnwalkable(false); | |
| 21123 | 62 | return ret; | |
| 21124 | } | ||
| 21125 |
8/8✓ Branch 0 taken 2202699 times.
✓ Branch 1 taken 376806 times.
✓ Branch 2 taken 17578 times.
✓ Branch 3 taken 2185121 times.
✓ Branch 4 taken 376806 times.
✓ Branch 5 taken 2185121 times.
✓ Branch 6 taken 1912 times.
✓ Branch 7 taken 374894 times.
|
2579505 | else if((d2>=left && wtrx) || (d2<=down && wtrx && wtrx8)) |
| 21126 | { | ||
| 21127 |
4/6✓ Branch 0 taken 12538 times.
✓ Branch 1 taken 6952 times.
✓ Branch 2 taken 12538 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 12538 times.
|
19490 | if(!(diagonalMovement||NO_GRIDLOCK)) |
| 21128 | { | ||
| 21129 | 12538 | ret.setHopClk(2); | |
| 21130 | |||
| 21131 |
2/4✓ Branch 0 taken 12538 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 12538 times.
|
12538 | if(charging || spins>5) |
| 21132 | { | ||
| 21133 | //if Hero is charging, he might be facing the wrong direction (we want him to | ||
| 21134 | //hop into the water, not in the facing direction) | ||
| 21135 | ✗ | ret.setDir(d2); | |
| 21136 | //moreover Hero can't charge in the water -DD | ||
| 21137 | ✗ | ret.setChargeAttack(); | |
| 21138 | ✗ | } | |
| 21139 | |||
| 21140 | 12538 | ret.setUnwalkable(false); | |
| 21141 | 12538 | return ret; | |
| 21142 | } | ||
| 21143 |
2/2✓ Branch 0 taken 561 times.
✓ Branch 1 taken 6391 times.
|
6952 | else if(dir==d2) |
| 21144 | { | ||
| 21145 | 6391 | ret.setIlswim(true); | |
| 21146 | 6391 | ladderx = 0; | |
| 21147 | 6391 | laddery = 0; | |
| 21148 | 6391 | } | |
| 21149 | 6952 | } | |
| 21150 | 2566967 | } | |
| 21151 | 2566967 | } | |
| 21152 | |||
| 21153 | // check if he can use the ladder | ||
| 21154 | // "Allow Ladder Anywhere" is toggled by fLADDER | ||
| 21155 |
2/2✓ Branch 0 taken 9372103 times.
✓ Branch 1 taken 3011760 times.
|
12383863 | if(can_deploy_ladder()) |
| 21156 | // laddersetup | ||
| 21157 | { | ||
| 21158 | // Check if there's water to use the ladder over | ||
| 21159 | 3011760 | bool wtrx = (iswaterex_z3(MAPCOMBO(wx,wy), -1, wx,wy) != 0); | |
| 21160 | 3011760 | bool wtrx8 = (iswaterex_z3(MAPCOMBO(x+8,wy), -1, x+8,wy) != 0); | |
| 21161 | 3011760 | int32_t ldrid = current_item_id(itype_ladder); | |
| 21162 |
1/2✓ Branch 0 taken 3011760 times.
✗ Branch 1 not taken.
|
3011760 | bool ladderpits = ldrid > -1 && (itemsbuf[ldrid].flags&item_flag1); |
| 21163 | |||
| 21164 |
4/4✓ Branch 0 taken 3001809 times.
✓ Branch 1 taken 9951 times.
✓ Branch 2 taken 65 times.
✓ Branch 3 taken 3001744 times.
|
3011760 | if(wtrx || wtrx8) |
| 21165 | { | ||
| 21166 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10016 times.
|
10016 | if(isSideViewHero()) |
| 21167 | { | ||
| 21168 | ✗ | wtrx = !_walkflag(wx, wy+8, 1,get_standing_z_state()) && !_walkflag(wx, wy, 1,get_standing_z_state()) && dir!=down; | |
| 21169 | ✗ | wtrx8 = !_walkflag(wx+8, wy+8, 1,get_standing_z_state()) && !_walkflag(wx+8, wy, 1,get_standing_z_state()) && dir!=down; | |
| 21170 | ✗ | } | |
| 21171 | // * walk on half-water using the ladder instead of using flippers. | ||
| 21172 | // * otherwise, walk on ladder(+hookshot) combos. | ||
| 21173 |
3/8✓ Branch 0 taken 633 times.
✓ Branch 1 taken 9383 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 633 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
10016 | else if(wtrx==wtrx8 && (isstepable(MAPCOMBO(wx, wy)) || isstepable(MAPCOMBO(wx+8,wy)) || wtrx==true)) |
| 21174 | { | ||
| 21175 |
2/2✓ Branch 0 taken 131 times.
✓ Branch 1 taken 502 times.
|
633 | if(!get_qr(qr_OLD_210_WATER)) |
| 21176 | { | ||
| 21177 | //if Hero could swim on a tile instead of using the ladder, | ||
| 21178 | //refuse to use the ladder to step over that tile. -DD | ||
| 21179 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 502 times.
|
502 | wtrx = isstepable(MAPCOMBO(wx, wy)) && unwalkablex; |
| 21180 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 496 times.
|
502 | wtrx8 = isstepable(MAPCOMBO(wx+8,wy)) && unwalkablex8; |
| 21181 | 502 | } | |
| 21182 | 633 | } | |
| 21183 | 10016 | } | |
| 21184 | else | ||
| 21185 | { | ||
| 21186 | // No water; check other things | ||
| 21187 | |||
| 21188 | //Check pits | ||
| 21189 |
2/2✓ Branch 0 taken 3000717 times.
✓ Branch 1 taken 1027 times.
|
3001744 | if(ladderpits) |
| 21190 | { | ||
| 21191 | 1027 | int32_t pit_cmb = getpitfall(wx,wy); | |
| 21192 |
1/2✓ Branch 0 taken 1027 times.
✗ Branch 1 not taken.
|
1027 | wtrx = pit_cmb && (combobuf[pit_cmb].usrflags&cflag4); |
| 21193 | 1027 | pit_cmb = getpitfall(x+8,wy); | |
| 21194 |
1/2✓ Branch 0 taken 1027 times.
✗ Branch 1 not taken.
|
1027 | wtrx8 = pit_cmb && (combobuf[pit_cmb].usrflags&cflag4); |
| 21195 | 1027 | } | |
| 21196 |
4/6✓ Branch 0 taken 1027 times.
✓ Branch 1 taken 3000717 times.
✓ Branch 2 taken 1027 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1027 times.
✗ Branch 5 not taken.
|
3001744 | if(!ladderpits || (!(wtrx || wtrx8) || isSideViewHero())) //If no pit, check ladder combos |
| 21197 | { | ||
| 21198 | 3001744 | int32_t combo=combobuf[MAPCOMBO(wx, wy)].type; | |
| 21199 |
2/2✓ Branch 0 taken 186 times.
✓ Branch 1 taken 3001558 times.
|
3001744 | wtrx=(combo==cLADDERONLY || combo==cLADDERHOOKSHOT); |
| 21200 | 3001744 | combo=combobuf[MAPCOMBO(wx+8, wy)].type; | |
| 21201 |
2/2✓ Branch 0 taken 292 times.
✓ Branch 1 taken 3001452 times.
|
3001744 | wtrx8=(combo==cLADDERONLY || combo==cLADDERHOOKSHOT); |
| 21202 | 3001744 | } | |
| 21203 | } | ||
| 21204 | |||
| 21205 |
2/2✓ Branch 0 taken 6023520 times.
✓ Branch 1 taken 3011760 times.
|
9035280 | for (int32_t i = 0; i <= 1; ++i) |
| 21206 | { | ||
| 21207 |
2/2✓ Branch 0 taken 5649190 times.
✓ Branch 1 taken 374330 times.
|
6023520 | if (get_qr(qr_OLD_BRIDGE_COMBOS)) |
| 21208 | { | ||
| 21209 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 5649190 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
5649190 | if (combobuf[MAPCOMBO2(i,wx,wy)].type == cBRIDGE && !_walkflag_layer(wx,wy,i)) wtrx = false; |
| 21210 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 5649190 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
5649190 | if (combobuf[MAPCOMBO2(i,wx+8,wy)].type == cBRIDGE && !_walkflag_layer(wx+8,wy,i)) wtrx8 = false; |
| 21211 | 5649190 | } | |
| 21212 | else | ||
| 21213 | { | ||
| 21214 |
3/4✓ Branch 0 taken 259 times.
✓ Branch 1 taken 374071 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 259 times.
|
374330 | if (combobuf[MAPCOMBO2(i,wx,wy)].type == cBRIDGE && _effectflag_layer(wx,wy,i)) wtrx = false; |
| 21215 |
3/4✓ Branch 0 taken 237 times.
✓ Branch 1 taken 374093 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 237 times.
|
374330 | if (combobuf[MAPCOMBO2(i,wx+8,wy)].type == cBRIDGE && _effectflag_layer(wx+8,wy,i)) wtrx8 = false; |
| 21216 | } | ||
| 21217 | 6023520 | } | |
| 21218 |
2/2✓ Branch 0 taken 2062592 times.
✓ Branch 1 taken 949168 times.
|
3011760 | bool walkwater = (get_qr(qr_DROWN) && !iswaterex_z3(MAPCOMBO(wx,wy), -1, wx,wy)); |
| 21219 | |||
| 21220 |
4/6✓ Branch 0 taken 2202554 times.
✓ Branch 1 taken 809206 times.
✓ Branch 2 taken 2202554 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2202554 times.
|
3011760 | if((diagonalMovement||NO_GRIDLOCK)) |
| 21221 | { | ||
| 21222 |
2/2✓ Branch 0 taken 160069 times.
✓ Branch 1 taken 649137 times.
|
809206 | if(d2==dir) |
| 21223 | { | ||
| 21224 | 649137 | int32_t c = walkwater ? 0:8; | |
| 21225 | 649137 | int32_t b = walkwater ? 8:0; | |
| 21226 | |||
| 21227 |
2/2✓ Branch 0 taken 422599 times.
✓ Branch 1 taken 226538 times.
|
649137 | if(d2>=left) |
| 21228 | { | ||
| 21229 | // If the difference between wy and y is small enough | ||
| 21230 |
4/4✓ Branch 0 taken 126967 times.
✓ Branch 1 taken 295632 times.
✓ Branch 2 taken 422441 times.
✓ Branch 3 taken 158 times.
|
422599 | if(abs((wy)-(int32_t(y+c)))<=(b) && wtrx) |
| 21231 | { | ||
| 21232 | // Don't activate the ladder if it would be entirely | ||
| 21233 | // over water and Hero has the flippers. This isn't | ||
| 21234 | // a good way to do this, but it's too risky | ||
| 21235 | // to make big changes to this stuff. | ||
| 21236 | 158 | bool deployLadder=true; | |
| 21237 | 158 | int32_t lx= TRUNCATE_TILE(wx); | |
| 21238 |
6/8✓ Branch 0 taken 2 times.
✓ Branch 1 taken 156 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2 times.
✓ Branch 6 taken 156 times.
✓ Branch 7 taken 2 times.
|
158 | if(current_item(itype_flippers) && current_item(itype_flippers) >= combobuf[iswaterex_z3(MAPCOMBO(lx+8, y+8), -1, lx+8, y+8)].attribytes[0] && z==0 && fakez==0) |
| 21239 | { | ||
| 21240 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
|
2 | if(iswaterex_z3(MAPCOMBO(lx, y), -1, lx, y) && |
| 21241 | ✗ | iswaterex_z3(MAPCOMBO(lx+15, y), -1, lx+15, y) && | |
| 21242 | ✗ | iswaterex_z3(MAPCOMBO(lx, y+15), -1, lx, y+15) && | |
| 21243 | ✗ | iswaterex_z3(MAPCOMBO(lx+15, y+15), -1, lx+15, y+15)) | |
| 21244 | ✗ | deployLadder=false; | |
| 21245 | 2 | } | |
| 21246 |
1/2✓ Branch 0 taken 158 times.
✗ Branch 1 not taken.
|
158 | if(deployLadder) |
| 21247 | { | ||
| 21248 | 158 | ladderx = TRUNCATE_TILE(wx); | |
| 21249 | 158 | laddery = y; | |
| 21250 | 158 | ladderdir = left; | |
| 21251 | 158 | ladderstart = d2; | |
| 21252 | 158 | ret.setUnwalkable(laddery!=y.getInt()); | |
| 21253 | 158 | return ret; | |
| 21254 | } | ||
| 21255 | ✗ | } | |
| 21256 | 422441 | } | |
| 21257 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 226538 times.
|
226538 | else if(d2<=down) |
| 21258 | { | ||
| 21259 | // If the difference between wx and x is small enough | ||
| 21260 |
4/4✓ Branch 0 taken 89635 times.
✓ Branch 1 taken 136903 times.
✓ Branch 2 taken 87 times.
✓ Branch 3 taken 226451 times.
|
226538 | if(abs((wx)-(int32_t(x+c)))<=(b) && wtrx) |
| 21261 | { | ||
| 21262 | 87 | ladderx = x; | |
| 21263 | 87 | laddery = TRUNCATE_TILE(wy); | |
| 21264 | 87 | ladderdir = up; | |
| 21265 | 87 | ladderstart = d2; | |
| 21266 | 87 | ret.setUnwalkable(ladderx!=x.getInt()); | |
| 21267 | 87 | return ret; | |
| 21268 | } | ||
| 21269 | |||
| 21270 |
2/2✓ Branch 0 taken 89594 times.
✓ Branch 1 taken 136857 times.
|
226451 | if(cnt==2) |
| 21271 | { | ||
| 21272 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 136857 times.
✓ Branch 2 taken 17 times.
✓ Branch 3 taken 136840 times.
|
136857 | if(abs((wx+8)-(int32_t(x+c)))<=(b) && wtrx8) |
| 21273 | { | ||
| 21274 | 17 | ladderx = x; | |
| 21275 | 17 | laddery = TRUNCATE_TILE(wy); | |
| 21276 | 17 | ladderdir = up; | |
| 21277 | 17 | ladderstart = d2; | |
| 21278 | 17 | ret.setUnwalkable(ladderx!=x.getInt()); | |
| 21279 | 17 | return ret; | |
| 21280 | } | ||
| 21281 | 136840 | } | |
| 21282 | 226434 | } | |
| 21283 | 648875 | } | |
| 21284 | 808944 | } | |
| 21285 | else | ||
| 21286 | { | ||
| 21287 |
2/2✓ Branch 0 taken 116610 times.
✓ Branch 1 taken 2085944 times.
|
2202554 | bool flgx = _walkflag(wx,wy,1,get_standing_z_state()) && !wtrx; // Solid, and not steppable |
| 21288 |
2/2✓ Branch 0 taken 2015835 times.
✓ Branch 1 taken 186719 times.
|
2202554 | bool flgx8 = _walkflag(x+8,wy,1,get_standing_z_state()) && !wtrx8; // Solid, and not steppable |
| 21289 | |||
| 21290 |
2/2✓ Branch 0 taken 2039953 times.
✓ Branch 1 taken 162601 times.
|
2202626 | if((d2>=left && wtrx) |
| 21291 | // Deploy the ladder vertically even if Hero is only half on water. | ||
| 21292 |
8/8✓ Branch 0 taken 18496 times.
✓ Branch 1 taken 2021457 times.
✓ Branch 2 taken 162601 times.
✓ Branch 3 taken 2021457 times.
✓ Branch 4 taken 1222 times.
✓ Branch 5 taken 161379 times.
✓ Branch 6 taken 72 times.
✓ Branch 7 taken 162529 times.
|
2202554 | || (d2<=down && ((wtrx && !flgx8) || (wtrx8 && !flgx)))) |
| 21293 | { | ||
| 21294 |
4/4✓ Branch 0 taken 17936 times.
✓ Branch 1 taken 560 times.
✓ Branch 2 taken 697 times.
✓ Branch 3 taken 17239 times.
|
18496 | if(((y.getInt()+15) < wy) || ((y.getInt()+8) > wy)) |
| 21295 | 1257 | ladderdir = up; | |
| 21296 | else | ||
| 21297 | 17239 | ladderdir = left; | |
| 21298 | |||
| 21299 |
2/2✓ Branch 0 taken 17239 times.
✓ Branch 1 taken 1257 times.
|
18496 | if(ladderdir==up) |
| 21300 | { | ||
| 21301 | 1257 | ladderx = TRUNCATE_HALF_TILE(x.getInt()); | |
| 21302 | 1257 | laddery = TRUNCATE_TILE(wy); | |
| 21303 | 1257 | } | |
| 21304 | else | ||
| 21305 | { | ||
| 21306 | 17239 | ladderx = TRUNCATE_TILE(wx); | |
| 21307 | 17239 | laddery = TRUNCATE_HALF_TILE(y.getInt()); | |
| 21308 | |||
| 21309 | } | ||
| 21310 | |||
| 21311 | 18496 | ret.setUnwalkable(false); | |
| 21312 | 18496 | return ret; | |
| 21313 | } | ||
| 21314 | } | ||
| 21315 | 2993002 | } | |
| 21316 | 12365105 | } | |
| 21317 | |||
| 21318 | 31053840 | ret.setUnwalkable(wf); | |
| 21319 | 31053840 | return ret; | |
| 21320 | 32534893 | } | |
| 21321 | |||
| 21322 | // Only checks for moving blocks. Apparently this is a thing we need. | ||
| 21323 | 3051885 | HeroClass::WalkflagInfo HeroClass::walkflagMBlock(int32_t wx,int32_t wy) | |
| 21324 | { | ||
| 21325 | 3051885 | HeroClass::WalkflagInfo ret; | |
| 21326 |
2/2✓ Branch 0 taken 47939 times.
✓ Branch 1 taken 3003946 times.
|
3051885 | if (!mblock2.active()) //Without this, weird swimming behaviors happen. |
| 21327 | { | ||
| 21328 | 3003946 | ret.setFlags(~1); | |
| 21329 | 3003946 | ret.setHopDir(-1); | |
| 21330 | 3003946 | } | |
| 21331 |
2/2✓ Branch 0 taken 2808 times.
✓ Branch 1 taken 3049077 times.
|
3051885 | if(walk_through_walls) return ret; |
| 21332 |
2/2✓ Branch 0 taken 3001138 times.
✓ Branch 1 taken 47939 times.
|
3049077 | if (mblock2.active()) |
| 21333 | 47939 | ret.setUnwalkable(mblock2.hit(wx,wy,0,1,1,1)); | |
| 21334 |
2/2✓ Branch 0 taken 3048827 times.
✓ Branch 1 taken 250 times.
|
3049077 | if (collide_object(wx, wy,1, 1)) |
| 21335 | 250 | ret.setUnwalkable(true); | |
| 21336 | 3049077 | return ret; | |
| 21337 | 3051885 | } | |
| 21338 | |||
| 21339 | 14616558 | bool HeroClass::checksoliddamage() | |
| 21340 | { | ||
| 21341 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14616558 times.
|
14616558 | if(walk_through_walls) return false; |
| 21342 | |||
| 21343 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 14616558 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
14616558 | if (get_qr(qr_NO_SIDEVIEW_SOLID_DAMAGE) && get_qr(qr_NOSOLIDDAMAGECOMBOS)) return false; //no point checking if both of these rules are on |
| 21344 | |||
| 21345 |
2/4✓ Branch 0 taken 14616558 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 14616558 times.
|
14616558 | if(z!=0||fakez!=0) return false; |
| 21346 | 14616558 | int32_t bx = x.getInt(); | |
| 21347 | 14616558 | int32_t by = y.getInt(); | |
| 21348 | 14616558 | int32_t initk = 0; | |
| 21349 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 3598891 times.
✓ Branch 2 taken 2933182 times.
✓ Branch 3 taken 3919798 times.
✓ Branch 4 taken 4164687 times.
|
14616558 | switch(dir) |
| 21350 | { | ||
| 21351 | case up: | ||
| 21352 | |||
| 21353 |
2/2✓ Branch 0 taken 207302 times.
✓ Branch 1 taken 3391589 times.
|
3598891 | by-=get_qr(qr_NEW_HERO_MOVEMENT2)?(bigHitbox ? 4 : -4):(bigHitbox ? 1 : -7); |
| 21354 |
2/2✓ Branch 0 taken 83482 times.
✓ Branch 1 taken 3515409 times.
|
3598891 | if (get_qr(qr_LENIENT_SOLID_DAMAGE)) bx += 8; |
| 21355 |
2/2✓ Branch 0 taken 3514052 times.
✓ Branch 1 taken 1357 times.
|
3515409 | else if (!get_qr(qr_SENSITIVE_SOLID_DAMAGE)) bx += 4; |
| 21356 |
2/2✓ Branch 0 taken 3598777 times.
✓ Branch 1 taken 114 times.
|
3598891 | if(by<0) |
| 21357 | { | ||
| 21358 | 114 | return false; | |
| 21359 | } | ||
| 21360 | 3598777 | break; | |
| 21361 | |||
| 21362 | case down: | ||
| 21363 | |||
| 21364 | 2933182 | by+=20; | |
| 21365 |
2/2✓ Branch 0 taken 28423 times.
✓ Branch 1 taken 2904759 times.
|
2933182 | if (by >= world_h) |
| 21366 | { | ||
| 21367 | 28423 | return false; | |
| 21368 | } | ||
| 21369 | |||
| 21370 | 2904759 | break; | |
| 21371 | |||
| 21372 | case left: | ||
| 21373 | 3919798 | bx-=get_qr(qr_NEW_HERO_MOVEMENT2)?1:4; | |
| 21374 |
2/2✓ Branch 0 taken 119761 times.
✓ Branch 1 taken 3800037 times.
|
3919798 | if (get_qr(qr_LENIENT_SOLID_DAMAGE)) by += bigHitbox?7:11; |
| 21375 |
2/2✓ Branch 0 taken 3798317 times.
✓ Branch 1 taken 1720 times.
|
3800037 | else if (!get_qr(qr_SENSITIVE_SOLID_DAMAGE)) by += 4; |
| 21376 |
4/4✓ Branch 0 taken 3835152 times.
✓ Branch 1 taken 84646 times.
✓ Branch 2 taken 119761 times.
✓ Branch 3 taken 3715391 times.
|
3919798 | if (!bigHitbox && !get_qr(qr_LENIENT_SOLID_DAMAGE)) |
| 21377 | { | ||
| 21378 | 3715391 | by+=8; | |
| 21379 | 3715391 | initk = 1; | |
| 21380 | 3715391 | } | |
| 21381 |
2/2✓ Branch 0 taken 3899227 times.
✓ Branch 1 taken 20571 times.
|
3919798 | if(bx<0) |
| 21382 | { | ||
| 21383 | 20571 | return false; | |
| 21384 | } | ||
| 21385 | |||
| 21386 | 3899227 | break; | |
| 21387 | |||
| 21388 | case right: | ||
| 21389 | 4164687 | bx+=get_qr(qr_NEW_HERO_MOVEMENT2)?16:20; | |
| 21390 |
2/2✓ Branch 0 taken 118008 times.
✓ Branch 1 taken 4046679 times.
|
4164687 | if (get_qr(qr_LENIENT_SOLID_DAMAGE)) by += bigHitbox?7:11; |
| 21391 |
2/2✓ Branch 0 taken 4043351 times.
✓ Branch 1 taken 3328 times.
|
4046679 | else if (!get_qr(qr_SENSITIVE_SOLID_DAMAGE)) by += 4; |
| 21392 |
4/4✓ Branch 0 taken 4069828 times.
✓ Branch 1 taken 94859 times.
✓ Branch 2 taken 118008 times.
✓ Branch 3 taken 3951820 times.
|
4164687 | if (!bigHitbox && !get_qr(qr_LENIENT_SOLID_DAMAGE)) |
| 21393 | { | ||
| 21394 | 3951820 | by+=8; | |
| 21395 | 3951820 | initk = 1; | |
| 21396 | 3951820 | } | |
| 21397 |
2/2✓ Branch 0 taken 29386 times.
✓ Branch 1 taken 4135301 times.
|
4164687 | if (bx >= world_w) |
| 21398 | { | ||
| 21399 | 29386 | return false; | |
| 21400 | } | ||
| 21401 | |||
| 21402 | 4135301 | break; | |
| 21403 | } | ||
| 21404 | |||
| 21405 | 14538064 | newcombo const& cmb = combobuf[MAPCOMBO(bx, by)]; | |
| 21406 | 14538064 | int32_t t = cmb.type; | |
| 21407 |
2/2✓ Branch 0 taken 116 times.
✓ Branch 1 taken 14537948 times.
|
14538064 | if(cmb.only_gentrig) |
| 21408 | 116 | t = cNONE; | |
| 21409 | 14538064 | int32_t initbx = bx; | |
| 21410 | 14538064 | int32_t initby = by; | |
| 21411 | |||
| 21412 | // Unlike push blocks, damage combos should be tested on layers 2 and under | ||
| 21413 |
2/2✓ Branch 0 taken 27150723 times.
✓ Branch 1 taken 14538048 times.
|
41688771 | for(int32_t i=(get_qr(qr_DMGCOMBOLAYERFIX) ? 2 : 0); i>=0; i--) |
| 21414 | { | ||
| 21415 | 27150723 | bx = initbx; | |
| 21416 | 27150723 | by = initby; | |
| 21417 |
2/2✓ Branch 0 taken 7733663 times.
✓ Branch 1 taken 19417060 times.
|
27150723 | if (!get_qr(qr_NOSOLIDDAMAGECOMBOS)) |
| 21418 | { | ||
| 21419 |
2/2✓ Branch 0 taken 18115254 times.
✓ Branch 1 taken 46224190 times.
|
64339444 | for (int32_t k = initk; k <= 2; k++) |
| 21420 | { | ||
| 21421 | 46224190 | auto rpos_handle = get_rpos_handle_for_world_xy(bx, by, i); | |
| 21422 | 46224190 | auto& cmb = rpos_handle.combo(); | |
| 21423 | 46224190 | t = cmb.type; | |
| 21424 |
2/2✓ Branch 0 taken 46223845 times.
✓ Branch 1 taken 345 times.
|
46224190 | if(cmb.only_gentrig) |
| 21425 | 345 | t = cNONE; | |
| 21426 | // Solid damage combos use pushing>0, hence the code is here. | ||
| 21427 |
9/10✓ Branch 0 taken 2334417 times.
✓ Branch 1 taken 43889773 times.
✓ Branch 2 taken 76893 times.
✓ Branch 3 taken 2257524 times.
✓ Branch 4 taken 74004 times.
✓ Branch 5 taken 2889 times.
✓ Branch 6 taken 1566 times.
✓ Branch 7 taken 72438 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 1566 times.
|
46224190 | if (!get_qr(qr_LESS_AWFUL_SIDESPIKES) || !isSideViewHero() || (dir != down && (dir != up || getOnSideviewLadder()))) |
| 21428 | { | ||
| 21429 |
11/12✓ Branch 0 taken 33682 times.
✓ Branch 1 taken 46186053 times.
✓ Branch 2 taken 1272 times.
✓ Branch 3 taken 32410 times.
✓ Branch 4 taken 170 times.
✓ Branch 5 taken 1102 times.
✓ Branch 6 taken 68 times.
✓ Branch 7 taken 102 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 68 times.
✓ Branch 10 taken 46219667 times.
✓ Branch 11 taken 68 times.
|
46219735 | if(combo_class_buf[t].modify_hp_amount && _walkflag(bx,by,1,get_standing_z_state()) && pushing>0 && hclk<1 && action!=casting && action != sideswimcasting) |
| 21430 | { | ||
| 21431 | // Bite Hero | ||
| 21432 |
2/2✓ Branch 0 taken 59 times.
✓ Branch 1 taken 9 times.
|
68 | if (checkdamagecombos(bx, bx, by, by, i-1, true)) return true; |
| 21433 | 59 | } | |
| 21434 | 46219726 | } | |
| 21435 |
2/2✓ Branch 0 taken 24772856 times.
✓ Branch 1 taken 21451325 times.
|
46224181 | if (dir < left) bx += (k % 2) ? 7 : 8; |
| 21436 | 21451325 | else by += (k % 2) ? 7 : 8; | |
| 21437 |
2/2✓ Branch 0 taken 46150998 times.
✓ Branch 1 taken 73183 times.
|
46224181 | if (!is_in_world_bounds(bx, by)) break; |
| 21438 |
2/2✓ Branch 0 taken 44922384 times.
✓ Branch 1 taken 1228614 times.
|
46150998 | if (get_qr(qr_LENIENT_SOLID_DAMAGE)) break; |
| 21439 | 44922384 | } | |
| 21440 | 19417051 | } | |
| 21441 |
4/6✓ Branch 0 taken 479796 times.
✓ Branch 1 taken 26670918 times.
✓ Branch 2 taken 479796 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 446811 times.
|
27597525 | if(isSideViewHero() && !get_qr(qr_NO_SIDEVIEW_SOLID_DAMAGE) && // Check for sideview damage combos |
| 21442 |
3/4✓ Branch 0 taken 446811 times.
✓ Branch 1 taken 32985 times.
✓ Branch 2 taken 446811 times.
✗ Branch 3 not taken.
|
479796 | hclk<1 && action!=casting && action!=sideswimcasting) // ... but only if Hero could be hurt |
| 21443 | { | ||
| 21444 |
2/2✓ Branch 0 taken 35562 times.
✓ Branch 1 taken 411249 times.
|
446811 | if (get_qr(qr_LESS_AWFUL_SIDESPIKES)) |
| 21445 | { | ||
| 21446 |
2/6✓ Branch 0 taken 35562 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 35562 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
35562 | if (on_sideview_solid_oldpos(this) && (!getOnSideviewLadder() || getInput(btnDown, INPUT_DRUNK | INPUT_HERO_ACTION))) |
| 21447 | { | ||
| 21448 |
4/4✓ Branch 0 taken 35558 times.
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 35560 times.
✓ Branch 3 taken 2 times.
|
35562 | if(checkdamagecombos(x+4, x+4, y+16, y+18, i-1, false, false) && checkdamagecombos(x+12, x+12, y+16, y+18, i-1, false, false)) |
| 21449 | { | ||
| 21450 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | if (checkdamagecombos(x+4, x+12, y+16, y+18, i-1, false, true)) return true; |
| 21451 | ✗ | } | |
| 21452 | 35560 | } | |
| 21453 |
1/2✓ Branch 0 taken 35560 times.
✗ Branch 1 not taken.
|
35560 | if (checkdamagecombos(x+4, x+12, y+8, y+15, i-1, false, true)) return true; |
| 21454 | 35560 | } | |
| 21455 | else | ||
| 21456 | { | ||
| 21457 | //old 2.50.2-ish code for 2.50.0 sideview quests for er_OLDSIDEVIEWSPIKES | ||
| 21458 |
1/2✓ Branch 0 taken 411249 times.
✗ Branch 1 not taken.
|
411249 | if ( get_qr(qr_OLDSIDEVIEWSPIKES ) ) |
| 21459 | { | ||
| 21460 |
2/2✓ Branch 0 taken 411244 times.
✓ Branch 1 taken 5 times.
|
822498 | if (checkdamagecombos(x+8-(zfix)(hero_scr->csensitive), |
| 21461 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 411249 times.
|
411249 | x+8+(zc_max(hero_scr->csensitive-1,0)), |
| 21462 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 411249 times.
|
411249 | y+17-(get_qr(qr_LTTPCOLLISION)?hero_scr->csensitive:(hero_scr->csensitive+1)/2), |
| 21463 |
3/6✗ Branch 0 not taken.
✓ Branch 1 taken 411249 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 411249 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 411249 times.
|
411249 | y+17+zc_max((get_qr(qr_LTTPCOLLISION)?hero_scr->csensitive:(hero_scr->csensitive+1)/2)-1,0), i-1, true)) |
| 21464 | 5 | return true; | |
| 21465 | 411244 | } | |
| 21466 | else //2.50.1 and later | ||
| 21467 | { | ||
| 21468 | ✗ | if(checkdamagecombos(x+4, x+12, y+16, y+24)) | |
| 21469 | ✗ | return true; | |
| 21470 | } | ||
| 21471 | } | ||
| 21472 | |||
| 21473 | 446804 | } | |
| 21474 | 27150707 | } | |
| 21475 | |||
| 21476 | 14538048 | return false; | |
| 21477 | 14616558 | } | |
| 21478 | 14809352 | void HeroClass::checkpushblock() | |
| 21479 | { | ||
| 21480 |
2/2✓ Branch 0 taken 14993 times.
✓ Branch 1 taken 14794359 times.
|
14809352 | if(walk_through_walls) return; |
| 21481 | |||
| 21482 |
3/4✓ Branch 0 taken 14774611 times.
✓ Branch 1 taken 19748 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 14774611 times.
|
14794359 | if(z!=0||fakez!=0) return; |
| 21483 | |||
| 21484 | // Return early in some cases.. | ||
| 21485 | 14774611 | bool earlyReturn=false; | |
| 21486 | |||
| 21487 |
5/6✓ Branch 0 taken 9724059 times.
✓ Branch 1 taken 5050552 times.
✓ Branch 2 taken 9724059 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 11112626 times.
✓ Branch 5 taken 3661985 times.
|
14774611 | if(!(diagonalMovement||NO_GRIDLOCK) || dir==left) |
| 21488 |
2/2✓ Branch 0 taken 3882676 times.
✓ Branch 1 taken 7229950 times.
|
11112626 | if(x.getInt()&15) earlyReturn=true; |
| 21489 | |||
| 21490 |
4/4✓ Branch 0 taken 319027 times.
✓ Branch 1 taken 14455584 times.
✓ Branch 2 taken 160974 times.
✓ Branch 3 taken 158053 times.
|
14774611 | if(isSideViewHero() && !on_sideview_solid_oldpos(this)) return; |
| 21491 | |||
| 21492 | 14616558 | int32_t bx = TRUNCATE_TILE(x.getInt()); | |
| 21493 | 14616558 | int32_t by = TRUNCATE_TILE(y.getInt()); | |
| 21494 | |||
| 21495 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 3598891 times.
✓ Branch 2 taken 2933182 times.
✓ Branch 3 taken 3919798 times.
✓ Branch 4 taken 4164687 times.
|
14616558 | switch(dir) |
| 21496 | { | ||
| 21497 | case up: | ||
| 21498 |
2/2✓ Branch 0 taken 124758 times.
✓ Branch 1 taken 3474133 times.
|
3598891 | if(y<16) |
| 21499 | { | ||
| 21500 | 124758 | earlyReturn=true; | |
| 21501 | 124758 | break; | |
| 21502 | } | ||
| 21503 | |||
| 21504 |
3/4✓ Branch 0 taken 599725 times.
✓ Branch 1 taken 2874408 times.
✓ Branch 2 taken 599725 times.
✗ Branch 3 not taken.
|
3474133 | if(!((int32_t)y&15)&&y!=0) by-=bigHitbox ? 16 : 0; |
| 21505 | |||
| 21506 |
2/2✓ Branch 0 taken 2017896 times.
✓ Branch 1 taken 1456237 times.
|
3474133 | if((int32_t)x&8) bx+=16; |
| 21507 | |||
| 21508 | 3474133 | break; | |
| 21509 | |||
| 21510 | case down: | ||
| 21511 |
2/2✓ Branch 0 taken 246252 times.
✓ Branch 1 taken 2686930 times.
|
2933182 | if(y>world_h-48) |
| 21512 | { | ||
| 21513 | 246252 | earlyReturn=true; | |
| 21514 | 246252 | break; | |
| 21515 | } | ||
| 21516 | else | ||
| 21517 | { | ||
| 21518 | 2686930 | by+=16; | |
| 21519 | |||
| 21520 |
2/2✓ Branch 0 taken 1720128 times.
✓ Branch 1 taken 966802 times.
|
2686930 | if((int32_t)x&8) bx+=16; |
| 21521 | } | ||
| 21522 | |||
| 21523 | 2686930 | break; | |
| 21524 | |||
| 21525 | case left: | ||
| 21526 |
2/2✓ Branch 0 taken 209255 times.
✓ Branch 1 taken 3710543 times.
|
3919798 | if(x<32) |
| 21527 | { | ||
| 21528 | 209255 | earlyReturn=true; | |
| 21529 | 209255 | break; | |
| 21530 | } | ||
| 21531 | else | ||
| 21532 | { | ||
| 21533 | 3710543 | bx-=16; | |
| 21534 | |||
| 21535 |
2/2✓ Branch 0 taken 2223003 times.
✓ Branch 1 taken 1487540 times.
|
3710543 | if(y.getInt()&8) |
| 21536 | { | ||
| 21537 | 1487540 | by+=16; | |
| 21538 | 1487540 | } | |
| 21539 | } | ||
| 21540 | |||
| 21541 | 3710543 | break; | |
| 21542 | |||
| 21543 | case right: | ||
| 21544 |
2/2✓ Branch 0 taken 217851 times.
✓ Branch 1 taken 3946836 times.
|
4164687 | if(x>world_w-48) |
| 21545 | { | ||
| 21546 | 217851 | earlyReturn=true; | |
| 21547 | 217851 | break; | |
| 21548 | } | ||
| 21549 | else | ||
| 21550 | { | ||
| 21551 | 3946836 | bx+=16; | |
| 21552 | |||
| 21553 |
2/2✓ Branch 0 taken 2388003 times.
✓ Branch 1 taken 1558833 times.
|
3946836 | if(y.getInt()&8) |
| 21554 | { | ||
| 21555 | 1558833 | by+=16; | |
| 21556 | 1558833 | } | |
| 21557 | } | ||
| 21558 | |||
| 21559 | 3946836 | break; | |
| 21560 | } | ||
| 21561 | |||
| 21562 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 14616542 times.
|
14616558 | if (checksoliddamage()) return; |
| 21563 | |||
| 21564 |
2/2✓ Branch 0 taken 7558656 times.
✓ Branch 1 taken 7057886 times.
|
14616542 | if(earlyReturn) |
| 21565 | 7558656 | return; | |
| 21566 | |||
| 21567 | 7057886 | int itemid=current_item_id(itype_bracelet); | |
| 21568 | 7057886 | rpos_t rpos = COMBOPOS_REGION(bx, by); | |
| 21569 | 7057886 | size_t combopos = RPOS_TO_POS(rpos); | |
| 21570 | |||
| 21571 |
2/2✓ Branch 0 taken 2921174 times.
✓ Branch 1 taken 4136712 times.
|
7057886 | bool limitedpush = (itemid>=0 && itemsbuf[itemid].flags & item_flag1); |
| 21572 |
2/2✓ Branch 0 taken 4136712 times.
✓ Branch 1 taken 2921174 times.
|
7057886 | itemdata const* glove = itemid < 0 ? NULL : &itemsbuf[itemid]; |
| 21573 |
2/2✓ Branch 0 taken 1734806 times.
✓ Branch 1 taken 10539684 times.
|
12274490 | for(int lyr = 2; lyr >= 0; --lyr) //Top-down, in case of stacked push blocks |
| 21574 | { | ||
| 21575 |
4/4✓ Branch 0 taken 6838723 times.
✓ Branch 1 taken 3700961 times.
✓ Branch 2 taken 1521512 times.
✓ Branch 3 taken 5317211 times.
|
10539684 | if(get_qr(qr_HESITANTPUSHBLOCKS)&&(pushing<4)) break; |
| 21576 |
4/4✓ Branch 0 taken 3481221 times.
✓ Branch 1 taken 1741252 times.
✓ Branch 2 taken 128339 times.
✓ Branch 3 taken 3352882 times.
|
5222473 | if(lyr && !get_qr(qr_PUSHBLOCK_LAYER_1_2)) |
| 21577 | 3352882 | continue; | |
| 21578 | 1869591 | auto rpos_handle = get_rpos_handle(rpos, lyr); | |
| 21579 | 1869591 | cpos_info& cpinfo = rpos_handle.info(); | |
| 21580 | 1869591 | mapscr* m = rpos_handle.scr; | |
| 21581 |
2/2✓ Branch 0 taken 129157 times.
✓ Branch 1 taken 1740434 times.
|
1869591 | int cid = lyr == 0 ? MAPCOMBO(bx,by) : MAPCOMBOL(lyr,bx,by); |
| 21582 | 1869591 | newcombo const& cmb = combobuf[cid]; | |
| 21583 | 1869591 | int f = MAPFLAG2(lyr-1,bx,by); | |
| 21584 | 1869591 | int f2 = cmb.flag; | |
| 21585 | 1869591 | int t = cmb.type; | |
| 21586 | |||
| 21587 |
6/6✓ Branch 0 taken 1753737 times.
✓ Branch 1 taken 115854 times.
✓ Branch 2 taken 1749204 times.
✓ Branch 3 taken 4533 times.
✓ Branch 4 taken 2464 times.
✓ Branch 5 taken 1746740 times.
|
3616331 | bool waitblock = (t==cPUSH_WAIT || t==cPUSH_HW || t==cPUSH_HW2) || |
| 21588 |
2/2✓ Branch 0 taken 1745686 times.
✓ Branch 1 taken 1054 times.
|
1746740 | (t == cPUSHBLOCK && (cmb.usrflags&cflag6)); |
| 21589 | 1869591 | int heavy = 0; | |
| 21590 |
4/4✓ Branch 0 taken 1864240 times.
✓ Branch 1 taken 5351 times.
✓ Branch 2 taken 15070 times.
✓ Branch 3 taken 1849170 times.
|
1869591 | if(t==cPUSH_HW || t==cPUSH_HEAVY) |
| 21591 | 20421 | heavy = 1; | |
| 21592 |
4/4✓ Branch 0 taken 1845273 times.
✓ Branch 1 taken 3897 times.
✓ Branch 2 taken 2464 times.
✓ Branch 3 taken 1842809 times.
|
1849170 | else if(t==cPUSH_HEAVY2 || t==cPUSH_HW2) |
| 21593 | 6361 | heavy = 2; | |
| 21594 |
2/2✓ Branch 0 taken 1841755 times.
✓ Branch 1 taken 1054 times.
|
1842809 | else if(t == cPUSHBLOCK) |
| 21595 | 1054 | heavy = cmb.attribytes[0]; | |
| 21596 | |||
| 21597 |
6/6✓ Branch 0 taken 122033 times.
✓ Branch 1 taken 1747558 times.
✓ Branch 2 taken 39487 times.
✓ Branch 3 taken 82546 times.
✓ Branch 4 taken 3776 times.
✓ Branch 5 taken 35711 times.
|
1869591 | if(waitblock && (pushing<16 || hasMainGuy(m->screen))) continue; |
| 21598 | |||
| 21599 |
8/8✓ Branch 0 taken 1761666 times.
✓ Branch 1 taken 21603 times.
✓ Branch 2 taken 18703 times.
✓ Branch 3 taken 2900 times.
✓ Branch 4 taken 3045 times.
✓ Branch 5 taken 15658 times.
✓ Branch 6 taken 6320 times.
✓ Branch 7 taken 1776949 times.
|
1820530 | if(heavy && (itemid<0 || glove->power < heavy || |
| 21600 |
3/4✓ Branch 0 taken 12758 times.
✓ Branch 1 taken 2900 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2900 times.
|
21978 | (limitedpush && usecounts[itemid] >= zc_max(1, glove->misc3)))) continue; |
| 21601 | |||
| 21602 | 1776949 | bool doit=false; | |
| 21603 | 1776949 | bool changecombo=false; | |
| 21604 | |||
| 21605 | 1776949 | int blockdir = dir; | |
| 21606 |
1/2✓ Branch 0 taken 1776949 times.
✗ Branch 1 not taken.
|
1776949 | if(blockdir > 3) blockdir = Y_DIR(dir); |
| 21607 |
6/6✓ Branch 0 taken 1027 times.
✓ Branch 1 taken 1775922 times.
✓ Branch 2 taken 890 times.
✓ Branch 3 taken 137 times.
✓ Branch 4 taken 587 times.
✓ Branch 5 taken 303 times.
|
1776949 | if(t == cPUSHBLOCK && (get_qr(qr_BROKEN_GENERIC_PUSHBLOCK_LOCKING) || (f!=mfPUSHED))) |
| 21608 | { | ||
| 21609 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 97 times.
✓ Branch 2 taken 214 times.
✓ Branch 3 taken 244 times.
✓ Branch 4 taken 169 times.
|
724 | switch(blockdir) |
| 21610 | { | ||
| 21611 | case up: | ||
| 21612 | 97 | doit = cmb.usrflags & cflag1; | |
| 21613 | 97 | break; | |
| 21614 | case down: | ||
| 21615 | 214 | doit = cmb.usrflags & cflag2; | |
| 21616 | 214 | break; | |
| 21617 | case left: | ||
| 21618 | 244 | doit = cmb.usrflags & cflag3; | |
| 21619 | 244 | break; | |
| 21620 | case right: | ||
| 21621 | 169 | doit = cmb.usrflags & cflag4; | |
| 21622 | 169 | break; | |
| 21623 | } | ||
| 21624 | 724 | bool cancel_opp = (cmb.usrflags & cflag9); | |
| 21625 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 724 times.
|
724 | if(cmb.usrflags & cflag5) //Separate directions |
| 21626 | { | ||
| 21627 | ✗ | int limit = cmb.attribytes[4+blockdir]; | |
| 21628 | ✗ | if(limit || (cmb.usrflags & cflag9)) // don't limit if limit should be infinite | |
| 21629 | { | ||
| 21630 | ✗ | int pushes = cpinfo.pushes[blockdir]; | |
| 21631 | ✗ | if(cancel_opp) | |
| 21632 | ✗ | pushes -= cpinfo.pushes[oppositeDir[blockdir]]; | |
| 21633 | ✗ | if(pushes >= limit) | |
| 21634 | ✗ | doit = false; | |
| 21635 | ✗ | } | |
| 21636 | ✗ | } | |
| 21637 | else | ||
| 21638 | { | ||
| 21639 |
2/2✓ Branch 0 taken 99 times.
✓ Branch 1 taken 625 times.
|
724 | if(int limit = cmb.attribytes[4]) |
| 21640 | { | ||
| 21641 |
2/2✓ Branch 0 taken 86 times.
✓ Branch 1 taken 13 times.
|
99 | if(cpinfo.sumpush() >= limit) |
| 21642 | 13 | doit = false; | |
| 21643 | 99 | } | |
| 21644 |
1/2✓ Branch 0 taken 625 times.
✗ Branch 1 not taken.
|
625 | else if(cmb.usrflags & cflag9) |
| 21645 | ✗ | doit = false; | |
| 21646 | } | ||
| 21647 | 724 | } | |
| 21648 | else | ||
| 21649 | { | ||
| 21650 |
2/2✓ Branch 0 taken 1767771 times.
✓ Branch 1 taken 8454 times.
|
1776225 | if(is_push_flag(f,dir)) |
| 21651 | { | ||
| 21652 | 8454 | doit=true; | |
| 21653 | 8454 | } | |
| 21654 | |||
| 21655 |
7/8✓ Branch 0 taken 1775407 times.
✓ Branch 1 taken 818 times.
✓ Branch 2 taken 1775407 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 569 times.
✓ Branch 5 taken 1775656 times.
✓ Branch 6 taken 1774407 times.
✓ Branch 7 taken 1000 times.
|
3551063 | if((((f2==mfPUSHUD || f2==mfPUSHUDNS|| f2==mfPUSHUDINS) && dir<=down) || |
| 21656 |
3/4✓ Branch 0 taken 1775375 times.
✓ Branch 1 taken 281 times.
✓ Branch 2 taken 1775375 times.
✗ Branch 3 not taken.
|
1775656 | ((f2==mfPUSHLR || f2==mfPUSHLRNS|| f2==mfPUSHLRINS) && dir>=left) || |
| 21657 |
3/4✓ Branch 0 taken 1775345 times.
✓ Branch 1 taken 311 times.
✓ Branch 2 taken 1775345 times.
✗ Branch 3 not taken.
|
1775656 | ((f2==mfPUSHU || f2==mfPUSHUNS || f2==mfPUSHUINS) && dir==up) || |
| 21658 |
3/4✓ Branch 0 taken 1775029 times.
✓ Branch 1 taken 91 times.
✓ Branch 2 taken 1775029 times.
✗ Branch 3 not taken.
|
1775120 | ((f2==mfPUSHD || f2==mfPUSHDNS || f2==mfPUSHDINS) && dir==down) || |
| 21659 |
3/4✓ Branch 0 taken 1774955 times.
✓ Branch 1 taken 89 times.
✓ Branch 2 taken 1774955 times.
✗ Branch 3 not taken.
|
1775044 | ((f2==mfPUSHL || f2==mfPUSHLNS || f2==mfPUSHLINS) && dir==left) || |
| 21660 |
3/4✓ Branch 0 taken 1774938 times.
✓ Branch 1 taken 100 times.
✓ Branch 2 taken 1774938 times.
✗ Branch 3 not taken.
|
1775038 | ((f2==mfPUSHR || f2==mfPUSHRNS || f2==mfPUSHRINS) && dir==right) || |
| 21661 |
2/2✓ Branch 0 taken 1774250 times.
✓ Branch 1 taken 588 times.
|
1775407 | f2==mfPUSH4 || f2==mfPUSH4NS || f2==mfPUSH4INS)&&(f!=mfPUSHED)) |
| 21662 | { | ||
| 21663 | 1000 | changecombo=true; | |
| 21664 | 1000 | doit=true; | |
| 21665 | 1000 | } | |
| 21666 | } | ||
| 21667 | |||
| 21668 |
2/2✓ Branch 0 taken 882780 times.
✓ Branch 1 taken 893351 times.
|
1776131 | if(get_qr(qr_SOLIDBLK)) |
| 21669 | { | ||
| 21670 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 265091 times.
✓ Branch 2 taken 217776 times.
✓ Branch 3 taken 178641 times.
✓ Branch 4 taken 231843 times.
|
893351 | switch(blockdir) |
| 21671 | { | ||
| 21672 | case up: | ||
| 21673 |
4/4✓ Branch 0 taken 265066 times.
✓ Branch 1 taken 25 times.
✓ Branch 2 taken 8 times.
✓ Branch 3 taken 265058 times.
|
265091 | if(MAPFLAG2(lyr-1,bx,by-8)==mfBLOCKHOLE||MAPCOMBOFLAG2(lyr-1,bx,by-8)==mfBLOCKHOLE) |
| 21674 | 33 | break; // ignore solidity for BLOCKHOLE flagged combos | |
| 21675 |
2/2✓ Branch 0 taken 108599 times.
✓ Branch 1 taken 156459 times.
|
265058 | if(_walkflag(bx,by-8,2,get_standing_z_state())) |
| 21676 | 108599 | doit = false; | |
| 21677 |
4/4✓ Branch 0 taken 145541 times.
✓ Branch 1 taken 10918 times.
✓ Branch 2 taken 156039 times.
✓ Branch 3 taken 420 times.
|
156459 | else if(!get_qr(qr_BROKEN_PUSHBLOCK_TOP_HALF_SOLIDS) && _walkflag(bx,by-16,2,get_standing_z_state())) |
| 21678 | 420 | doit = false; // top half wasn't checked before... | |
| 21679 | 265058 | break; | |
| 21680 | |||
| 21681 | case down: | ||
| 21682 |
4/4✓ Branch 0 taken 217769 times.
✓ Branch 1 taken 7 times.
✓ Branch 2 taken 10 times.
✓ Branch 3 taken 217759 times.
|
217776 | if(MAPFLAG2(lyr-1,bx,by+24)==mfBLOCKHOLE||MAPCOMBOFLAG2(lyr-1,bx,by+24)==mfBLOCKHOLE) |
| 21683 | 17 | break; // ignore solidity for BLOCKHOLE flagged combos | |
| 21684 |
2/2✓ Branch 0 taken 98610 times.
✓ Branch 1 taken 119149 times.
|
217759 | if(_walkflag(bx,by+24,2,get_standing_z_state())) |
| 21685 | 98610 | doit = false; | |
| 21686 |
4/4✓ Branch 0 taken 111387 times.
✓ Branch 1 taken 7762 times.
✓ Branch 2 taken 117370 times.
✓ Branch 3 taken 1779 times.
|
119149 | else if(!get_qr(qr_BROKEN_PUSHBLOCK_TOP_HALF_SOLIDS) && _walkflag(bx,by+16,2,get_standing_z_state())) |
| 21687 | 1779 | doit = false; // top half wasn't checked before... | |
| 21688 | 217759 | break; | |
| 21689 | |||
| 21690 | case left: | ||
| 21691 |
3/4✓ Branch 0 taken 178641 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 16 times.
✓ Branch 3 taken 178625 times.
|
178641 | if(MAPFLAG2(lyr-1,bx-16,by+8)==mfBLOCKHOLE||MAPCOMBOFLAG2(lyr-1,bx-16,by+8)==mfBLOCKHOLE) |
| 21692 | 16 | break; // ignore solidity for BLOCKHOLE flagged combos | |
| 21693 |
2/2✓ Branch 0 taken 98900 times.
✓ Branch 1 taken 79725 times.
|
178625 | if(_walkflag(bx-16,by+8,2,get_standing_z_state())) |
| 21694 | 98900 | doit = false; | |
| 21695 |
4/4✓ Branch 0 taken 76386 times.
✓ Branch 1 taken 3339 times.
✓ Branch 2 taken 79692 times.
✓ Branch 3 taken 33 times.
|
79725 | else if(!get_qr(qr_BROKEN_PUSHBLOCK_TOP_HALF_SOLIDS) && _walkflag(bx-16,by,2,get_standing_z_state())) |
| 21696 | 33 | doit = false; // top half wasn't checked before... | |
| 21697 | 178625 | break; | |
| 21698 | |||
| 21699 | case right: | ||
| 21700 |
4/4✓ Branch 0 taken 231834 times.
✓ Branch 1 taken 9 times.
✓ Branch 2 taken 47 times.
✓ Branch 3 taken 231787 times.
|
231843 | if(MAPFLAG2(lyr-1,bx+16,by+8)==mfBLOCKHOLE||MAPCOMBOFLAG2(lyr-1,bx+16,by+8)==mfBLOCKHOLE) |
| 21701 | 56 | break; // ignore solidity for BLOCKHOLE flagged combos | |
| 21702 |
2/2✓ Branch 0 taken 126234 times.
✓ Branch 1 taken 105553 times.
|
231787 | if(_walkflag(bx+16,by+8,2,get_standing_z_state())) |
| 21703 | 126234 | doit = false; | |
| 21704 |
3/4✓ Branch 0 taken 100235 times.
✓ Branch 1 taken 5318 times.
✓ Branch 2 taken 105553 times.
✗ Branch 3 not taken.
|
105553 | else if(!get_qr(qr_BROKEN_PUSHBLOCK_TOP_HALF_SOLIDS) && _walkflag(bx+16,by,2,get_standing_z_state())) |
| 21705 | ✗ | doit = false; // top half wasn't checked before... | |
| 21706 | 231787 | break; | |
| 21707 | } | ||
| 21708 | 893351 | } | |
| 21709 | |||
| 21710 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 631302 times.
✓ Branch 2 taken 516312 times.
✓ Branch 3 taken 285281 times.
✓ Branch 4 taken 343236 times.
|
1776131 | switch(blockdir) |
| 21711 | { | ||
| 21712 | case up: | ||
| 21713 |
4/4✓ Branch 0 taken 629999 times.
✓ Branch 1 taken 1303 times.
✓ Branch 2 taken 704 times.
✓ Branch 3 taken 629295 times.
|
631302 | if((MAPFLAG2(lyr-1,bx,by-8)==mfNOBLOCKS||MAPCOMBOFLAG2(lyr-1,bx,by-8)==mfNOBLOCKS)) doit=false; |
| 21714 | |||
| 21715 | 631302 | break; | |
| 21716 | |||
| 21717 | case down: | ||
| 21718 |
4/4✓ Branch 0 taken 515019 times.
✓ Branch 1 taken 1293 times.
✓ Branch 2 taken 610 times.
✓ Branch 3 taken 514409 times.
|
516312 | if((MAPFLAG2(lyr-1,bx,by+24)==mfNOBLOCKS||MAPCOMBOFLAG2(lyr-1,bx,by+24)==mfNOBLOCKS)) doit=false; |
| 21719 | |||
| 21720 | 516312 | break; | |
| 21721 | |||
| 21722 | case left: | ||
| 21723 |
4/4✓ Branch 0 taken 284401 times.
✓ Branch 1 taken 880 times.
✓ Branch 2 taken 287 times.
✓ Branch 3 taken 284114 times.
|
285281 | if((MAPFLAG2(lyr-1,bx-16,by+8)==mfNOBLOCKS||MAPCOMBOFLAG2(lyr-1,bx-16,by+8)==mfNOBLOCKS)) doit=false; |
| 21724 | |||
| 21725 | 285281 | break; | |
| 21726 | |||
| 21727 | case right: | ||
| 21728 |
4/4✓ Branch 0 taken 341765 times.
✓ Branch 1 taken 1471 times.
✓ Branch 2 taken 615 times.
✓ Branch 3 taken 341150 times.
|
343236 | if((MAPFLAG2(lyr-1,bx+16,by+8)==mfNOBLOCKS||MAPCOMBOFLAG2(lyr-1,bx+16,by+8)==mfNOBLOCKS)) doit=false; |
| 21729 | |||
| 21730 | 343236 | break; | |
| 21731 | } | ||
| 21732 | |||
| 21733 |
2/2✓ Branch 0 taken 1771080 times.
✓ Branch 1 taken 5051 times.
|
1776131 | if(doit) |
| 21734 | { | ||
| 21735 |
2/2✓ Branch 0 taken 4998 times.
✓ Branch 1 taken 53 times.
|
5051 | if(limitedpush) |
| 21736 | 53 | ++usecounts[itemid]; | |
| 21737 | |||
| 21738 | // for(int32_t i=0; i<1; i++) | ||
| 21739 |
2/2✓ Branch 0 taken 736 times.
✓ Branch 1 taken 4315 times.
|
5051 | if(!mblock2.active()) |
| 21740 | { | ||
| 21741 |
2/2✓ Branch 0 taken 705 times.
✓ Branch 1 taken 3610 times.
|
4315 | if(is_push_flag(f,dir)) // Only erase push flags, because only push flags should be copied in the block code. |
| 21742 | 3610 | m->sflag[combopos] = 0; | |
| 21743 | |||
| 21744 | 4315 | mblock2.blockLayer = lyr; | |
| 21745 | |||
| 21746 |
2/2✓ Branch 0 taken 293 times.
✓ Branch 1 taken 4022 times.
|
4315 | if(t == cPUSHBLOCK) |
| 21747 | { | ||
| 21748 | 293 | zfix blockstep = 0.5; | |
| 21749 |
2/2✓ Branch 0 taken 88 times.
✓ Branch 1 taken 205 times.
|
293 | if(cmb.attrishorts[0] > 0) |
| 21750 | 205 | blockstep = zslongToFix(cmb.attrishorts[0]*100); | |
| 21751 | 293 | mblock2.push_new(zfix(bx),zfix(by),blockdir,f,blockstep); | |
| 21752 | 293 | mblock2.blockinfo = cpinfo; | |
| 21753 | 293 | mblock2.blockinfo.push(blockdir, cmb.usrflags&cflag8); | |
| 21754 | 293 | cpinfo.clearInfo(); | |
| 21755 |
2/2✓ Branch 0 taken 54 times.
✓ Branch 1 taken 239 times.
|
293 | if(cmb.attribytes[1]) |
| 21756 | 239 | sfx(cmb.attribytes[1],(int32_t)x); | |
| 21757 | 293 | } | |
| 21758 | else | ||
| 21759 | { | ||
| 21760 | 4022 | mblock2.push((zfix)bx,(zfix)by,blockdir,f); | |
| 21761 | |||
| 21762 |
2/2✓ Branch 0 taken 1214 times.
✓ Branch 1 taken 2808 times.
|
4022 | if(get_qr(qr_MORESOUNDS)) |
| 21763 | 1214 | sfx(WAV_ZN1PUSHBLOCK,(int32_t)x); | |
| 21764 | } | ||
| 21765 | 4315 | } | |
| 21766 | 5051 | break; | |
| 21767 | } | ||
| 21768 | 1771080 | } | |
| 21769 | 14808534 | } | |
| 21770 | |||
| 21771 | 867 | bool usekey() | |
| 21772 | { | ||
| 21773 | 867 | int32_t itemid = current_item_id(itype_magickey); | |
| 21774 | |||
| 21775 |
3/4✓ Branch 0 taken 807 times.
✓ Branch 1 taken 60 times.
✓ Branch 2 taken 60 times.
✗ Branch 3 not taken.
|
867 | if(itemid<0 || |
| 21776 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 60 times.
|
60 | (itemsbuf[itemid].flags & item_flag1 ? itemsbuf[itemid].power<dlevel |
| 21777 | ✗ | : itemsbuf[itemid].power!=dlevel)) | |
| 21778 | { | ||
| 21779 |
2/2✓ Branch 0 taken 139 times.
✓ Branch 1 taken 668 times.
|
807 | if(game->lvlkeys[dlevel]!=0) |
| 21780 | { | ||
| 21781 | 139 | game->lvlkeys[dlevel]--; | |
| 21782 | //run script for level key item | ||
| 21783 | 139 | int32_t key_item = 0; //current_item_id(itype_lkey); //not possible | |
| 21784 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10765 times.
|
10765 | for ( int32_t q = 0; q < MAXITEMS; ++q ) |
| 21785 | { | ||
| 21786 |
2/2✓ Branch 0 taken 10626 times.
✓ Branch 1 taken 139 times.
|
10765 | if ( itemsbuf[q].type == itype_lkey ) |
| 21787 | { | ||
| 21788 | 139 | key_item = q; break; | |
| 21789 | } | ||
| 21790 | 10626 | } | |
| 21791 | |||
| 21792 |
2/8✓ Branch 0 taken 139 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 139 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
139 | if ( key_item > 0 && itemsbuf[key_item].script && !(FFCore.doscript(ScriptType::Item, key_item) && get_qr(qr_ITEMSCRIPTSKEEPRUNNING)) ) |
| 21793 | { | ||
| 21794 | ✗ | int i = key_item; | |
| 21795 | ✗ | FFCore.reset_script_engine_data(ScriptType::Item, i); | |
| 21796 | ✗ | ZScriptVersion::RunScript(ScriptType::Item, itemsbuf[i].script, i); | |
| 21797 | ✗ | FFCore.deallocateAllScriptOwned(ScriptType::Item,(key_item)); | |
| 21798 | ✗ | } | |
| 21799 | 139 | return true; | |
| 21800 | } | ||
| 21801 | else | ||
| 21802 | { | ||
| 21803 |
2/2✓ Branch 0 taken 336 times.
✓ Branch 1 taken 332 times.
|
668 | if(game->get_keys()==0) |
| 21804 | { | ||
| 21805 | 332 | return false; | |
| 21806 | } | ||
| 21807 | else | ||
| 21808 | { | ||
| 21809 | //run script for key item | ||
| 21810 | 336 | int32_t key_item = 0; //current_item_id(itype_key); //not possible | |
| 21811 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3360 times.
|
3360 | for ( int32_t q = 0; q < MAXITEMS; ++q ) |
| 21812 | { | ||
| 21813 |
2/2✓ Branch 0 taken 3024 times.
✓ Branch 1 taken 336 times.
|
3360 | if ( itemsbuf[q].type == itype_key ) |
| 21814 | { | ||
| 21815 | 336 | key_item = q; break; | |
| 21816 | } | ||
| 21817 | 3024 | } | |
| 21818 |
2/8✓ Branch 0 taken 336 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 336 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
336 | if ( key_item > 0 && itemsbuf[key_item].script && !(FFCore.doscript(ScriptType::Item, key_item) && get_qr(qr_ITEMSCRIPTSKEEPRUNNING)) ) |
| 21819 | { | ||
| 21820 | ✗ | int i = key_item; | |
| 21821 | ✗ | FFCore.reset_script_engine_data(ScriptType::Item, i); | |
| 21822 | ✗ | ZScriptVersion::RunScript(ScriptType::Item, itemsbuf[i].script, i); | |
| 21823 | ✗ | FFCore.deallocateAllScriptOwned(ScriptType::Item,(key_item)); | |
| 21824 | ✗ | } | |
| 21825 | 336 | game->change_keys(-1); | |
| 21826 | } | ||
| 21827 | } | ||
| 21828 | 336 | } | |
| 21829 | |||
| 21830 | 396 | return true; | |
| 21831 | 867 | } | |
| 21832 | |||
| 21833 | 21 | bool canUseKey(int32_t num) | |
| 21834 | { | ||
| 21835 | 21 | int32_t itemid = current_item_id(itype_magickey); | |
| 21836 | |||
| 21837 |
1/4✓ Branch 0 taken 21 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
21 | if(itemid<0 || |
| 21838 | ✗ | (itemsbuf[itemid].flags & item_flag1 ? itemsbuf[itemid].power<dlevel | |
| 21839 | ✗ | : itemsbuf[itemid].power!=dlevel)) | |
| 21840 | { | ||
| 21841 | 21 | return game->lvlkeys[dlevel] + game->get_keys() >= num; | |
| 21842 | } | ||
| 21843 | |||
| 21844 | ✗ | return true; | |
| 21845 | 21 | } | |
| 21846 | |||
| 21847 | 21 | bool usekey(int32_t num) | |
| 21848 | { | ||
| 21849 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 18 times.
|
21 | if(!canUseKey(num)) return false; |
| 21850 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 18 times.
|
36 | for(auto q = 0; q < num; ++q) |
| 21851 | { | ||
| 21852 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 18 times.
|
18 | if(!usekey()) return false; //should never return false here, but, just to be safe.... |
| 21853 | 18 | } | |
| 21854 | 18 | return true; | |
| 21855 | 21 | } | |
| 21856 | |||
| 21857 | |||
| 21858 | 1262 | bool islockeddoor(int32_t x, int32_t y, int32_t lock) | |
| 21859 | { | ||
| 21860 | 1262 | int32_t mc = (y&0xF0)+(x>>4); | |
| 21861 |
4/6✓ Branch 0 taken 1262 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1262 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1176 times.
✓ Branch 5 taken 86 times.
|
2524 | bool ret = (((mc==7||mc==8||mc==23||mc==24) && origin_scr->door[up]==lock) |
| 21862 |
4/8✗ Branch 0 not taken.
✓ Branch 1 taken 1262 times.
✓ Branch 2 taken 1262 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1262 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1262 times.
✗ Branch 7 not taken.
|
1262 | || ((mc==151||mc==152||mc==167||mc==168) && origin_scr->door[down]==lock) |
| 21863 |
3/6✓ Branch 0 taken 1262 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1262 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1262 times.
✗ Branch 5 not taken.
|
1262 | || ((mc==64||mc==65||mc==80||mc==81) && origin_scr->door[left]==lock) |
| 21864 |
5/8✓ Branch 0 taken 1253 times.
✓ Branch 1 taken 9 times.
✓ Branch 2 taken 1253 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1253 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 1253 times.
|
1262 | || ((mc==78||mc==79||mc==94||mc==95) && origin_scr->door[right]==lock)); |
| 21865 | 1262 | return ret; | |
| 21866 | } | ||
| 21867 | |||
| 21868 | 13718356 | void HeroClass::oldchecklockblock() | |
| 21869 | { | ||
| 21870 |
2/2✓ Branch 0 taken 14355 times.
✓ Branch 1 taken 13704001 times.
|
13718356 | if(walk_through_walls) return; |
| 21871 | |||
| 21872 | 13704001 | int32_t bx = TRUNCATE_TILE(x.getInt()); | |
| 21873 | 13704001 | int32_t bx2 = TRUNCATE_TILE(x.getInt() + 8); | |
| 21874 | 13704001 | int32_t by = TRUNCATE_TILE(y.getInt()); | |
| 21875 | |||
| 21876 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 3383350 times.
✓ Branch 2 taken 2711494 times.
✓ Branch 3 taken 3671104 times.
✓ Branch 4 taken 3938053 times.
|
13704001 | switch(dir) |
| 21877 | { | ||
| 21878 | case up: | ||
| 21879 |
4/4✓ Branch 0 taken 590750 times.
✓ Branch 1 taken 2792600 times.
✓ Branch 2 taken 11867 times.
✓ Branch 3 taken 578883 times.
|
3383350 | if(!((int32_t)y&15)&&y!=0) by-=bigHitbox ? 16 : 0; |
| 21880 | |||
| 21881 | 3383350 | break; | |
| 21882 | |||
| 21883 | case down: | ||
| 21884 | 2711494 | by+=16; | |
| 21885 | 2711494 | break; | |
| 21886 | |||
| 21887 | case left: | ||
| 21888 |
2/2✓ Branch 0 taken 1622499 times.
✓ Branch 1 taken 2048605 times.
|
3671104 | if((((int32_t)x)&0x0F)<8) |
| 21889 | 2048605 | bx-=16; | |
| 21890 | |||
| 21891 |
2/2✓ Branch 0 taken 2252988 times.
✓ Branch 1 taken 1418116 times.
|
3671104 | if(y.getInt()&8) |
| 21892 | { | ||
| 21893 | 1418116 | by+=16; | |
| 21894 | 1418116 | } | |
| 21895 | |||
| 21896 | 3671104 | bx2=bx; | |
| 21897 | 3671104 | break; | |
| 21898 | |||
| 21899 | case right: | ||
| 21900 | 3938053 | bx+=16; | |
| 21901 | |||
| 21902 |
2/2✓ Branch 0 taken 2426950 times.
✓ Branch 1 taken 1511103 times.
|
3938053 | if(y.getInt()&8) |
| 21903 | { | ||
| 21904 | 1511103 | by+=16; | |
| 21905 | 1511103 | } | |
| 21906 | |||
| 21907 | 3938053 | bx2=bx; | |
| 21908 | 3938053 | break; | |
| 21909 | } | ||
| 21910 | |||
| 21911 | 13704001 | bool found1=false; | |
| 21912 | 13704001 | bool found2=false; | |
| 21913 | 13704001 | int32_t foundlayer = -1; | |
| 21914 | 13704001 | int32_t cid1 = MAPCOMBO(bx, by), cid2 = MAPCOMBO(bx2, by); | |
| 21915 | 13704001 | newcombo const& cmb = combobuf[cid1]; | |
| 21916 | 13704001 | newcombo const& cmb2 = combobuf[cid2]; | |
| 21917 |
4/6✓ Branch 0 taken 2512 times.
✓ Branch 1 taken 13701489 times.
✓ Branch 2 taken 2512 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2512 times.
|
13704001 | if((cmb.type==cLOCKBLOCK && !(cmb.only_gentrig) && _effectflag(bx,by,1, -1))) |
| 21918 | { | ||
| 21919 | // Context: https://discord.com/channels/876899628556091432/1278165595321405554 | ||
| 21920 | // Layer 0 is overridden by Locked Doors (but only for dungeons) - in that case, checklocked will clear these combos | ||
| 21921 |
2/2✓ Branch 0 taken 919 times.
✓ Branch 1 taken 1593 times.
|
2512 | bool ignore_layer_0 = isdungeon() && islockeddoor(bx,by,dLOCKED); |
| 21922 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2512 times.
|
2512 | if (!ignore_layer_0) |
| 21923 | { | ||
| 21924 | 2512 | found1=true; | |
| 21925 | 2512 | foundlayer = 0; | |
| 21926 | 2512 | } | |
| 21927 | 2512 | } | |
| 21928 |
4/6✓ Branch 0 taken 205 times.
✓ Branch 1 taken 13701284 times.
✓ Branch 2 taken 205 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 205 times.
|
13701489 | else if (cmb2.type==cLOCKBLOCK && !(cmb2.only_gentrig) && _effectflag(bx2,by,1, -1)) |
| 21929 | { | ||
| 21930 |
1/2✓ Branch 0 taken 205 times.
✗ Branch 1 not taken.
|
205 | bool ignore_layer_0 = isdungeon() && islockeddoor(bx2,by,dLOCKED); |
| 21931 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 205 times.
|
205 | if (!ignore_layer_0) |
| 21932 | { | ||
| 21933 | 205 | found2=true; | |
| 21934 | 205 | foundlayer = 0; | |
| 21935 | 205 | } | |
| 21936 | 205 | } | |
| 21937 | |||
| 21938 |
2/2✓ Branch 0 taken 27408002 times.
✓ Branch 1 taken 13704001 times.
|
41112003 | for (int32_t i = 0; i <= 1; ++i) |
| 21939 | { | ||
| 21940 |
2/2✓ Branch 0 taken 26781664 times.
✓ Branch 1 taken 626338 times.
|
27408002 | if (get_qr(qr_OLD_BRIDGE_COMBOS)) |
| 21941 | { | ||
| 21942 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 26781664 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
26781664 | if (combobuf[MAPCOMBO2(i,bx,by)].type == cBRIDGE && !_walkflag_layer(bx,by,i)) found1 = false; |
| 21943 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 26781664 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
26781664 | if (combobuf[MAPCOMBO2(i,bx2,by)].type == cBRIDGE && !_walkflag_layer(bx2,by,i)) found2 = false; |
| 21944 | 26781664 | } | |
| 21945 | else | ||
| 21946 | { | ||
| 21947 |
3/4✓ Branch 0 taken 1365 times.
✓ Branch 1 taken 624973 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1365 times.
|
626338 | if (combobuf[MAPCOMBO2(i,bx,by)].type == cBRIDGE && _effectflag_layer(bx,by,i)) found1 = false; |
| 21948 |
3/4✓ Branch 0 taken 1365 times.
✓ Branch 1 taken 624973 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1365 times.
|
626338 | if (combobuf[MAPCOMBO2(i,bx2,by)].type == cBRIDGE && _effectflag_layer(bx2,by,i)) found2 = false; |
| 21949 | } | ||
| 21950 | 27408002 | } | |
| 21951 | |||
| 21952 | |||
| 21953 | // Layers | ||
| 21954 |
4/4✓ Branch 0 taken 13701489 times.
✓ Branch 1 taken 2512 times.
✓ Branch 2 taken 205 times.
✓ Branch 3 taken 13701284 times.
|
13704001 | if(!(found1 || found2)) |
| 21955 | { | ||
| 21956 | 13701284 | foundlayer = -1; | |
| 21957 |
2/2✓ Branch 0 taken 13701198 times.
✓ Branch 1 taken 27402533 times.
|
41103731 | for(int32_t i=0; i<2; i++) |
| 21958 | { | ||
| 21959 | 27402533 | cid1 = MAPCOMBO2(i, bx, by); | |
| 21960 | 27402533 | cid2 = MAPCOMBO2(i, bx2, by); | |
| 21961 | 27402533 | newcombo const& cmb = combobuf[cid1]; | |
| 21962 | 27402533 | newcombo const& cmb2 = combobuf[cid2]; | |
| 21963 |
2/2✓ Branch 0 taken 13701249 times.
✓ Branch 1 taken 13701284 times.
|
27402533 | if (i == 0) |
| 21964 | { | ||
| 21965 |
2/2✓ Branch 0 taken 13388194 times.
✓ Branch 1 taken 313090 times.
|
13701284 | if (get_qr(qr_OLD_BRIDGE_COMBOS)) |
| 21966 | { | ||
| 21967 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 13388194 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
13388194 | if (combobuf[cid1].type == cBRIDGE && !_walkflag_layer(bx,by,1)) continue; //Continue, because It didn't find any on layer 0, and if you're checking |
| 21968 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 13388194 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
13388194 | if (combobuf[cid2].type == cBRIDGE && !_walkflag_layer(bx2,by,1)) continue; //layer 1 and there's a bridge on layer 2, stop checking layer 1. |
| 21969 | 13388194 | } | |
| 21970 | else | ||
| 21971 | { | ||
| 21972 |
4/4✓ Branch 0 taken 1333 times.
✓ Branch 1 taken 311757 times.
✓ Branch 2 taken 881 times.
✓ Branch 3 taken 452 times.
|
313090 | if (combobuf[cid1].type == cBRIDGE && _effectflag_layer(bx,by,1)) continue; |
| 21973 |
3/4✓ Branch 0 taken 881 times.
✓ Branch 1 taken 311757 times.
✓ Branch 2 taken 881 times.
✗ Branch 3 not taken.
|
312638 | if (combobuf[cid2].type == cBRIDGE && _effectflag_layer(bx2,by,1)) continue; |
| 21974 | } | ||
| 21975 | 13700832 | } | |
| 21976 |
4/6✓ Branch 0 taken 83 times.
✓ Branch 1 taken 27401998 times.
✓ Branch 2 taken 83 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 83 times.
|
27402081 | if(cmb.type==cLOCKBLOCK && !(cmb.only_gentrig) && _effectflag(bx,by,1, i)) |
| 21977 | { | ||
| 21978 | 83 | found1=true; | |
| 21979 | 83 | foundlayer = i+1; | |
| 21980 | 83 | break; | |
| 21981 | } | ||
| 21982 |
4/6✓ Branch 0 taken 3 times.
✓ Branch 1 taken 27401995 times.
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 3 times.
|
27401998 | else if(cmb2.type==cLOCKBLOCK && !(cmb2.only_gentrig) && _effectflag(bx2,by,1, i)) |
| 21983 | { | ||
| 21984 | 3 | found2=true; | |
| 21985 | 3 | foundlayer = i+1; | |
| 21986 | 3 | break; | |
| 21987 | } | ||
| 21988 | 27401995 | } | |
| 21989 | 13701284 | } | |
| 21990 | |||
| 21991 |
4/4✓ Branch 0 taken 13701406 times.
✓ Branch 1 taken 2595 times.
✓ Branch 2 taken 13703600 times.
✓ Branch 3 taken 401 times.
|
13704001 | if(!(found1 || found2) || pushing<8) |
| 21992 | { | ||
| 21993 | 13703600 | return; | |
| 21994 | } | ||
| 21995 |
2/2✓ Branch 0 taken 350 times.
✓ Branch 1 taken 51 times.
|
401 | newcombo const& cmb3 = combobuf[found1 ? cid1 : cid2]; |
| 21996 |
2/2✓ Branch 0 taken 139 times.
✓ Branch 1 taken 262 times.
|
401 | if(!try_locked_combo(cmb3)) |
| 21997 | 262 | return; | |
| 21998 | |||
| 21999 |
2/2✓ Branch 0 taken 127 times.
✓ Branch 1 taken 12 times.
|
139 | auto rpos_handle = found1 ? get_rpos_handle_for_world_xy(bx, by, 0) : get_rpos_handle_for_world_xy(bx2, by, 0); |
| 22000 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 139 times.
|
139 | if(cmb.usrflags&cflag16) |
| 22001 | { | ||
| 22002 | ✗ | setxmapflag(rpos_handle.screen, 1<<cmb.attribytes[5]); | |
| 22003 | ✗ | remove_xstatecombos(create_screen_handles(rpos_handle.base_scr()), 1<<cmb.attribytes[5], false); | |
| 22004 | ✗ | } | |
| 22005 | else | ||
| 22006 | { | ||
| 22007 | 139 | setmapflag(rpos_handle.scr, mLOCKBLOCK); | |
| 22008 | 139 | remove_lockblocks(create_screen_handles(rpos_handle.base_scr())); | |
| 22009 | } | ||
| 22010 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 139 times.
|
139 | if ( cmb3.usrflags&cflag3 ) |
| 22011 | { | ||
| 22012 | ✗ | if ( (cmb3.attribytes[3]) ) | |
| 22013 | ✗ | sfx(cmb3.attribytes[3]); | |
| 22014 | ✗ | } | |
| 22015 | 139 | else sfx(WAV_DOOR); | |
| 22016 | 13718356 | } | |
| 22017 | |||
| 22018 | 13718356 | void HeroClass::oldcheckbosslockblock() | |
| 22019 | { | ||
| 22020 |
2/2✓ Branch 0 taken 14355 times.
✓ Branch 1 taken 13704001 times.
|
13718356 | if(walk_through_walls) return; |
| 22021 | |||
| 22022 | 13704001 | int32_t bx = TRUNCATE_TILE(x.getInt()); | |
| 22023 | 13704001 | int32_t bx2 = TRUNCATE_TILE(x.getInt()+8); | |
| 22024 | 13704001 | int32_t by = TRUNCATE_TILE(y.getInt()); | |
| 22025 | |||
| 22026 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 3383350 times.
✓ Branch 2 taken 2711494 times.
✓ Branch 3 taken 3671104 times.
✓ Branch 4 taken 3938053 times.
|
13704001 | switch(dir) |
| 22027 | { | ||
| 22028 | case up: | ||
| 22029 |
4/4✓ Branch 0 taken 590750 times.
✓ Branch 1 taken 2792600 times.
✓ Branch 2 taken 578883 times.
✓ Branch 3 taken 11867 times.
|
3383350 | if(!((int32_t)y&15)&&y!=0) by-=bigHitbox ? 16 : 0; |
| 22030 | |||
| 22031 | 3383350 | break; | |
| 22032 | |||
| 22033 | case down: | ||
| 22034 | 2711494 | by+=16; | |
| 22035 | 2711494 | break; | |
| 22036 | |||
| 22037 | case left: | ||
| 22038 |
2/2✓ Branch 0 taken 1622499 times.
✓ Branch 1 taken 2048605 times.
|
3671104 | if((((int32_t)x)&0x0F)<8) |
| 22039 | 2048605 | bx-=16; | |
| 22040 | |||
| 22041 |
2/2✓ Branch 0 taken 2252988 times.
✓ Branch 1 taken 1418116 times.
|
3671104 | if(y.getInt()&8) |
| 22042 | { | ||
| 22043 | 1418116 | by+=16; | |
| 22044 | 1418116 | } | |
| 22045 | |||
| 22046 | 3671104 | bx2=bx; | |
| 22047 | 3671104 | break; | |
| 22048 | |||
| 22049 | case right: | ||
| 22050 | 3938053 | bx+=16; | |
| 22051 | |||
| 22052 |
2/2✓ Branch 0 taken 2426950 times.
✓ Branch 1 taken 1511103 times.
|
3938053 | if(y.getInt()&8) |
| 22053 | { | ||
| 22054 | 1511103 | by+=16; | |
| 22055 | 1511103 | } | |
| 22056 | |||
| 22057 | 3938053 | bx2=bx; | |
| 22058 | 3938053 | break; | |
| 22059 | } | ||
| 22060 | |||
| 22061 | |||
| 22062 | 13704001 | bool found1 = false; | |
| 22063 | 13704001 | bool found2 = false; | |
| 22064 | 13704001 | int32_t foundlayer = -1; | |
| 22065 | 13704001 | int32_t cid1 = MAPCOMBO(bx, by), cid2 = MAPCOMBO(bx2, by); | |
| 22066 | 13704001 | newcombo const& cmb = combobuf[cid1]; | |
| 22067 | 13704001 | newcombo const& cmb2 = combobuf[cid2]; | |
| 22068 | 13704001 | int cmb_screen_index = 0; | |
| 22069 | |||
| 22070 |
4/6✓ Branch 0 taken 1327 times.
✓ Branch 1 taken 13702674 times.
✓ Branch 2 taken 1327 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1327 times.
|
13704001 | if((cmb.type==cBOSSLOCKBLOCK && !(cmb.only_gentrig) && _effectflag(bx,by,1, -1))) |
| 22071 | { | ||
| 22072 | // Context: https://discord.com/channels/876899628556091432/1278165595321405554 | ||
| 22073 | // Layer 0 is overridden by Locked Doors (but only for dungeons) - in that case, checklocked will clear these combos | ||
| 22074 |
2/2✓ Branch 0 taken 1006 times.
✓ Branch 1 taken 321 times.
|
1327 | bool ignore_layer_0 = isdungeon() && islockeddoor(bx,by,dBOSS); |
| 22075 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1327 times.
|
1327 | if (!ignore_layer_0) |
| 22076 | { | ||
| 22077 | 1327 | found1=true; | |
| 22078 | 1327 | foundlayer = 0; | |
| 22079 | 1327 | cmb_screen_index = get_screen_for_world_xy(bx, by); | |
| 22080 | 1327 | } | |
| 22081 | 1327 | } | |
| 22082 |
4/6✓ Branch 0 taken 31 times.
✓ Branch 1 taken 13702643 times.
✓ Branch 2 taken 31 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 31 times.
|
13702674 | else if (cmb2.type==cBOSSLOCKBLOCK && !(cmb2.only_gentrig) && _effectflag(bx2,by,1, -1)) |
| 22083 | { | ||
| 22084 |
2/2✓ Branch 0 taken 9 times.
✓ Branch 1 taken 22 times.
|
31 | bool ignore_layer_0 = isdungeon() && islockeddoor(bx2,by,dBOSS); |
| 22085 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 31 times.
|
31 | if (!ignore_layer_0) |
| 22086 | { | ||
| 22087 | 31 | found2=true; | |
| 22088 | 31 | foundlayer = 0; | |
| 22089 | 31 | cmb_screen_index = get_screen_for_world_xy(bx2, by); | |
| 22090 | 31 | } | |
| 22091 | 31 | } | |
| 22092 | |||
| 22093 |
2/2✓ Branch 0 taken 27408002 times.
✓ Branch 1 taken 13704001 times.
|
41112003 | for (int32_t i = 0; i <= 1; ++i) |
| 22094 | { | ||
| 22095 |
2/2✓ Branch 0 taken 26781664 times.
✓ Branch 1 taken 626338 times.
|
27408002 | if (get_qr(qr_OLD_BRIDGE_COMBOS)) |
| 22096 | { | ||
| 22097 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 26781664 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
26781664 | if (combobuf[MAPCOMBO2(i, bx, by)].type == cBRIDGE && !_walkflag_layer(bx, by, i)) found1 = false; |
| 22098 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 26781664 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
26781664 | if (combobuf[MAPCOMBO2(i, bx2, by)].type == cBRIDGE && !_walkflag_layer(bx2, by, i)) found2 = false; |
| 22099 | 26781664 | } | |
| 22100 | else | ||
| 22101 | { | ||
| 22102 |
3/4✓ Branch 0 taken 1365 times.
✓ Branch 1 taken 624973 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1365 times.
|
626338 | if (combobuf[MAPCOMBO2(i, bx, by)].type == cBRIDGE && _effectflag_layer(bx, by, i)) found1 = false; |
| 22103 |
3/4✓ Branch 0 taken 1365 times.
✓ Branch 1 taken 624973 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1365 times.
|
626338 | if (combobuf[MAPCOMBO2(i, bx2, by)].type == cBRIDGE && _effectflag_layer(bx2, by, i)) found2 = false; |
| 22104 | } | ||
| 22105 | 27408002 | } | |
| 22106 | |||
| 22107 | |||
| 22108 | // Layers | ||
| 22109 |
4/4✓ Branch 0 taken 13702674 times.
✓ Branch 1 taken 1327 times.
✓ Branch 2 taken 31 times.
✓ Branch 3 taken 13702643 times.
|
13704001 | if (!(found1 || found2)) |
| 22110 | { | ||
| 22111 | 13702643 | foundlayer = -1; | |
| 22112 |
2/2✓ Branch 0 taken 13702643 times.
✓ Branch 1 taken 27405286 times.
|
41107929 | for (int32_t i = 0; i < 2; i++) |
| 22113 | { | ||
| 22114 | 27405286 | cid1 = MAPCOMBO2(i, bx, by); | |
| 22115 | 27405286 | cid2 = MAPCOMBO2(i, bx2, by); | |
| 22116 | 27405286 | newcombo const& cmb = combobuf[cid1]; | |
| 22117 | 27405286 | newcombo const& cmb2 = combobuf[cid2]; | |
| 22118 |
2/2✓ Branch 0 taken 13702643 times.
✓ Branch 1 taken 13702643 times.
|
27405286 | if (i == 0) |
| 22119 | { | ||
| 22120 |
2/2✓ Branch 0 taken 11800835 times.
✓ Branch 1 taken 1901808 times.
|
13702643 | if (get_scr_layer_valid(current_screen, 2)) |
| 22121 | { | ||
| 22122 |
2/2✓ Branch 0 taken 1767354 times.
✓ Branch 1 taken 134454 times.
|
1901808 | if (get_qr(qr_OLD_BRIDGE_COMBOS)) |
| 22123 | { | ||
| 22124 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1767354 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1767354 | if (combobuf[cid1].type == cBRIDGE && !_walkflag_layer(bx, by)) continue; |
| 22125 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1767354 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1767354 | if (combobuf[cid2].type == cBRIDGE && !_walkflag_layer(bx2, by)) continue; |
| 22126 | 1767354 | } | |
| 22127 | else | ||
| 22128 | { | ||
| 22129 |
3/4✓ Branch 0 taken 452 times.
✓ Branch 1 taken 134002 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 452 times.
|
134454 | if (combobuf[cid1].type == cBRIDGE && _effectflag_layer(bx, by)) continue; |
| 22130 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 134002 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
134002 | if (combobuf[cid2].type == cBRIDGE && _effectflag_layer(bx2, by)) continue; |
| 22131 | } | ||
| 22132 | 1901356 | } | |
| 22133 | 13702191 | } | |
| 22134 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 27404834 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
27404834 | if (cmb.type == cBOSSLOCKBLOCK && !(cmb.only_gentrig) && _effectflag(bx, by, 1, i)) |
| 22135 | { | ||
| 22136 | ✗ | found1 = true; | |
| 22137 | ✗ | foundlayer = i; | |
| 22138 | ✗ | cmb_screen_index = get_screen_for_world_xy(bx, by); | |
| 22139 | ✗ | break; | |
| 22140 | } | ||
| 22141 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 27404834 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
27404834 | else if (cmb2.type == cBOSSLOCKBLOCK && !(cmb2.only_gentrig) && _effectflag(bx2, by, 1, i)) |
| 22142 | { | ||
| 22143 | ✗ | found2 = true; | |
| 22144 | ✗ | foundlayer = i; | |
| 22145 | ✗ | cmb_screen_index = get_screen_for_world_xy(bx2, by); | |
| 22146 | ✗ | break; | |
| 22147 | } | ||
| 22148 | 27404834 | } | |
| 22149 | 13702643 | } | |
| 22150 | |||
| 22151 |
4/4✓ Branch 0 taken 13702674 times.
✓ Branch 1 taken 1327 times.
✓ Branch 2 taken 13703530 times.
✓ Branch 3 taken 471 times.
|
13704001 | if (!(found1 || found2) || pushing < 8) |
| 22152 | { | ||
| 22153 | 13703530 | return; | |
| 22154 | } | ||
| 22155 |
2/2✓ Branch 0 taken 468 times.
✓ Branch 1 taken 3 times.
|
471 | int32_t cid = found1 ? cid1 : cid2; |
| 22156 | |||
| 22157 |
2/2✓ Branch 0 taken 35 times.
✓ Branch 1 taken 436 times.
|
471 | if(!(game->lvlitems[dlevel]&(1 << li_boss_key))) return; |
| 22158 | |||
| 22159 | |||
| 22160 | // Run Boss Key Script | ||
| 22161 | 35 | int32_t key_item = 0; //current_item_id(itype_bosskey); //not possible | |
| 22162 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2380 times.
|
2380 | for ( int32_t q = 0; q < MAXITEMS; ++q ) |
| 22163 | { | ||
| 22164 |
2/2✓ Branch 0 taken 2345 times.
✓ Branch 1 taken 35 times.
|
2380 | if ( itemsbuf[q].type == itype_bosskey ) |
| 22165 | { | ||
| 22166 | 35 | key_item = q; break; | |
| 22167 | } | ||
| 22168 | 2345 | } | |
| 22169 |
2/8✓ Branch 0 taken 35 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 35 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
35 | if ( key_item > 0 && itemsbuf[key_item].script && !(FFCore.doscript(ScriptType::Item, key_item) && get_qr(qr_ITEMSCRIPTSKEEPRUNNING)) ) |
| 22170 | { | ||
| 22171 | ✗ | int i = key_item; | |
| 22172 | ✗ | FFCore.reset_script_engine_data(ScriptType::Item, i); | |
| 22173 | ✗ | ZScriptVersion::RunScript(ScriptType::Item, itemsbuf[i].script, i); | |
| 22174 | ✗ | FFCore.deallocateAllScriptOwned(ScriptType::Item,(key_item)); | |
| 22175 | ✗ | } | |
| 22176 | |||
| 22177 | 35 | mapscr* scr = get_scr(cmb_screen_index); | |
| 22178 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 35 times.
|
35 | if(cmb.usrflags&cflag16) |
| 22179 | { | ||
| 22180 | ✗ | setxmapflag(cmb_screen_index, 1<<cmb.attribytes[5]); | |
| 22181 | ✗ | remove_xstatecombos(create_screen_handles(scr), 1<<cmb.attribytes[5]); | |
| 22182 | ✗ | } | |
| 22183 | else | ||
| 22184 | { | ||
| 22185 | 35 | setmapflag(scr, mBOSSLOCKBLOCK); | |
| 22186 | 35 | remove_bosslockblocks(create_screen_handles(scr)); | |
| 22187 | } | ||
| 22188 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 35 times.
|
35 | if ( (combobuf[cid].attribytes[3]) ) |
| 22189 | 35 | sfx(combobuf[cid].attribytes[3]); | |
| 22190 | 13718356 | } | |
| 22191 | |||
| 22192 | 39697275 | void HeroClass::oldcheckchest(int32_t type) | |
| 22193 | { | ||
| 22194 | // chests aren't affected by hero_scr->flags2&fAIRCOMBOS | ||
| 22195 |
5/6✓ Branch 0 taken 39657057 times.
✓ Branch 1 taken 40218 times.
✓ Branch 2 taken 39616308 times.
✓ Branch 3 taken 40749 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 39616308 times.
|
39697275 | if(walk_through_walls || z>0 || fakez > 0) return; |
| 22196 |
2/2✓ Branch 0 taken 37989222 times.
✓ Branch 1 taken 1627086 times.
|
39616308 | if(pushing<8) return; |
| 22197 | |||
| 22198 | 1627086 | int32_t bx = TRUNCATE_TILE(x.getInt()); | |
| 22199 | 1627086 | int32_t bx2 = TRUNCATE_TILE(x.getInt()+8); | |
| 22200 | 1627086 | int32_t by = TRUNCATE_TILE(y.getInt()); | |
| 22201 | |||
| 22202 |
3/4✓ Branch 0 taken 872424 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 347538 times.
✓ Branch 3 taken 407124 times.
|
1627086 | switch(dir) |
| 22203 | { | ||
| 22204 | case up: | ||
| 22205 |
2/2✓ Branch 0 taken 52566 times.
✓ Branch 1 taken 354558 times.
|
407124 | if(isSideViewHero()) return; |
| 22206 | |||
| 22207 |
4/4✓ Branch 0 taken 81006 times.
✓ Branch 1 taken 273552 times.
✓ Branch 2 taken 78609 times.
✓ Branch 3 taken 2397 times.
|
354558 | if(!((int32_t)y&15)&&y!=0) by-=bigHitbox ? 16 : 0; |
| 22208 | |||
| 22209 | 354558 | break; | |
| 22210 | |||
| 22211 | case left: | ||
| 22212 | case right: | ||
| 22213 |
2/2✓ Branch 0 taken 19974 times.
✓ Branch 1 taken 852450 times.
|
872424 | if(isSideViewHero()) break; |
| 22214 | [[fallthrough]]; | ||
| 22215 | case down: | ||
| 22216 | 1199988 | return; | |
| 22217 | } | ||
| 22218 | |||
| 22219 | 374532 | bool found=false; | |
| 22220 | 374532 | int found_screen_index=0; | |
| 22221 | 374532 | bool itemflag=false; | |
| 22222 | |||
| 22223 |
3/4✓ Branch 0 taken 137 times.
✓ Branch 1 taken 374395 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 137 times.
|
374532 | if (combobuf[MAPCOMBO(bx,by)].type==type && _effectflag(bx,by,1, -1)) |
| 22224 | { | ||
| 22225 | 137 | found=true; | |
| 22226 | 137 | found_screen_index=get_screen_for_world_xy(bx, by); | |
| 22227 | 137 | } | |
| 22228 |
3/4✓ Branch 0 taken 35 times.
✓ Branch 1 taken 374360 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 35 times.
|
374395 | else if (combobuf[MAPCOMBO(bx2,by)].type==type && _effectflag(bx2,by,1, -1)) |
| 22229 | { | ||
| 22230 | 35 | found=true; | |
| 22231 | 35 | found_screen_index=get_screen_for_world_xy(bx2, by); | |
| 22232 | 35 | } | |
| 22233 |
2/2✓ Branch 0 taken 749064 times.
✓ Branch 1 taken 374532 times.
|
1123596 | for (int32_t i = 0; i <= 1; ++i) |
| 22234 | { | ||
| 22235 |
2/2✓ Branch 0 taken 747864 times.
✓ Branch 1 taken 1200 times.
|
749064 | if (get_qr(qr_OLD_BRIDGE_COMBOS)) |
| 22236 | { | ||
| 22237 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 747864 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
747864 | if (combobuf[MAPCOMBO2(i,bx,by)].type == cBRIDGE && !_walkflag_layer(bx,by,i)) found = false; |
| 22238 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 747864 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
747864 | if (combobuf[MAPCOMBO2(i,bx2,by)].type == cBRIDGE && !_walkflag_layer(bx2,by,i)) found = false; |
| 22239 | 747864 | } | |
| 22240 | else | ||
| 22241 | { | ||
| 22242 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1200 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1200 | if (combobuf[MAPCOMBO2(i,bx,by)].type == cBRIDGE && _effectflag_layer(bx,by,i)) found = false; |
| 22243 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1200 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1200 | if (combobuf[MAPCOMBO2(i,bx2,by)].type == cBRIDGE && _effectflag_layer(bx2,by,i)) found = false; |
| 22244 | } | ||
| 22245 | 749064 | } | |
| 22246 | |||
| 22247 |
2/2✓ Branch 0 taken 172 times.
✓ Branch 1 taken 374360 times.
|
374532 | if(!found) |
| 22248 | { | ||
| 22249 |
2/2✓ Branch 0 taken 374360 times.
✓ Branch 1 taken 748720 times.
|
1123080 | for(int32_t i=0; i<2; i++) |
| 22250 | { | ||
| 22251 |
2/2✓ Branch 0 taken 374360 times.
✓ Branch 1 taken 374360 times.
|
748720 | if (i == 0) |
| 22252 | { | ||
| 22253 |
2/2✓ Branch 0 taken 373760 times.
✓ Branch 1 taken 600 times.
|
374360 | if (get_qr(qr_OLD_BRIDGE_COMBOS)) |
| 22254 | { | ||
| 22255 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 373760 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
373760 | if (combobuf[MAPCOMBO2(1,bx,by)].type == cBRIDGE && !_walkflag_layer(bx,by,1)) continue; |
| 22256 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 373760 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
373760 | if (combobuf[MAPCOMBO2(1,bx2,by)].type == cBRIDGE && !_walkflag_layer(bx2,by,1)) continue; |
| 22257 | 373760 | } | |
| 22258 | else | ||
| 22259 | { | ||
| 22260 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 600 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
600 | if (combobuf[MAPCOMBO2(1,bx,by)].type == cBRIDGE && _effectflag_layer(bx,by,1)) continue; |
| 22261 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 600 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
600 | if (combobuf[MAPCOMBO2(1,bx2,by)].type == cBRIDGE && _effectflag_layer(bx2,by,1)) continue; |
| 22262 | } | ||
| 22263 | 374360 | } | |
| 22264 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 748720 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
748720 | if (combobuf[MAPCOMBO2(i,bx,by)].type==type && _effectflag(bx,by,1, i)) |
| 22265 | { | ||
| 22266 | ✗ | found=true; | |
| 22267 | ✗ | found_screen_index=get_screen_for_world_xy(bx, by); | |
| 22268 | ✗ | break; | |
| 22269 | } | ||
| 22270 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 748720 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
748720 | else if (combobuf[MAPCOMBO2(i,bx2,by)].type==type && _effectflag(bx2,by,1, i)) |
| 22271 | { | ||
| 22272 | ✗ | found=true; | |
| 22273 | ✗ | found_screen_index=get_screen_for_world_xy(bx2, by); | |
| 22274 | ✗ | break; | |
| 22275 | } | ||
| 22276 | 748720 | } | |
| 22277 | 374360 | } | |
| 22278 | |||
| 22279 |
2/2✓ Branch 0 taken 172 times.
✓ Branch 1 taken 374360 times.
|
374532 | if(!found) |
| 22280 | { | ||
| 22281 | 374360 | return; | |
| 22282 | } | ||
| 22283 | |||
| 22284 | 172 | mapscr* scr = get_scr(found_screen_index); | |
| 22285 | |||
| 22286 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 69 times.
✓ Branch 2 taken 101 times.
✓ Branch 3 taken 2 times.
|
172 | switch(type) |
| 22287 | { | ||
| 22288 | case cLOCKEDCHEST: | ||
| 22289 |
2/2✓ Branch 0 taken 13 times.
✓ Branch 1 taken 56 times.
|
69 | if(!usekey()) return; |
| 22290 | |||
| 22291 | 13 | setmapflag(scr, mLOCKEDCHEST); | |
| 22292 | 13 | break; | |
| 22293 | |||
| 22294 | case cCHEST: | ||
| 22295 | 101 | setmapflag(scr, mCHEST); | |
| 22296 | 101 | break; | |
| 22297 | |||
| 22298 | case cBOSSCHEST: | ||
| 22299 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if(!(game->lvlitems[dlevel]&(1 << li_boss_key))) return; |
| 22300 | // Run Boss Key Script | ||
| 22301 | 2 | int32_t key_item = 0; //current_item_id(itype_bosskey); //not possible | |
| 22302 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 136 times.
|
136 | for ( int32_t q = 0; q < MAXITEMS; ++q ) |
| 22303 | { | ||
| 22304 |
2/2✓ Branch 0 taken 134 times.
✓ Branch 1 taken 2 times.
|
136 | if ( itemsbuf[q].type == itype_bosskey ) |
| 22305 | { | ||
| 22306 | 2 | key_item = q; break; | |
| 22307 | } | ||
| 22308 | 134 | } | |
| 22309 |
2/8✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
2 | if ( key_item > 0 && itemsbuf[key_item].script && !(FFCore.doscript(ScriptType::Item, key_item) && get_qr(qr_ITEMSCRIPTSKEEPRUNNING)) ) |
| 22310 | { | ||
| 22311 | ✗ | int i = key_item; | |
| 22312 | ✗ | FFCore.reset_script_engine_data(ScriptType::Item, i); | |
| 22313 | ✗ | ZScriptVersion::RunScript(ScriptType::Item, itemsbuf[i].script, i); | |
| 22314 | ✗ | FFCore.deallocateAllScriptOwned(ScriptType::Item,(key_item)); | |
| 22315 | ✗ | } | |
| 22316 | 2 | setmapflag(scr, mBOSSCHEST); | |
| 22317 | 2 | break; | |
| 22318 | } | ||
| 22319 | |||
| 22320 | 116 | itemflag |= MAPCOMBOFLAG(bx,by)==mfARMOS_ITEM; | |
| 22321 | 116 | itemflag |= MAPCOMBOFLAG(bx2,by)==mfARMOS_ITEM; | |
| 22322 | 116 | itemflag |= MAPFLAG(bx,by)==mfARMOS_ITEM; | |
| 22323 | 116 | itemflag |= MAPFLAG(bx2,by)==mfARMOS_ITEM; | |
| 22324 | 116 | itemflag |= MAPCOMBOFLAG(bx,by)==mfARMOS_ITEM; | |
| 22325 | 116 | itemflag |= MAPCOMBOFLAG(bx2,by)==mfARMOS_ITEM; | |
| 22326 | |||
| 22327 |
1/2✓ Branch 0 taken 116 times.
✗ Branch 1 not taken.
|
116 | if(!itemflag) |
| 22328 | { | ||
| 22329 | ✗ | for(int32_t i=0; i<2; i++) | |
| 22330 | { | ||
| 22331 | ✗ | itemflag |= MAPFLAG2(i,bx,by)==mfARMOS_ITEM; | |
| 22332 | ✗ | itemflag |= MAPFLAG2(i,bx2,by)==mfARMOS_ITEM; | |
| 22333 | ✗ | itemflag |= MAPCOMBOFLAG2(i,bx,by)==mfARMOS_ITEM; | |
| 22334 | ✗ | itemflag |= MAPCOMBOFLAG2(i,bx2,by)==mfARMOS_ITEM; | |
| 22335 | ✗ | } | |
| 22336 | ✗ | } | |
| 22337 | |||
| 22338 |
3/6✓ Branch 0 taken 116 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 116 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 116 times.
|
116 | if(itemflag && !getmapflag(found_screen_index, (found_screen_index < 128 && get_qr(qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM)) |
| 22339 | { | ||
| 22340 |
4/8✓ Branch 0 taken 116 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 116 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 116 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 116 times.
✗ Branch 7 not taken.
|
116 | add_item_for_screen(found_screen_index, new item(x, y,(zfix)0, scr->catchall, ipONETIME2 + ipBIGRANGE + ipHOLDUP | ((scr->flags8&fITEMSECRET) ? ipSECRETS : 0), 0)); |
| 22341 | 116 | } | |
| 22342 | 39697275 | } | |
| 22343 | |||
| 22344 | 6912069 | void HeroClass::checkchest(int32_t type) | |
| 22345 | { | ||
| 22346 |
4/4✓ Branch 0 taken 5335290 times.
✓ Branch 1 taken 1576779 times.
✓ Branch 2 taken 1576779 times.
✓ Branch 3 taken 3758511 times.
|
6912069 | bool ischest = type == cCHEST || type == cLOCKEDCHEST || type == cBOSSCHEST; |
| 22347 |
2/2✓ Branch 0 taken 1090866 times.
✓ Branch 1 taken 5821203 times.
|
6912069 | bool islockblock = type == cLOCKBLOCK || type == cBOSSLOCKBLOCK; |
| 22348 |
2/2✓ Branch 0 taken 1090866 times.
✓ Branch 1 taken 5821203 times.
|
6912069 | bool islocked = type == cLOCKBLOCK || type == cLOCKEDCHEST; |
| 22349 |
2/2✓ Branch 0 taken 1090866 times.
✓ Branch 1 taken 5821203 times.
|
6912069 | bool isbosslocked = type == cBOSSLOCKBLOCK || type == cBOSSCHEST; |
| 22350 |
2/2✓ Branch 0 taken 2181732 times.
✓ Branch 1 taken 4730337 times.
|
6912069 | if(ischest) |
| 22351 | { | ||
| 22352 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4730337 times.
|
4730337 | if(get_qr(qr_OLD_CHEST_COLLISION)) |
| 22353 | { | ||
| 22354 | ✗ | oldcheckchest(type); | |
| 22355 | ✗ | return; | |
| 22356 | } | ||
| 22357 | 4730337 | } | |
| 22358 |
3/4✓ Branch 0 taken 2181732 times.
✓ Branch 1 taken 4730337 times.
✓ Branch 2 taken 2181732 times.
✗ Branch 3 not taken.
|
6912069 | if(islockblock && get_qr(qr_OLD_LOCKBLOCK_COLLISION)) |
| 22359 | { | ||
| 22360 | ✗ | if(type == cLOCKBLOCK) | |
| 22361 | ✗ | oldchecklockblock(); | |
| 22362 | ✗ | else if(type == cBOSSLOCKBLOCK) | |
| 22363 | ✗ | oldcheckbosslockblock(); | |
| 22364 | ✗ | return; | |
| 22365 | } | ||
| 22366 |
5/6✓ Branch 0 taken 6906032 times.
✓ Branch 1 taken 6037 times.
✓ Branch 2 taken 6878916 times.
✓ Branch 3 taken 27116 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 6878916 times.
|
6912069 | if(walk_through_walls || z>0 || fakez > 0) return; |
| 22367 | 6878916 | zfix bx, by; | |
| 22368 | 6878916 | zfix bx2, by2; | |
| 22369 | 6878916 | zfix fx(-1), fy(-1); | |
| 22370 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 1533619 times.
✓ Branch 2 taken 1508990 times.
✓ Branch 3 taken 1924051 times.
✓ Branch 4 taken 1912256 times.
|
6878916 | switch(dir) |
| 22371 | { | ||
| 22372 | case up: | ||
| 22373 | 1533619 | by = y + (bigHitbox ? -2 : 6); | |
| 22374 | 1533619 | by2 = by; | |
| 22375 | 1533619 | bx = x + 4; | |
| 22376 | 1533619 | bx2 = bx + 8; | |
| 22377 | 1533619 | break; | |
| 22378 | case down: | ||
| 22379 | 1508990 | by = y + 17; | |
| 22380 | 1508990 | by2 = by; | |
| 22381 | 1508990 | bx = x + 4; | |
| 22382 | 1508990 | bx2 = bx + 8; | |
| 22383 | 1508990 | break; | |
| 22384 | case left: | ||
| 22385 | 1924051 | by = y + (bigHitbox ? 0 : 8); | |
| 22386 | 1924051 | by2 = y + 8; | |
| 22387 | 1924051 | bx = x - 2; | |
| 22388 | 1924051 | bx2 = x - 2; | |
| 22389 | 1924051 | break; | |
| 22390 | case right: | ||
| 22391 | 1912256 | by = y + (bigHitbox ? 0 : 8); | |
| 22392 | 1912256 | by2 = y + 8; | |
| 22393 | 1912256 | bx = x + 17; | |
| 22394 | 1912256 | bx2 = x + 17; | |
| 22395 | 1912256 | break; | |
| 22396 | } | ||
| 22397 | |||
| 22398 | 6878916 | int32_t found = -1; | |
| 22399 | 6878916 | int32_t foundlayer = 0; | |
| 22400 | |||
| 22401 | 6878916 | newcombo const* cmb = &combobuf[MAPCOMBO(bx,by)]; | |
| 22402 | |||
| 22403 |
4/6✓ Branch 0 taken 2987 times.
✓ Branch 1 taken 6875929 times.
✓ Branch 2 taken 2987 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2987 times.
|
6878916 | if(cmb->type==type && !(cmb->only_gentrig) && _effectflag(bx,by,1, -1)) |
| 22404 | { | ||
| 22405 | 2987 | found = MAPCOMBO(bx,by); | |
| 22406 | 2987 | fx = bx; fy = by; | |
| 22407 |
2/2✓ Branch 0 taken 5974 times.
✓ Branch 1 taken 2987 times.
|
8961 | for (int32_t i = 0; i <= 1; ++i) |
| 22408 | { | ||
| 22409 |
2/2✓ Branch 0 taken 3484 times.
✓ Branch 1 taken 2490 times.
|
5974 | if (get_qr(qr_OLD_BRIDGE_COMBOS)) |
| 22410 | { | ||
| 22411 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 3484 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
3484 | if (combobuf[MAPCOMBO2(i,bx,by)].type == cBRIDGE && !_walkflag_layer(bx,by,1)) found = -1; |
| 22412 | 3484 | } | |
| 22413 | else | ||
| 22414 | { | ||
| 22415 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 2490 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
2490 | if (combobuf[MAPCOMBO2(i,bx,by)].type == cBRIDGE && _effectflag_layer(bx,by,1)) found = -1; |
| 22416 | } | ||
| 22417 | 5974 | } | |
| 22418 | 2987 | } | |
| 22419 |
2/2✓ Branch 0 taken 6875929 times.
✓ Branch 1 taken 2987 times.
|
6878916 | if(found<0) |
| 22420 | { | ||
| 22421 | 6875929 | cmb = &combobuf[MAPCOMBO(bx2,by2)]; | |
| 22422 |
4/6✓ Branch 0 taken 84 times.
✓ Branch 1 taken 6875845 times.
✓ Branch 2 taken 84 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 84 times.
|
6875929 | if(cmb->type==type && !(cmb->only_gentrig) && _effectflag(bx2,by2,1, -1)) |
| 22423 | { | ||
| 22424 | 84 | found = MAPCOMBO(bx2,by2); | |
| 22425 |
2/2✓ Branch 0 taken 84 times.
✓ Branch 1 taken 504 times.
|
588 | for (int32_t i = 0; i < 6; ++i) |
| 22426 | { | ||
| 22427 |
2/2✓ Branch 0 taken 276 times.
✓ Branch 1 taken 228 times.
|
504 | if (get_qr(qr_OLD_BRIDGE_COMBOS)) |
| 22428 | { | ||
| 22429 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 276 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
276 | if (combobuf[MAPCOMBO2(i,bx2,by2)].type == cBRIDGE && !_walkflag_layer(bx2,by2,i)) |
| 22430 | { | ||
| 22431 | ✗ | found = -1; | |
| 22432 | ✗ | break; | |
| 22433 | } | ||
| 22434 | 276 | } | |
| 22435 | else | ||
| 22436 | { | ||
| 22437 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 228 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
228 | if (combobuf[MAPCOMBO2(i,bx2,by2)].type == cBRIDGE && _effectflag_layer(bx2,by2,i)) |
| 22438 | { | ||
| 22439 | ✗ | found = -1; | |
| 22440 | ✗ | break; | |
| 22441 | } | ||
| 22442 | } | ||
| 22443 | 504 | } | |
| 22444 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 84 times.
|
84 | if(found != -1) |
| 22445 | { | ||
| 22446 | 84 | fx = bx2; fy = by2; | |
| 22447 | 84 | } | |
| 22448 | 84 | } | |
| 22449 | 6875929 | } | |
| 22450 | |||
| 22451 |
2/2✓ Branch 0 taken 6875845 times.
✓ Branch 1 taken 3071 times.
|
6878916 | if(found<0) |
| 22452 | { | ||
| 22453 |
2/2✓ Branch 0 taken 6875212 times.
✓ Branch 1 taken 41252001 times.
|
48127213 | for(int32_t i=0; i<6; i++) |
| 22454 | { | ||
| 22455 | 41252001 | cmb = &combobuf[MAPCOMBO2(i,bx,by)]; | |
| 22456 |
4/6✓ Branch 0 taken 587 times.
✓ Branch 1 taken 41251414 times.
✓ Branch 2 taken 587 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 587 times.
|
41252001 | if(combobuf[MAPCOMBO2(i,bx,by)].type==type && !(cmb->only_gentrig) && _effectflag(bx,by,1, i)) |
| 22457 | { | ||
| 22458 | 587 | found = MAPCOMBO2(i,bx,by); | |
| 22459 |
2/2✓ Branch 0 taken 587 times.
✓ Branch 1 taken 2869 times.
|
3456 | for(int32_t j = i+1; j < 6; ++j) |
| 22460 | { | ||
| 22461 |
2/2✓ Branch 0 taken 530 times.
✓ Branch 1 taken 2339 times.
|
2869 | if (get_qr(qr_OLD_BRIDGE_COMBOS)) |
| 22462 | { | ||
| 22463 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 530 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
530 | if (combobuf[MAPCOMBO2(j,bx,by)].type == cBRIDGE && !_walkflag_layer(bx,by,j)) |
| 22464 | { | ||
| 22465 | ✗ | found = -1; | |
| 22466 | ✗ | break; | |
| 22467 | } | ||
| 22468 | 530 | } | |
| 22469 | else | ||
| 22470 | { | ||
| 22471 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 2339 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
2339 | if (combobuf[MAPCOMBO2(j,bx,by)].type == cBRIDGE && _effectflag_layer(bx,by,j)) |
| 22472 | { | ||
| 22473 | ✗ | found = -1; | |
| 22474 | ✗ | break; | |
| 22475 | } | ||
| 22476 | } | ||
| 22477 | 2869 | } | |
| 22478 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 587 times.
|
587 | if(found>-1) |
| 22479 | { | ||
| 22480 | 587 | foundlayer = i+1; | |
| 22481 | 587 | fx = bx; fy = by; | |
| 22482 | 587 | break; | |
| 22483 | } | ||
| 22484 | ✗ | } | |
| 22485 | 41251414 | cmb = &combobuf[MAPCOMBO2(i,bx2,by2)]; | |
| 22486 |
4/6✓ Branch 0 taken 46 times.
✓ Branch 1 taken 41251368 times.
✓ Branch 2 taken 46 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 46 times.
|
41251414 | if(combobuf[MAPCOMBO2(i,bx2,by2)].type==type && !(cmb->only_gentrig) && _effectflag(bx2,by2,1, i)) |
| 22487 | { | ||
| 22488 | 46 | found = MAPCOMBO2(i,bx2,by2); | |
| 22489 |
2/2✓ Branch 0 taken 46 times.
✓ Branch 1 taken 200 times.
|
246 | for(int32_t j = i+1; j < 6; ++j) |
| 22490 | { | ||
| 22491 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 200 times.
|
200 | if (get_qr(qr_OLD_BRIDGE_COMBOS)) |
| 22492 | { | ||
| 22493 | ✗ | if (combobuf[MAPCOMBO2(j,bx2,by2)].type == cBRIDGE && !_walkflag_layer(bx2,by2,j)) | |
| 22494 | { | ||
| 22495 | ✗ | found = -1; | |
| 22496 | ✗ | break; | |
| 22497 | } | ||
| 22498 | ✗ | } | |
| 22499 | else | ||
| 22500 | { | ||
| 22501 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 200 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
200 | if (combobuf[MAPCOMBO2(j,bx2,by2)].type == cBRIDGE && _effectflag_layer(bx2,by2,j)) |
| 22502 | { | ||
| 22503 | ✗ | found = -1; | |
| 22504 | ✗ | break; | |
| 22505 | } | ||
| 22506 | } | ||
| 22507 | 200 | } | |
| 22508 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 46 times.
|
46 | if(found>-1) |
| 22509 | { | ||
| 22510 | 46 | foundlayer = i+1; | |
| 22511 | 46 | fx = bx2; fy = by2; | |
| 22512 | 46 | break; | |
| 22513 | } | ||
| 22514 | ✗ | } | |
| 22515 | 41251368 | } | |
| 22516 | 6875845 | } | |
| 22517 | |||
| 22518 |
2/2✓ Branch 0 taken 6875212 times.
✓ Branch 1 taken 3704 times.
|
6878916 | if(found<0) return; |
| 22519 | 3704 | cmb = &combobuf[found]; | |
| 22520 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 3246 times.
✓ Branch 2 taken 176 times.
✓ Branch 3 taken 109 times.
✓ Branch 4 taken 173 times.
|
3704 | switch(dir) |
| 22521 | { | ||
| 22522 | case up: | ||
| 22523 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3246 times.
|
3246 | if(cmb->usrflags&cflag10) |
| 22524 | ✗ | return; | |
| 22525 | 3246 | break; | |
| 22526 | case down: | ||
| 22527 |
2/2✓ Branch 0 taken 69 times.
✓ Branch 1 taken 107 times.
|
176 | if(cmb->usrflags&cflag9) |
| 22528 | 69 | return; | |
| 22529 | 107 | break; | |
| 22530 | case left: | ||
| 22531 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 108 times.
|
109 | if(cmb->usrflags&cflag12) |
| 22532 | 1 | return; | |
| 22533 | 108 | break; | |
| 22534 | case right: | ||
| 22535 |
2/2✓ Branch 0 taken 61 times.
✓ Branch 1 taken 112 times.
|
173 | if(cmb->usrflags&cflag11) |
| 22536 | 61 | return; | |
| 22537 | 112 | break; | |
| 22538 | } | ||
| 22539 | 3573 | int32_t intbtn = cmb->attribytes[2]; | |
| 22540 | |||
| 22541 |
2/2✓ Branch 0 taken 2786 times.
✓ Branch 1 taken 787 times.
|
3573 | if(intbtn) // |
| 22542 | { | ||
| 22543 |
2/2✓ Branch 0 taken 86 times.
✓ Branch 1 taken 2700 times.
|
2786 | if(cmb->usrflags & cflag13) //display prompt |
| 22544 | { | ||
| 22545 | 2700 | int altcmb = cmb->attributes[2]/10000; | |
| 22546 | 2700 | prompt_combo = cmb->attributes[1]/10000; | |
| 22547 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 2700 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
2700 | if(altcmb && ((islocked && !can_locked_combo(*cmb)) |
| 22548 | ✗ | || (isbosslocked && !(game->lvlitems[dlevel]&(1 << li_boss_key))))) | |
| 22549 | ✗ | prompt_combo = altcmb; | |
| 22550 | 2700 | prompt_cset = cmb->attribytes[4]; | |
| 22551 | 2700 | prompt_x = cmb->attrishorts[0]; | |
| 22552 | 2700 | prompt_y = cmb->attrishorts[1]; | |
| 22553 | 2700 | } | |
| 22554 |
2/2✓ Branch 0 taken 66 times.
✓ Branch 1 taken 2720 times.
|
2786 | if(!getIntBtnInput(intbtn, INPUT_PRESS | INPUT_DRUNK)) |
| 22555 | { | ||
| 22556 | 2720 | return; //Button not pressed | |
| 22557 | } | ||
| 22558 | 66 | } | |
| 22559 |
4/4✓ Branch 0 taken 109 times.
✓ Branch 1 taken 678 times.
✓ Branch 2 taken 45 times.
✓ Branch 3 taken 64 times.
|
787 | else if(pushing < 8 || pushing % 8) return; //Not pushing against chest enough |
| 22560 | |||
| 22561 |
2/2✓ Branch 0 taken 76 times.
✓ Branch 1 taken 54 times.
|
130 | if(ischest) |
| 22562 | { | ||
| 22563 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 72 times.
|
76 | if (!trigger_chest(get_rpos_handle_for_world_xy(fx, fy, foundlayer))) return; |
| 22564 | 72 | } | |
| 22565 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 54 times.
|
54 | else if(islockblock) |
| 22566 | { | ||
| 22567 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 50 times.
|
54 | if (!trigger_lockblock(get_rpos_handle_for_world_xy(fx, fy, foundlayer))) return; |
| 22568 | 50 | } | |
| 22569 |
4/4✓ Branch 0 taken 63 times.
✓ Branch 1 taken 59 times.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 59 times.
|
122 | if(intbtn && (cmb->usrflags & cflag13)) |
| 22570 | 59 | prompt_combo = 0; | |
| 22571 | 6912069 | } | |
| 22572 | |||
| 22573 | 17433803 | void HeroClass::checkgenpush(rpos_t rpos) | |
| 22574 | { | ||
| 22575 |
2/2✓ Branch 0 taken 17396454 times.
✓ Branch 1 taken 37349 times.
|
17433803 | if (rpos == rpos_t::None) |
| 22576 | 37349 | return; | |
| 22577 | |||
| 22578 |
2/2✓ Branch 0 taken 17396454 times.
✓ Branch 1 taken 121775178 times.
|
139171632 | for (int layer = 0; layer < 7; ++layer) |
| 22579 | { | ||
| 22580 | 121775178 | auto rpos_handle = get_rpos_handle(rpos, layer); | |
| 22581 |
1/2✓ Branch 0 taken 121775178 times.
✗ Branch 1 not taken.
|
125069489 | trig_each_combo_trigger(rpos_handle, [&](combo_trigger const& trig){ |
| 22582 |
2/2✓ Branch 0 taken 3292701 times.
✓ Branch 1 taken 1610 times.
|
3294311 | if(!trig.trigger_flags.get(TRIGFLAG_PUSH)) return false; |
| 22583 |
3/4✓ Branch 0 taken 1463 times.
✓ Branch 1 taken 147 times.
✓ Branch 2 taken 147 times.
✗ Branch 3 not taken.
|
1610 | return pushing && !(pushing % zc_max(1,trig.trig_pushtime)); |
| 22584 | 3294311 | }); | |
| 22585 | 121775178 | } | |
| 22586 | 17433803 | } | |
| 22587 | |||
| 22588 | 14810772 | void HeroClass::checkgenpush() | |
| 22589 | { | ||
| 22590 | 14810772 | zfix bx, by; | |
| 22591 | 14810772 | zfix bx2, by2; | |
| 22592 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 3628695 times.
✓ Branch 2 taken 2950224 times.
✓ Branch 3 taken 3984601 times.
✓ Branch 4 taken 4247252 times.
|
14810772 | switch(dir) |
| 22593 | { | ||
| 22594 | case up: | ||
| 22595 | 3628695 | by = y + (bigHitbox ? -2 : 6); | |
| 22596 | 3628695 | by2 = by; | |
| 22597 | 3628695 | bx = x + 4; | |
| 22598 | 3628695 | bx2 = bx + 8; | |
| 22599 | 3628695 | break; | |
| 22600 | case down: | ||
| 22601 | 2950224 | by = y + 17; | |
| 22602 | 2950224 | by2 = by; | |
| 22603 | 2950224 | bx = x + 4; | |
| 22604 | 2950224 | bx2 = bx + 8; | |
| 22605 | 2950224 | break; | |
| 22606 | case left: | ||
| 22607 | 3984601 | by = y + (bigHitbox ? 0 : 8); | |
| 22608 | 3984601 | by2 = y + 8; | |
| 22609 | 3984601 | bx = x - 2; | |
| 22610 | 3984601 | bx2 = x - 2; | |
| 22611 | 3984601 | break; | |
| 22612 | case right: | ||
| 22613 | 4247252 | by = y + (bigHitbox ? 0 : 8); | |
| 22614 | 4247252 | by2 = y + 8; | |
| 22615 | 4247252 | bx = x + 17; | |
| 22616 | 4247252 | bx2 = x + 17; | |
| 22617 | 4247252 | break; | |
| 22618 | } | ||
| 22619 | |||
| 22620 | 14810772 | rpos_t rpos_1 = COMBOPOS_REGION_B(bx, by); | |
| 22621 | 14810772 | rpos_t rpos_2 = COMBOPOS_REGION_B(bx2, by2); | |
| 22622 | 14810772 | checkgenpush(rpos_1); | |
| 22623 |
2/2✓ Branch 0 taken 12187741 times.
✓ Branch 1 taken 2623031 times.
|
14810772 | if (rpos_1 != rpos_2) checkgenpush(rpos_2); |
| 22624 | |||
| 22625 |
2/2✓ Branch 0 taken 13284362 times.
✓ Branch 1 taken 1526410 times.
|
14810772 | if (!get_qr(qr_OLD_FFC_FUNCTIONALITY)) |
| 22626 | { | ||
| 22627 | 4917462 | for_some_ffcs([&](const ffc_handle_t& ffc_handle) { | |
| 22628 |
4/4✓ Branch 0 taken 3351905 times.
✓ Branch 1 taken 39147 times.
✓ Branch 2 taken 1968 times.
✓ Branch 3 taken 3349937 times.
|
3391052 | if (ffcIsAt(ffc_handle, bx, by) || ffcIsAt(ffc_handle, bx2, by2)) |
| 22629 | { | ||
| 22630 |
1/2✓ Branch 0 taken 41115 times.
✗ Branch 1 not taken.
|
41849 | trig_each_combo_trigger(ffc_handle, [&](combo_trigger const& trig){ |
| 22631 |
1/2✓ Branch 0 taken 734 times.
✗ Branch 1 not taken.
|
734 | if(!trig.trigger_flags.get(TRIGFLAG_PUSH)) return false; |
| 22632 | ✗ | return pushing && !(pushing % zc_max(1,trig.trig_pushtime)); | |
| 22633 | 734 | }); | |
| 22634 | 41115 | } | |
| 22635 | 3391052 | return true; | |
| 22636 | ✗ | }); | |
| 22637 | 1526410 | } | |
| 22638 | 14810772 | } | |
| 22639 | |||
| 22640 | 14810774 | void HeroClass::checksigns() //Also checks for generic trigger buttons | |
| 22641 | { | ||
| 22642 |
5/6✓ Branch 0 taken 14795781 times.
✓ Branch 1 taken 14993 times.
✓ Branch 2 taken 14776018 times.
✓ Branch 3 taken 19763 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 14776018 times.
|
14810774 | if(walk_through_walls || z>0 || fakez>0) return; |
| 22643 |
5/6✓ Branch 0 taken 14659817 times.
✓ Branch 1 taken 116201 times.
✓ Branch 2 taken 240882 times.
✓ Branch 3 taken 14418935 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 240882 times.
|
14776018 | if(msg_active || (msg_onscreen && get_qr(qr_MSGDISAPPEAR))) |
| 22644 | 116201 | return; //Don't overwrite a message waiting to be dismissed | |
| 22645 | 14659817 | zfix bx, by; | |
| 22646 | 14659817 | zfix bx2, by2; | |
| 22647 | 14659817 | zfix fx(-1), fy(-1); | |
| 22648 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 3529932 times.
✓ Branch 2 taken 2938647 times.
✓ Branch 3 taken 3968585 times.
✓ Branch 4 taken 4222653 times.
|
14659817 | switch(dir) |
| 22649 | { | ||
| 22650 | case up: | ||
| 22651 | 3529932 | by = y + (bigHitbox ? -2 : 6); | |
| 22652 | 3529932 | by2 = by; | |
| 22653 | 3529932 | bx = x + 4; | |
| 22654 | 3529932 | bx2 = bx + 8; | |
| 22655 | 3529932 | break; | |
| 22656 | case down: | ||
| 22657 | 2938647 | by = y + 17; | |
| 22658 | 2938647 | by2 = by; | |
| 22659 | 2938647 | bx = x + 4; | |
| 22660 | 2938647 | bx2 = bx + 8; | |
| 22661 | 2938647 | break; | |
| 22662 | case left: | ||
| 22663 | 3968585 | by = y + (bigHitbox ? 0 : 8); | |
| 22664 | 3968585 | by2 = y + 8; | |
| 22665 | 3968585 | bx = x - 2; | |
| 22666 | 3968585 | bx2 = x - 2; | |
| 22667 | 3968585 | break; | |
| 22668 | case right: | ||
| 22669 | 4222653 | by = y + (bigHitbox ? 0 : 8); | |
| 22670 | 4222653 | by2 = y + 8; | |
| 22671 | 4222653 | bx = x + 17; | |
| 22672 | 4222653 | bx2 = x + 17; | |
| 22673 | 4222653 | break; | |
| 22674 | } | ||
| 22675 | |||
| 22676 | 14659817 | int32_t found = -1; | |
| 22677 | 14659817 | int32_t found_screen = -1; | |
| 22678 | 14659817 | std::optional<ffc_handle_t> foundffc; | |
| 22679 | 14659817 | int32_t found_lyr = 0; | |
| 22680 | 14659817 | bool found_sign = false; | |
| 22681 | 14659817 | int32_t tmp_cid = MAPCOMBO(bx, by); | |
| 22682 | 14659817 | int32_t screen = get_screen_for_world_xy(bx, by); | |
| 22683 | 14659817 | newcombo const* tmp_cmb = &combobuf[tmp_cid]; | |
| 22684 | 14659817 | bool has_trigger_button = false; | |
| 22685 |
2/2✓ Branch 0 taken 14654081 times.
✓ Branch 1 taken 394510 times.
|
15048591 | for(auto& trig : tmp_cmb->triggers) |
| 22686 |
2/2✓ Branch 0 taken 388774 times.
✓ Branch 1 taken 5736 times.
|
394510 | if(trig.triggerbtn) |
| 22687 | { | ||
| 22688 | 5736 | has_trigger_button = true; | |
| 22689 | 5736 | break; | |
| 22690 | } | ||
| 22691 |
2/2✓ Branch 0 taken 22 times.
✓ Branch 1 taken 14659795 times.
|
14665575 | if(((tmp_cmb->type==cSIGNPOST && !(tmp_cmb->only_gentrig)) |
| 22692 |
2/2✓ Branch 0 taken 5758 times.
✓ Branch 1 taken 14654059 times.
|
14659817 | || has_trigger_button) && _effectflag(bx,by,1, -1)) |
| 22693 | { | ||
| 22694 | 5758 | found = tmp_cid; | |
| 22695 | 5758 | found_screen = screen; | |
| 22696 | 5758 | fx = bx; fy = by; | |
| 22697 |
2/2✓ Branch 0 taken 11516 times.
✓ Branch 1 taken 5758 times.
|
17274 | for (int32_t i = 0; i <= 1; ++i) |
| 22698 | { | ||
| 22699 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11516 times.
|
11516 | if (get_qr(qr_OLD_BRIDGE_COMBOS)) |
| 22700 | { | ||
| 22701 | ✗ | if (combobuf[MAPCOMBO2(i,bx,by)].type == cBRIDGE && !_walkflag_layer(bx,by,i)) found = -1; | |
| 22702 | ✗ | } | |
| 22703 | else | ||
| 22704 | { | ||
| 22705 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 11516 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
11516 | if (combobuf[MAPCOMBO2(i,bx,by)].type == cBRIDGE && _effectflag_layer(bx,by,i)) found = -1; |
| 22706 | } | ||
| 22707 | 11516 | } | |
| 22708 | 5758 | } | |
| 22709 | 14659817 | tmp_cid = MAPCOMBO(bx2,by2); | |
| 22710 | 14659817 | screen = get_screen_for_world_xy(bx2, by2); | |
| 22711 | 14659817 | tmp_cmb = &combobuf[tmp_cid]; | |
| 22712 | 14659817 | has_trigger_button = false; | |
| 22713 |
2/2✓ Branch 0 taken 14653597 times.
✓ Branch 1 taken 395648 times.
|
15049245 | for(auto& trig : tmp_cmb->triggers) |
| 22714 |
2/2✓ Branch 0 taken 389428 times.
✓ Branch 1 taken 6220 times.
|
395648 | if(trig.triggerbtn) |
| 22715 | { | ||
| 22716 | 6220 | has_trigger_button = true; | |
| 22717 | 6220 | break; | |
| 22718 | } | ||
| 22719 |
2/2✓ Branch 0 taken 22 times.
✓ Branch 1 taken 14659795 times.
|
14666059 | if(((tmp_cmb->type==cSIGNPOST && !(tmp_cmb->only_gentrig)) |
| 22720 |
2/2✓ Branch 0 taken 6242 times.
✓ Branch 1 taken 14653575 times.
|
14659817 | || has_trigger_button) && _effectflag(bx2,by2,1, -1)) |
| 22721 | { | ||
| 22722 | 6242 | found = tmp_cid; | |
| 22723 | 6242 | found_screen = screen; | |
| 22724 | 6242 | fx = bx2; fy = by2; | |
| 22725 |
2/2✓ Branch 0 taken 12484 times.
✓ Branch 1 taken 6242 times.
|
18726 | for (int32_t i = 0; i <= 1; ++i) |
| 22726 | { | ||
| 22727 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12484 times.
|
12484 | if (get_qr(qr_OLD_BRIDGE_COMBOS)) |
| 22728 | { | ||
| 22729 | ✗ | if (combobuf[MAPCOMBO2(i,bx2,by2)].type == cBRIDGE && !_walkflag_layer(bx2,by2,i)) found = -1; | |
| 22730 | ✗ | } | |
| 22731 | else | ||
| 22732 | { | ||
| 22733 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 12484 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
12484 | if (combobuf[MAPCOMBO2(i,bx2,by2)].type == cBRIDGE && _effectflag_layer(bx2,by2,i)) found = -1; |
| 22734 | } | ||
| 22735 | 12484 | } | |
| 22736 | 6242 | } | |
| 22737 | |||
| 22738 |
2/2✓ Branch 0 taken 13141413 times.
✓ Branch 1 taken 1518404 times.
|
14659817 | if (!get_qr(qr_OLD_FFC_FUNCTIONALITY)) |
| 22739 | { | ||
| 22740 | 4572613 | foundffc = find_ffc([&](const ffc_handle_t& ffc_handle) { | |
| 22741 |
4/4✓ Branch 0 taken 3015456 times.
✓ Branch 1 taken 38753 times.
✓ Branch 2 taken 1963 times.
✓ Branch 3 taken 3013493 times.
|
3054209 | if (ffcIsAt(ffc_handle, bx, by) || ffcIsAt(ffc_handle, bx2, by2)) |
| 22742 | { | ||
| 22743 | 40716 | tmp_cmb = &ffc_handle.combo(); | |
| 22744 | 40716 | has_trigger_button = false; | |
| 22745 |
2/2✓ Branch 0 taken 40716 times.
✓ Branch 1 taken 730 times.
|
41446 | for(auto& trig : tmp_cmb->triggers) |
| 22746 |
1/2✓ Branch 0 taken 730 times.
✗ Branch 1 not taken.
|
730 | if(trig.triggerbtn) |
| 22747 | { | ||
| 22748 | ✗ | has_trigger_button = true; | |
| 22749 | ✗ | break; | |
| 22750 | } | ||
| 22751 |
4/4✓ Branch 0 taken 12 times.
✓ Branch 1 taken 40704 times.
✓ Branch 2 taken 12 times.
✓ Branch 3 taken 40704 times.
|
40716 | if(((tmp_cmb->type==cSIGNPOST && !(tmp_cmb->only_gentrig)) |
| 22752 | 40716 | || has_trigger_button) && true) //!TODO: FFC effect flag? | |
| 22753 | { | ||
| 22754 | 12 | return true; | |
| 22755 | } | ||
| 22756 | 40704 | } | |
| 22757 | |||
| 22758 | 3054197 | return false; | |
| 22759 | 3054209 | }); | |
| 22760 | 1518404 | } | |
| 22761 | |||
| 22762 |
4/4✓ Branch 0 taken 14653394 times.
✓ Branch 1 taken 6423 times.
✓ Branch 2 taken 12 times.
✓ Branch 3 taken 14653382 times.
|
14659817 | if(found<0 && !foundffc) |
| 22763 | { | ||
| 22764 | 14653382 | screen = get_screen_for_world_xy(bx, by); | |
| 22765 |
2/2✓ Branch 0 taken 14651286 times.
✓ Branch 1 taken 87910511 times.
|
102561797 | for(int32_t i=0; i<6; i++) |
| 22766 | { | ||
| 22767 | 87910511 | tmp_cid = MAPCOMBO2(i,bx,by); | |
| 22768 | 87910511 | tmp_cmb = &combobuf[tmp_cid]; | |
| 22769 | 87910511 | has_trigger_button = false; | |
| 22770 |
2/2✓ Branch 0 taken 87909162 times.
✓ Branch 1 taken 2460740 times.
|
90369902 | for(auto& trig : tmp_cmb->triggers) |
| 22771 |
2/2✓ Branch 0 taken 2459391 times.
✓ Branch 1 taken 1349 times.
|
2460740 | if(trig.triggerbtn) |
| 22772 | { | ||
| 22773 | 1349 | has_trigger_button = true; | |
| 22774 | 1349 | break; | |
| 22775 | } | ||
| 22776 |
2/2✓ Branch 0 taken 694 times.
✓ Branch 1 taken 87909817 times.
|
87912554 | if(((tmp_cmb->type==cSIGNPOST && !(tmp_cmb->only_gentrig)) |
| 22777 |
2/2✓ Branch 0 taken 2043 times.
✓ Branch 1 taken 87908468 times.
|
87910511 | || has_trigger_button) && _effectflag(bx,by,1, i)) |
| 22778 | { | ||
| 22779 | 2043 | found = tmp_cid; | |
| 22780 | 2043 | found_screen = screen; | |
| 22781 | 2043 | found_lyr = i+1; | |
| 22782 | 2043 | fx = bx; fy = by; | |
| 22783 |
2/2✓ Branch 0 taken 661 times.
✓ Branch 1 taken 1382 times.
|
2043 | if (i == 0) |
| 22784 | { | ||
| 22785 |
2/2✓ Branch 0 taken 1144 times.
✓ Branch 1 taken 238 times.
|
1382 | if (get_qr(qr_OLD_BRIDGE_COMBOS)) |
| 22786 | { | ||
| 22787 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1144 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1144 | if (combobuf[MAPCOMBO2(1,bx,by)].type == cBRIDGE && !_walkflag_layer(bx,by,1)) found = -1; |
| 22788 | 1144 | } | |
| 22789 | else | ||
| 22790 | { | ||
| 22791 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 238 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
238 | if (combobuf[MAPCOMBO2(1,bx,by)].type == cBRIDGE && _effectflag_layer(bx,by,1)) found = -1; |
| 22792 | } | ||
| 22793 | 1382 | } | |
| 22794 | 2043 | } | |
| 22795 | 87910511 | screen = get_screen_for_world_xy(bx2, by2); | |
| 22796 | 87910511 | tmp_cid = MAPCOMBO2(i,bx2,by2); | |
| 22797 | 87910511 | tmp_cmb = &combobuf[tmp_cid]; | |
| 22798 | 87910511 | has_trigger_button = false; | |
| 22799 |
2/2✓ Branch 0 taken 87909261 times.
✓ Branch 1 taken 2458742 times.
|
90368003 | for(auto& trig : tmp_cmb->triggers) |
| 22800 |
2/2✓ Branch 0 taken 2457492 times.
✓ Branch 1 taken 1250 times.
|
2458742 | if(trig.triggerbtn) |
| 22801 | { | ||
| 22802 | 1250 | has_trigger_button = true; | |
| 22803 | 1250 | break; | |
| 22804 | } | ||
| 22805 |
2/2✓ Branch 0 taken 686 times.
✓ Branch 1 taken 87909825 times.
|
87912447 | if(((tmp_cmb->type==cSIGNPOST && !(tmp_cmb->only_gentrig)) |
| 22806 |
2/2✓ Branch 0 taken 1936 times.
✓ Branch 1 taken 87908575 times.
|
87910511 | || has_trigger_button) && _effectflag(bx2,by2,1, i)) |
| 22807 | { | ||
| 22808 | 1936 | found = tmp_cid; | |
| 22809 | 1936 | found_screen = screen; | |
| 22810 | 1936 | found_lyr = i+1; | |
| 22811 | 1936 | fx = bx2; fy = by2; | |
| 22812 |
2/2✓ Branch 0 taken 653 times.
✓ Branch 1 taken 1283 times.
|
1936 | if (i == 0) |
| 22813 | { | ||
| 22814 |
2/2✓ Branch 0 taken 1032 times.
✓ Branch 1 taken 251 times.
|
1283 | if (get_qr(qr_OLD_BRIDGE_COMBOS)) |
| 22815 | { | ||
| 22816 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1032 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1032 | if (combobuf[MAPCOMBO2(1,bx2,by2)].type == cBRIDGE && !_walkflag_layer(bx2,by2,1)) found = -1; |
| 22817 | 1032 | } | |
| 22818 | else | ||
| 22819 | { | ||
| 22820 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 251 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
251 | if (combobuf[MAPCOMBO2(1,bx2,by2)].type == cBRIDGE && _effectflag_layer(bx2,by2,1)) found = -1; |
| 22821 | } | ||
| 22822 | 1283 | } | |
| 22823 | 1936 | } | |
| 22824 |
2/2✓ Branch 0 taken 87908415 times.
✓ Branch 1 taken 2096 times.
|
87910511 | if(found>-1) break; |
| 22825 | 87908415 | } | |
| 22826 | 14653382 | } | |
| 22827 | |||
| 22828 |
4/4✓ Branch 0 taken 14651298 times.
✓ Branch 1 taken 8519 times.
✓ Branch 2 taken 12 times.
✓ Branch 3 taken 14651286 times.
|
14659817 | if(found<0&&!foundffc) return; |
| 22829 | |||
| 22830 |
2/2✓ Branch 0 taken 12 times.
✓ Branch 1 taken 8519 times.
|
8531 | newcombo const& cmb = combobuf[foundffc ? foundffc->data() : found]; |
| 22831 | |||
| 22832 | 8531 | byte signInput = 0; | |
| 22833 | 8531 | bool didsign = false, didprompt = false; | |
| 22834 |
3/4✓ Branch 0 taken 766 times.
✓ Branch 1 taken 7765 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 766 times.
|
8553 | if(cmb.type == cSIGNPOST && !(cmb.only_gentrig)) |
| 22835 | { | ||
| 22836 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 611 times.
✓ Branch 2 taken 116 times.
✓ Branch 3 taken 4 times.
✓ Branch 4 taken 35 times.
|
766 | switch(dir) |
| 22837 | { | ||
| 22838 | case up: | ||
| 22839 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 611 times.
|
611 | if(cmb.usrflags&cflag10) |
| 22840 | ✗ | goto endsigns; | |
| 22841 | 611 | break; | |
| 22842 | case down: | ||
| 22843 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 116 times.
|
116 | if(cmb.usrflags&cflag9) |
| 22844 | ✗ | goto endsigns; | |
| 22845 | 116 | break; | |
| 22846 | case left: | ||
| 22847 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | if(cmb.usrflags&cflag12) |
| 22848 | ✗ | goto endsigns; | |
| 22849 | 4 | break; | |
| 22850 | case right: | ||
| 22851 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 35 times.
|
35 | if(cmb.usrflags&cflag11) |
| 22852 | ✗ | goto endsigns; | |
| 22853 | 35 | break; | |
| 22854 | } | ||
| 22855 | 766 | int32_t intbtn = cmb.attribytes[2]; | |
| 22856 | |||
| 22857 |
1/2✓ Branch 0 taken 766 times.
✗ Branch 1 not taken.
|
766 | if(intbtn) // |
| 22858 | { | ||
| 22859 | 766 | signInput = getIntBtnInput(intbtn, INPUT_PRESS | INPUT_DRUNK); | |
| 22860 |
2/2✓ Branch 0 taken 22 times.
✓ Branch 1 taken 744 times.
|
766 | if(!signInput) |
| 22861 | { | ||
| 22862 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 744 times.
|
744 | if(cmb.usrflags & cflag13) //display prompt |
| 22863 | { | ||
| 22864 | 744 | prompt_combo = cmb.attributes[1]/10000; | |
| 22865 | 744 | prompt_cset = cmb.attribytes[4]; | |
| 22866 | 744 | prompt_x = cmb.attrishorts[0]; | |
| 22867 | 744 | prompt_y = cmb.attrishorts[1]; | |
| 22868 | 744 | didprompt = true; | |
| 22869 | 744 | } | |
| 22870 | 744 | goto endsigns; //Button not pressed | |
| 22871 | } | ||
| 22872 | 22 | } | |
| 22873 | ✗ | else if(pushing < 8 || pushing%8) goto endsigns; //Not pushing against sign enough | |
| 22874 | |||
| 22875 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 21 times.
|
22 | trigger_sign(cmb, foundffc ? foundffc->screen : found_screen); |
| 22876 | 22 | didsign = true; | |
| 22877 | 22 | } | |
| 22878 | endsigns: | ||
| 22879 | 8531 | auto& cpos = cpos_get(get_rpos_handle_for_world_xy(fx, fy, found_lyr)); | |
| 22880 | int dir_trigflag; | ||
| 22881 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 523 times.
✓ Branch 2 taken 6686 times.
✓ Branch 3 taken 802 times.
✓ Branch 4 taken 520 times.
|
8531 | switch(dir) |
| 22882 | { | ||
| 22883 | case down: | ||
| 22884 | 523 | dir_trigflag = TRIGFLAG_BTN_TOP; | |
| 22885 | 523 | break; | |
| 22886 | case up: | ||
| 22887 | 6686 | dir_trigflag = TRIGFLAG_BTN_BOTTOM; | |
| 22888 | 6686 | break; | |
| 22889 | case right: | ||
| 22890 | 802 | dir_trigflag = TRIGFLAG_BTN_LEFT; | |
| 22891 | 802 | break; | |
| 22892 | case left: | ||
| 22893 | 520 | dir_trigflag = TRIGFLAG_BTN_RIGHT; | |
| 22894 | 520 | break; | |
| 22895 | } | ||
| 22896 | 8531 | bool found_a_trigger_dir = false, did_trigger = false; | |
| 22897 | 8531 | combined_handle_t comb_handle; | |
| 22898 |
3/4✓ Branch 0 taken 8519 times.
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 8519 times.
|
8531 | if(fx != -1 && fy != -1) |
| 22899 | 8519 | comb_handle = get_rpos_handle_for_world_xy(fx, fy, found_lyr); | |
| 22900 |
2/2✓ Branch 0 taken 8519 times.
✓ Branch 1 taken 12 times.
|
8531 | if(foundffc) |
| 22901 | 12 | comb_handle = foundffc.value(); | |
| 22902 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8531 times.
|
16308 | did_trigger = trig_each_combo_trigger(comb_handle, [&](combo_trigger const& trig, size_t idx){ |
| 22903 |
2/2✓ Branch 0 taken 87 times.
✓ Branch 1 taken 7690 times.
|
7777 | if(!trig.trigger_flags.get(dir_trigflag)) return false; |
| 22904 | 7690 | found_a_trigger_dir = true; | |
| 22905 | 7690 | auto& trig_data = cpos.trig_data[idx]; | |
| 22906 |
3/6✓ Branch 0 taken 7690 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7690 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 7690 times.
|
7690 | if(fx != -1 && fy != -1 && trig_data.cooldown) return false; |
| 22907 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 7690 times.
✓ Branch 2 taken 7513 times.
✓ Branch 3 taken 177 times.
|
15380 | return trig.triggerbtn && (getIntBtnInput(trig.triggerbtn, INPUT_PRESS | INPUT_DRUNK) || checkIntBtnVal(trig.triggerbtn, signInput)); |
| 22908 | 7777 | }); | |
| 22909 |
5/6✓ Branch 0 taken 7688 times.
✓ Branch 1 taken 843 times.
✓ Branch 2 taken 7688 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 175 times.
✓ Branch 5 taken 7513 times.
|
8531 | if(!found_a_trigger_dir || didprompt || did_trigger) |
| 22910 | 1018 | return; | |
| 22911 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7513 times.
|
7513 | else if(cmb.type == cBUTTONPROMPT) |
| 22912 | { | ||
| 22913 | ✗ | prompt_combo = cmb.attributes[0]/10000; | |
| 22914 | ✗ | prompt_cset = cmb.attribytes[0]; | |
| 22915 | ✗ | prompt_x = cmb.attrishorts[0]; | |
| 22916 | ✗ | prompt_y = cmb.attrishorts[1]; | |
| 22917 | ✗ | } | |
| 22918 |
2/2✓ Branch 0 taken 1362 times.
✓ Branch 1 taken 7513 times.
|
8875 | else for (size_t idx = 0; idx < cmb.triggers.size(); ++idx) |
| 22919 | { | ||
| 22920 | 7513 | auto& trig_data = cpos.trig_data[idx]; | |
| 22921 |
3/6✓ Branch 0 taken 7513 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7513 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7513 times.
✗ Branch 5 not taken.
|
7513 | if(fx != -1 && fy != -1 && trig_data.cooldown) continue; |
| 22922 | 7513 | auto& trig = cmb.triggers[idx]; | |
| 22923 | 7513 | bool cond = check_trig_conditions(comb_handle, idx); | |
| 22924 |
2/2✓ Branch 0 taken 7333 times.
✓ Branch 1 taken 180 times.
|
7513 | auto pcid = cond ? trig.prompt_cid : trig.fail_prompt_cid; |
| 22925 |
2/2✓ Branch 0 taken 7333 times.
✓ Branch 1 taken 180 times.
|
7513 | auto pcs = cond ? trig.prompt_cs : trig.fail_prompt_cs; |
| 22926 |
2/2✓ Branch 0 taken 1362 times.
✓ Branch 1 taken 6151 times.
|
7513 | if(pcid) |
| 22927 | { | ||
| 22928 | 6151 | prompt_combo = pcid; | |
| 22929 | 6151 | prompt_cset = pcs; | |
| 22930 | 6151 | prompt_x = trig.prompt_x; | |
| 22931 | 6151 | prompt_y = trig.prompt_y; | |
| 22932 | 6151 | break; | |
| 22933 | } | ||
| 22934 | 1362 | } | |
| 22935 | 14810774 | } | |
| 22936 | |||
| 22937 | // Checks for locked doors, and potentially unlocks them. | ||
| 22938 | // Only looks at `current_screen`. | ||
| 22939 | 14809352 | void HeroClass::checklocked() | |
| 22940 | { | ||
| 22941 |
2/2✓ Branch 0 taken 14993 times.
✓ Branch 1 taken 14794359 times.
|
14809352 | if(walk_through_walls) return; //Walk through walls. |
| 22942 |
2/2✓ Branch 0 taken 8538358 times.
✓ Branch 1 taken 6256001 times.
|
14794359 | if(!isdungeon(current_screen)) return; |
| 22943 |
4/4✓ Branch 0 taken 6203749 times.
✓ Branch 1 taken 52252 times.
✓ Branch 2 taken 12798 times.
✓ Branch 3 taken 6190951 times.
|
6256001 | if( !diagonalMovement && pushing!=8) return; |
| 22944 | //This is required to allow the player to open a door, while sliding along a wall (pressing in the direction of the door, and sliding left or right) | ||
| 22945 |
4/4✓ Branch 0 taken 52252 times.
✓ Branch 1 taken 12798 times.
✓ Branch 2 taken 2677 times.
✓ Branch 3 taken 49575 times.
|
65050 | if ( diagonalMovement && pushing < 8 ) return; //Allow wall walking Should I add a quest rule for this? -Z |
| 22946 | |||
| 22947 | 46425 | auto [offx, offy] = translate_screen_coordinates_to_world(current_screen); | |
| 22948 | 30950 | int x = this->x - offx; | |
| 22949 | 30950 | int y = this->y - offy; | |
| 22950 | |||
| 22951 | 15475 | optional<int> openDir; | |
| 22952 |
4/6✓ Branch 0 taken 12798 times.
✓ Branch 1 taken 2677 times.
✓ Branch 2 taken 12798 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 12798 times.
|
15475 | if ( diagonalMovement || NO_GRIDLOCK) |
| 22953 | { | ||
| 22954 |
8/8✓ Branch 0 taken 144 times.
✓ Branch 1 taken 2533 times.
✓ Branch 2 taken 98 times.
✓ Branch 3 taken 46 times.
✓ Branch 4 taken 57 times.
✓ Branch 5 taken 41 times.
✓ Branch 6 taken 25 times.
✓ Branch 7 taken 32 times.
|
2677 | if(y <= 32 && x >= 112 && x <= 128 && Y_DIR(dir) == up) |
| 22955 | 32 | openDir = up; | |
| 22956 |
8/8✓ Branch 0 taken 321 times.
✓ Branch 1 taken 2324 times.
✓ Branch 2 taken 198 times.
✓ Branch 3 taken 123 times.
✓ Branch 4 taken 90 times.
✓ Branch 5 taken 108 times.
✓ Branch 6 taken 57 times.
✓ Branch 7 taken 33 times.
|
2645 | else if(y >= 128 && x >= 112 && x <= 128 && Y_DIR(dir) == down) |
| 22957 | 33 | openDir = down; | |
| 22958 |
5/8✓ Branch 0 taken 1463 times.
✓ Branch 1 taken 1149 times.
✓ Branch 2 taken 272 times.
✓ Branch 3 taken 1191 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 272 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
2612 | else if(y > 72 && y < 88 && x <= 32 && X_DIR(dir) == left) |
| 22959 | ✗ | openDir = left; | |
| 22960 |
5/8✓ Branch 0 taken 1463 times.
✓ Branch 1 taken 1149 times.
✓ Branch 2 taken 272 times.
✓ Branch 3 taken 1191 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 272 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
2612 | else if(y > 72 && y < 88 && x >= 208 && X_DIR(dir) == right) |
| 22961 | ✗ | openDir = right; | |
| 22962 | 2677 | } | |
| 22963 | else | ||
| 22964 | { | ||
| 22965 |
6/6✓ Branch 0 taken 1751 times.
✓ Branch 1 taken 11047 times.
✓ Branch 2 taken 474 times.
✓ Branch 3 taken 1277 times.
✓ Branch 4 taken 61 times.
✓ Branch 5 taken 413 times.
|
12798 | if(y <= 32 && x == 120 && Y_DIR(dir) == up) |
| 22966 | 413 | openDir = up; | |
| 22967 |
6/6✓ Branch 0 taken 1806 times.
✓ Branch 1 taken 10579 times.
✓ Branch 2 taken 252 times.
✓ Branch 3 taken 1554 times.
✓ Branch 4 taken 25 times.
✓ Branch 5 taken 227 times.
|
12385 | else if(y >= 128 && x == 120 && Y_DIR(dir) == down) |
| 22968 | 227 | openDir = down; | |
| 22969 |
6/6✓ Branch 0 taken 1831 times.
✓ Branch 1 taken 10327 times.
✓ Branch 2 taken 339 times.
✓ Branch 3 taken 1492 times.
✓ Branch 4 taken 114 times.
✓ Branch 5 taken 225 times.
|
12158 | else if(y == 80 && x <= 32 && X_DIR(dir) == left) |
| 22970 | 225 | openDir = left; | |
| 22971 |
6/6✓ Branch 0 taken 1606 times.
✓ Branch 1 taken 10327 times.
✓ Branch 2 taken 423 times.
✓ Branch 3 taken 1183 times.
✓ Branch 4 taken 67 times.
✓ Branch 5 taken 356 times.
|
11933 | else if(y == 80 && x >= 208 && X_DIR(dir) == right) |
| 22972 | 356 | openDir = right; | |
| 22973 | } | ||
| 22974 | |||
| 22975 |
2/2✓ Branch 0 taken 14189 times.
✓ Branch 1 taken 1286 times.
|
15475 | if(openDir) |
| 22976 | { | ||
| 22977 | 1286 | int d = *openDir; | |
| 22978 |
2/2✓ Branch 0 taken 364 times.
✓ Branch 1 taken 922 times.
|
1286 | if (hero_scr->door[d]==dLOCKED) |
| 22979 | { | ||
| 22980 |
2/2✓ Branch 0 taken 350 times.
✓ Branch 1 taken 14 times.
|
364 | if(usekey()) |
| 22981 | { | ||
| 22982 | 350 | putdoor(hero_scr, scrollbuf, d, dUNLOCKED); | |
| 22983 | 350 | hero_scr->door[d]=dUNLOCKED; | |
| 22984 | 350 | set_doorstate(current_screen, d); | |
| 22985 | 350 | sfx(WAV_DOOR); | |
| 22986 | 350 | markBmap(); | |
| 22987 | |||
| 22988 | // set_doorstate updates the door state of the opposite screen too, but it doesn't | ||
| 22989 | // update anything for the current region. Do that here. | ||
| 22990 |
1/2✓ Branch 0 taken 350 times.
✗ Branch 1 not taken.
|
350 | if (mapscr* opp_scr = get_scr_current_region_dir(current_screen, (direction)d)) |
| 22991 | { | ||
| 22992 | ✗ | if (opp_scr->door[d^1] == dLOCKED) | |
| 22993 | { | ||
| 22994 | ✗ | opp_scr->door[d^1] = dUNLOCKED; | |
| 22995 | ✗ | putdoor(opp_scr, scrollbuf, d^1, dUNLOCKED); | |
| 22996 | ✗ | } | |
| 22997 | ✗ | } | |
| 22998 | 350 | } | |
| 22999 | 14 | else return; | |
| 23000 | 350 | } | |
| 23001 |
2/2✓ Branch 0 taken 866 times.
✓ Branch 1 taken 56 times.
|
922 | else if(hero_scr->door[d]==dBOSS) |
| 23002 | { | ||
| 23003 |
2/2✓ Branch 0 taken 51 times.
✓ Branch 1 taken 5 times.
|
56 | if(game->lvlitems[dlevel]&(1 << li_boss_key)) |
| 23004 | { | ||
| 23005 | 51 | putdoor(hero_scr, scrollbuf, d, dOPENBOSS); | |
| 23006 | 51 | hero_scr->door[d]=dOPENBOSS; | |
| 23007 | 51 | set_doorstate(current_screen, d); | |
| 23008 | 51 | sfx(WAV_DOOR); | |
| 23009 | 51 | markBmap(); | |
| 23010 | |||
| 23011 | // set_doorstate updates the door state of the opposite screen too, but it doesn't | ||
| 23012 | // update anything for the current region. Do that here. | ||
| 23013 |
1/2✓ Branch 0 taken 51 times.
✗ Branch 1 not taken.
|
51 | if (mapscr* opp_scr = get_scr_current_region_dir(current_screen, (direction)d)) |
| 23014 | { | ||
| 23015 | ✗ | if (opp_scr->door[d^1] == dBOSS) | |
| 23016 | { | ||
| 23017 | ✗ | opp_scr->door[d^1] = dOPENBOSS; | |
| 23018 | ✗ | putdoor(opp_scr, scrollbuf, d^1, dOPENBOSS); | |
| 23019 | ✗ | } | |
| 23020 | ✗ | } | |
| 23021 | |||
| 23022 | // Run Boss Key Script | ||
| 23023 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3468 times.
|
3468 | for ( int32_t q = 0; q < MAXITEMS; ++q ) |
| 23024 |
2/2✓ Branch 0 taken 3417 times.
✓ Branch 1 taken 51 times.
|
3468 | if ( itemsbuf[q].type == itype_bosskey ) |
| 23025 | { | ||
| 23026 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 51 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
51 | if (itemsbuf[q].script && !(FFCore.doscript(ScriptType::Item, q) && get_qr(qr_ITEMSCRIPTSKEEPRUNNING))) |
| 23027 | { | ||
| 23028 | ✗ | FFCore.reset_script_engine_data(ScriptType::Item, q); | |
| 23029 | ✗ | ZScriptVersion::RunScript(ScriptType::Item, itemsbuf[q].script, q); | |
| 23030 | ✗ | FFCore.deallocateAllScriptOwned(ScriptType::Item, q); | |
| 23031 | ✗ | } | |
| 23032 | 51 | break; | |
| 23033 | } | ||
| 23034 | 51 | } | |
| 23035 | 5 | else return; | |
| 23036 | 51 | } | |
| 23037 | 1267 | } | |
| 23038 | 14809352 | } | |
| 23039 | |||
| 23040 | 14809352 | void HeroClass::checkswordtap() | |
| 23041 | { | ||
| 23042 |
6/6✓ Branch 0 taken 7203818 times.
✓ Branch 1 taken 7605534 times.
✓ Branch 2 taken 47741 times.
✓ Branch 3 taken 7156077 times.
✓ Branch 4 taken 46719 times.
✓ Branch 5 taken 1022 times.
|
14809352 | if(attack!=wSword || charging<=0 || pushing<8) return; |
| 23043 | |||
| 23044 | 1022 | int32_t bx=x; | |
| 23045 | 1022 | int32_t by=y+8; | |
| 23046 | |||
| 23047 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 304 times.
✓ Branch 2 taken 120 times.
✓ Branch 3 taken 313 times.
✓ Branch 4 taken 285 times.
|
1022 | switch(dir) |
| 23048 | { | ||
| 23049 | case up: | ||
| 23050 |
2/2✓ Branch 0 taken 237 times.
✓ Branch 1 taken 67 times.
|
304 | if (!getInput(btnUp, INPUT_HERO_ACTION)) return; |
| 23051 | |||
| 23052 | 237 | by-=16; | |
| 23053 | 237 | break; | |
| 23054 | |||
| 23055 | case down: | ||
| 23056 |
2/2✓ Branch 0 taken 100 times.
✓ Branch 1 taken 20 times.
|
120 | if (!getInput(btnDown, INPUT_HERO_ACTION)) return; |
| 23057 | |||
| 23058 | 100 | by+=16; | |
| 23059 | 100 | bx+=8; | |
| 23060 | 100 | break; | |
| 23061 | |||
| 23062 | case left: | ||
| 23063 |
2/2✓ Branch 0 taken 169 times.
✓ Branch 1 taken 144 times.
|
313 | if (!getInput(btnLeft, INPUT_HERO_ACTION)) return; |
| 23064 | |||
| 23065 | 169 | bx-=16; | |
| 23066 | 169 | by+=8; | |
| 23067 | 169 | break; | |
| 23068 | |||
| 23069 | case right: | ||
| 23070 |
2/2✓ Branch 0 taken 213 times.
✓ Branch 1 taken 72 times.
|
285 | if (!getInput(btnRight, INPUT_HERO_ACTION)) return; |
| 23071 | |||
| 23072 | 213 | bx+=16; | |
| 23073 | 213 | by+=8; | |
| 23074 | 213 | break; | |
| 23075 | } | ||
| 23076 | |||
| 23077 |
2/2✓ Branch 0 taken 547 times.
✓ Branch 1 taken 172 times.
|
719 | if(!_walkflag(bx,by,0,get_standing_z_state())) return; |
| 23078 | |||
| 23079 | 547 | attackclk=SWORDTAPFRAME; | |
| 23080 | 547 | pushing=-8; //16 frames between taps | |
| 23081 | 547 | tapping=true; | |
| 23082 | |||
| 23083 |
2/2✓ Branch 0 taken 13 times.
✓ Branch 1 taken 534 times.
|
547 | if (!isCuttableType(COMBOTYPE(bx, by))) |
| 23084 | { | ||
| 23085 | 534 | int tap_sfx = -1; | |
| 23086 | 534 | bool hollow = false; | |
| 23087 |
2/2✓ Branch 0 taken 524 times.
✓ Branch 1 taken 3728 times.
|
4252 | for(int lyr = 6; lyr >= 0; --lyr) |
| 23088 | { | ||
| 23089 | 3728 | auto rpos_handle_lyr = get_rpos_handle_for_world_xy(bx, by, lyr); | |
| 23090 | 3728 | auto& cmb = rpos_handle_lyr.combo(); | |
| 23091 |
2/2✓ Branch 0 taken 3718 times.
✓ Branch 1 taken 10 times.
|
3728 | if(cmb.sfx_tap) |
| 23092 | { | ||
| 23093 | 10 | tap_sfx = cmb.sfx_tap; | |
| 23094 | 10 | break; | |
| 23095 | } | ||
| 23096 | |||
| 23097 |
3/4✓ Branch 0 taken 3702 times.
✓ Branch 1 taken 16 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 3702 times.
|
7420 | if(rpos_handle_lyr.sflag() == mfBOMB || rpos_handle_lyr.sflag() == mfSBOMB |
| 23098 |
2/4✓ Branch 0 taken 3702 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 3702 times.
✗ Branch 3 not taken.
|
3702 | || cmb.flag == mfBOMB || cmb.flag == mfSBOMB) |
| 23099 | 16 | hollow = true; | |
| 23100 | 3718 | } | |
| 23101 |
3/4✓ Branch 0 taken 524 times.
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 524 times.
|
534 | if(tap_sfx < 0 && get_qr(qr_SEPARATE_BOMBABLE_TAPPING_SFX)) |
| 23102 | { | ||
| 23103 |
4/12✓ Branch 0 taken 508 times.
✓ Branch 1 taken 16 times.
✓ Branch 2 taken 508 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 508 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
524 | if(hollow || (!is_in_scrolling_region() && origin_scr->door[dir]==dBOMB && ((dir==up||dir==down) |
| 23104 | ✗ | ? (bx>=112 && bx<144 && (by>=144 || by<=32)) | |
| 23105 | ✗ | : by>=72 && by<104 && (bx>=224 || bx<=32)))) | |
| 23106 | 16 | tap_sfx = QMisc.miscsfx[sfxTAP_HOLLOW]; | |
| 23107 | 524 | } | |
| 23108 |
2/2✓ Branch 0 taken 26 times.
✓ Branch 1 taken 508 times.
|
534 | if(tap_sfx < 0) |
| 23109 | 508 | tap_sfx = QMisc.miscsfx[sfxTAP]; | |
| 23110 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 534 times.
|
534 | if(tap_sfx) |
| 23111 | 534 | sfx(tap_sfx,pan(x)); | |
| 23112 | 534 | } | |
| 23113 | 14809352 | } | |
| 23114 | |||
| 23115 | 29555 | void HeroClass::fairycircle(int32_t type) | |
| 23116 | { | ||
| 23117 |
2/2✓ Branch 0 taken 25127 times.
✓ Branch 1 taken 4428 times.
|
29555 | if(fairyclk==0) |
| 23118 | { | ||
| 23119 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 4333 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 94 times.
|
4428 | switch(type) |
| 23120 | { | ||
| 23121 | case REFILL_LIFE: | ||
| 23122 |
2/2✓ Branch 0 taken 4177 times.
✓ Branch 1 taken 156 times.
|
4333 | if(didstuff&did_fairy) return; |
| 23123 | |||
| 23124 | 156 | didstuff|=did_fairy; | |
| 23125 | 156 | break; | |
| 23126 | |||
| 23127 | case REFILL_MAGIC: | ||
| 23128 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | if(didstuff&did_magic) return; |
| 23129 | |||
| 23130 | 1 | didstuff|=did_magic; | |
| 23131 | 1 | break; | |
| 23132 | |||
| 23133 | case REFILL_ALL: | ||
| 23134 |
2/2✓ Branch 0 taken 76 times.
✓ Branch 1 taken 18 times.
|
94 | if(didstuff&did_all) return; |
| 23135 | |||
| 23136 | 18 | didstuff|=did_all; | |
| 23137 | 18 | } | |
| 23138 | |||
| 23139 | 175 | refill_what=type; | |
| 23140 | 175 | refill_why=REFILL_FAIRY; | |
| 23141 | 175 | StartRefill(type); | |
| 23142 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 175 times.
|
175 | if (IsSideSwim()) {action=sideswimfreeze; FFCore.setHeroAction(sideswimfreeze);} |
| 23143 | 175 | else {action=freeze; FFCore.setHeroAction(freeze);} | |
| 23144 | 175 | holdclk=0; | |
| 23145 | 175 | hopclk=0; | |
| 23146 | 175 | } | |
| 23147 | |||
| 23148 | 25302 | ++fairyclk; | |
| 23149 | |||
| 23150 |
2/2✓ Branch 0 taken 11151 times.
✓ Branch 1 taken 14151 times.
|
25302 | if(refilling!=REFILL_FAIRYDONE) |
| 23151 | { | ||
| 23152 |
2/2✓ Branch 0 taken 10976 times.
✓ Branch 1 taken 175 times.
|
11151 | if(!refill()) |
| 23153 | 175 | refilling=REFILL_FAIRYDONE; | |
| 23154 | 11151 | } | |
| 23155 | |||
| 23156 |
2/2✓ Branch 0 taken 13977 times.
✓ Branch 1 taken 174 times.
|
14151 | else if(++holdclk>80) |
| 23157 | { | ||
| 23158 | 174 | reset_swordcharge(); | |
| 23159 | 174 | attackclk=0; | |
| 23160 | 174 | action=none; FFCore.setHeroAction(none); | |
| 23161 | 174 | fairyclk=0; | |
| 23162 | 174 | holdclk=0; | |
| 23163 | 174 | refill_why = 0; | |
| 23164 | 174 | refilling=REFILL_NONE; | |
| 23165 | 174 | map_bkgsfx(true); | |
| 23166 | 174 | } | |
| 23167 | 29555 | } | |
| 23168 | |||
| 23169 | ✗ | static int32_t GridX(int32_t x) | |
| 23170 | { | ||
| 23171 | ✗ | return (x >> 4) << 4; | |
| 23172 | } | ||
| 23173 | |||
| 23174 | //Snaps 'y' to the combo grid | ||
| 23175 | //Equivalent to calling ComboY(ComboAt(foo,y)); | ||
| 23176 | ✗ | static int32_t GridY(int32_t y) | |
| 23177 | { | ||
| 23178 | ✗ | return (y >> 4) << 4; | |
| 23179 | } | ||
| 23180 | |||
| 23181 | 9 | static int32_t beamGrabComboFromPos(rpos_t rpos, int32_t type) | |
| 23182 | { | ||
| 23183 |
1/2✓ Branch 0 taken 63 times.
✗ Branch 1 not taken.
|
63 | for (int lyr = 6; lyr >= 0; --lyr) |
| 23184 | { | ||
| 23185 | 63 | auto rpos_handle = get_rpos_handle(rpos, lyr); | |
| 23186 |
2/2✓ Branch 0 taken 9 times.
✓ Branch 1 taken 54 times.
|
63 | if (rpos_handle.ctype() == type) |
| 23187 | 9 | return rpos_handle.data(); | |
| 23188 | 54 | } | |
| 23189 | |||
| 23190 | ✗ | return -1; | |
| 23191 | 9 | } | |
| 23192 | |||
| 23193 | typedef word spot_t; | ||
| 23194 | static std::vector<int32_t> typeMap; | ||
| 23195 | static std::vector<int32_t> customTypeMap; | ||
| 23196 | static std::vector<int32_t> istrig; | ||
| 23197 | // static std::map<int32_t, std::map<size_t, word>> MAPS_prism_dir_seen_map; | ||
| 23198 | static rpos_t beam_hero_rpos = rpos_t::None; | ||
| 23199 | static const int32_t SPTYPE_SOLID = -1; | ||
| 23200 | enum | ||
| 23201 | { | ||
| 23202 | beamoffs_gr, beamoffs_up, beamoffs_down, beamoffs_left, beamoffs_right, | ||
| 23203 | beamoffs_uleft, beamoffs_uright, beamoffs_dleft, beamoffs_dright, beamoffs_vert, | ||
| 23204 | beamoffs_horz, beamoffs_notup, beamoffs_notdown, beamoffs_notleft, beamoffs_notright, | ||
| 23205 | beamoffs_all, beamoffs_max | ||
| 23206 | }; | ||
| 23207 | struct lightbeam_xy | ||
| 23208 | { | ||
| 23209 | int16_t x; | ||
| 23210 | int16_t y; | ||
| 23211 | ✗ | lightbeam_xy(int32_t nx, int32_t ny) | |
| 23212 | { | ||
| 23213 | ✗ | x = vbound(nx,-32768,32767); | |
| 23214 | ✗ | y = vbound(ny,-32768,32767); | |
| 23215 | ✗ | } | |
| 23216 | ✗ | lightbeam_xy(dword ffpos) | |
| 23217 | { | ||
| 23218 | ✗ | x = int16_t(ffpos >> 16); | |
| 23219 | ✗ | y = int16_t(ffpos & 0xFFFF); | |
| 23220 | ✗ | } | |
| 23221 | ✗ | bool valid() const | |
| 23222 | { | ||
| 23223 | ✗ | return valid(x,y); | |
| 23224 | } | ||
| 23225 | void bound() | ||
| 23226 | { | ||
| 23227 | x = vbound(x,0-16,world_w-1+16); | ||
| 23228 | y = vbound(y,0-16,world_h-1+16); | ||
| 23229 | } | ||
| 23230 | ✗ | dword ffpos() const | |
| 23231 | { | ||
| 23232 | ✗ | return (word(x)<<16)|word(y&0xFFFF); | |
| 23233 | } | ||
| 23234 | ✗ | rpos_t pos() const | |
| 23235 | { | ||
| 23236 | ✗ | return COMBOPOS_REGION(vbound(x,0,world_w-1),vbound(y,0,world_h-1)); | |
| 23237 | } | ||
| 23238 | ✗ | bool herocollide(byte beamwid) | |
| 23239 | { | ||
| 23240 | ✗ | int bx = x-beamwid/2, by = y-beamwid/2; | |
| 23241 | ✗ | int hx = Hero.x.getInt(), hy = Hero.y.getInt(); | |
| 23242 | ✗ | return hx+15 >= bx && hx < bx+beamwid | |
| 23243 | ✗ | && hy+15 >= by && hy < by+beamwid; | |
| 23244 | } | ||
| 23245 | ✗ | static bool valid(int32_t x, int32_t y) | |
| 23246 | { | ||
| 23247 | ✗ | return x+16 >= 0 && x-16 < world_w && y+16 >= 0 && y-16 < world_h; | |
| 23248 | } | ||
| 23249 | }; | ||
| 23250 | #define SP_VISITED 0x1 | ||
| 23251 | #define SP_FLAGS 0x01E | ||
| 23252 | #define SP_GOFLAGS 0x1E0 | ||
| 23253 | #define SP_MASK (SP_VISITED|SP_FLAGS) | ||
| 23254 | #define SP_FLAG(dir) (0x2<<dir) | ||
| 23255 | #define SP_GOFLAG(dir) (0x20<<dir) | ||
| 23256 | #define BEAM_AGE_LIMIT 512 | ||
| 23257 | |||
| 23258 | 14283 | static void handleBeam(spot_t* grid, size_t age, byte spotdir, rpos_t rpos, byte set, bool block, bool refl) | |
| 23259 | { | ||
| 23260 |
2/2✓ Branch 0 taken 7620 times.
✓ Branch 1 taken 6663 times.
|
14283 | if(spotdir > 3) return; //invalid dir |
| 23261 | |||
| 23262 | 6663 | int combos_wide = cur_region.screen_width * 16; | |
| 23263 | 6663 | int combos_tall = cur_region.screen_height * 11; | |
| 23264 |
2/2✓ Branch 0 taken 5429 times.
✓ Branch 1 taken 1234 times.
|
6663 | int32_t trigflag = set ? (1 << (set-1)) : ~0; |
| 23265 | 6663 | bool doAge = true; | |
| 23266 | 6663 | spot_t f = 0; | |
| 23267 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 70632 times.
|
70632 | while (rpos < region_max_rpos) |
| 23268 | { | ||
| 23269 | 140809 | auto [x, y] = COMBOXY_REGION_INDEX(rpos); | |
| 23270 | |||
| 23271 | 70632 | f = SP_GOFLAG(spotdir); | |
| 23272 |
2/2✓ Branch 0 taken 70177 times.
✓ Branch 1 taken 455 times.
|
70632 | if((grid[(int)rpos] & f) == f) |
| 23273 | 455 | return; | |
| 23274 | 70177 | else grid[(int)rpos] |= f; | |
| 23275 | 70177 | f = SP_FLAG(spotdir); | |
| 23276 |
2/2✓ Branch 0 taken 153 times.
✓ Branch 1 taken 70024 times.
|
70177 | if((grid[(int)rpos] & f) != f) |
| 23277 | { | ||
| 23278 | 70024 | grid[(int)rpos] |= f; | |
| 23279 | 70024 | istrig[(int)rpos] |= trigflag; | |
| 23280 | 70024 | doAge = false; | |
| 23281 | 70024 | age = 0; | |
| 23282 | 70024 | } | |
| 23283 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 16931 times.
✓ Branch 2 taken 9603 times.
✓ Branch 3 taken 23595 times.
✓ Branch 4 taken 20048 times.
|
70177 | switch(spotdir) |
| 23284 | { | ||
| 23285 | case up: | ||
| 23286 | 16931 | y -= 1; | |
| 23287 | 16931 | break; | |
| 23288 | case down: | ||
| 23289 | 9603 | y += 1; | |
| 23290 | 9603 | break; | |
| 23291 | case left: | ||
| 23292 | 23595 | x -= 1; | |
| 23293 | 23595 | break; | |
| 23294 | case right: | ||
| 23295 | 20048 | x += 1; | |
| 23296 | 20048 | break; | |
| 23297 | } | ||
| 23298 | |||
| 23299 |
4/8✓ Branch 0 taken 70177 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 70177 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 70177 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 70177 times.
|
70177 | if (!(x >= 0 && x < combos_wide && y >= 0 && y < combos_tall)) return; |
| 23300 | |||
| 23301 | 140354 | rpos = COMBOPOS_REGION_INDEX(x, y); | |
| 23302 | |||
| 23303 |
2/2✓ Branch 0 taken 6208 times.
✓ Branch 1 taken 63969 times.
|
70177 | switch (typeMap[(int)rpos]) |
| 23304 | { | ||
| 23305 | case SPTYPE_SOLID: case cBLOCKALL: | ||
| 23306 | 6208 | return; | |
| 23307 | } | ||
| 23308 | |||
| 23309 |
3/6✓ Branch 0 taken 875 times.
✓ Branch 1 taken 63094 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 875 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
63969 | if (rpos == beam_hero_rpos && block && spotdir == oppositeDir[Hero.getDir()]) |
| 23310 | ✗ | return; | |
| 23311 | |||
| 23312 | 63969 | f = SP_FLAG(oppositeDir[spotdir]); | |
| 23313 |
2/2✓ Branch 0 taken 153 times.
✓ Branch 1 taken 63816 times.
|
63969 | if((grid[(int)rpos] & f) != f) |
| 23314 | { | ||
| 23315 | 63816 | grid[(int)rpos] |= f; | |
| 23316 | 63816 | istrig[(int)rpos] |= trigflag; | |
| 23317 | 63816 | doAge = false; | |
| 23318 | 63816 | age = 0; | |
| 23319 | 63816 | } | |
| 23320 |
2/2✓ Branch 0 taken 153 times.
✓ Branch 1 taken 63816 times.
|
63969 | if(doAge) |
| 23321 | { | ||
| 23322 |
1/2✓ Branch 0 taken 153 times.
✗ Branch 1 not taken.
|
153 | if(++age > BEAM_AGE_LIMIT) |
| 23323 | ✗ | return; | |
| 23324 | 153 | } | |
| 23325 | 63816 | else doAge = true; | |
| 23326 | |||
| 23327 |
4/4✓ Branch 0 taken 875 times.
✓ Branch 1 taken 63094 times.
✓ Branch 2 taken 147 times.
✓ Branch 3 taken 728 times.
|
63969 | if (rpos == beam_hero_rpos && refl) |
| 23328 | 728 | spotdir = Hero.getDir(); | |
| 23329 |
4/8✗ Branch 0 not taken.
✓ Branch 1 taken 9088 times.
✓ Branch 2 taken 7781 times.
✓ Branch 3 taken 46363 times.
✓ Branch 4 taken 9 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
63241 | else switch (typeMap[(int)rpos]) |
| 23330 | { | ||
| 23331 | case cLIGHTTARGET: | ||
| 23332 | { | ||
| 23333 | 9 | int cid = beamGrabComboFromPos(rpos, cLIGHTTARGET); | |
| 23334 |
2/4✓ Branch 0 taken 9 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 9 times.
✗ Branch 3 not taken.
|
9 | if(cid > -1 && combobuf[cid].usrflags&cflag3) //Blocks light |
| 23335 | ✗ | return; | |
| 23336 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 6 times.
|
9 | if(get_qr(qr_BROKEN_LIGHTBEAM_HITBOX)) |
| 23337 | 6 | spotdir = oppositeDir[spotdir]; | |
| 23338 | 9 | break; | |
| 23339 | } | ||
| 23340 | case cMIRROR: | ||
| 23341 | ✗ | spotdir = oppositeDir[spotdir]; | |
| 23342 | ✗ | break; | |
| 23343 | case cMIRRORSLASH: | ||
| 23344 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 2991 times.
✓ Branch 2 taken 3402 times.
✓ Branch 3 taken 1726 times.
✓ Branch 4 taken 969 times.
|
9088 | switch(spotdir) |
| 23345 | { | ||
| 23346 | case up: | ||
| 23347 | 2991 | spotdir = right; break; | |
| 23348 | case right: | ||
| 23349 | 3402 | spotdir = up; break; | |
| 23350 | case down: | ||
| 23351 | 1726 | spotdir = left; break; | |
| 23352 | case left: | ||
| 23353 | 969 | spotdir = down; break; | |
| 23354 | } | ||
| 23355 | 9088 | break; | |
| 23356 | case cMIRRORBACKSLASH: | ||
| 23357 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 1927 times.
✓ Branch 2 taken 1814 times.
✓ Branch 3 taken 1522 times.
✓ Branch 4 taken 2518 times.
|
7781 | switch(spotdir) |
| 23358 | { | ||
| 23359 | case up: | ||
| 23360 | 1927 | spotdir = left; break; | |
| 23361 | case left: | ||
| 23362 | 1814 | spotdir = up; break; | |
| 23363 | case down: | ||
| 23364 | 1522 | spotdir = right; break; | |
| 23365 | case right: | ||
| 23366 | 2518 | spotdir = down; break; | |
| 23367 | } | ||
| 23368 | 7781 | break; | |
| 23369 | case cMAGICPRISM: | ||
| 23370 | ✗ | for(byte d = 0; d < 4; ++d) | |
| 23371 | { | ||
| 23372 | ✗ | if(d == oppositeDir[spotdir]) continue; | |
| 23373 | ✗ | handleBeam(grid, age, d, rpos, set, block, refl); | |
| 23374 | ✗ | } | |
| 23375 | ✗ | return; | |
| 23376 | case cMAGICPRISM4: | ||
| 23377 | ✗ | for(byte d = 0; d < 4; ++d) | |
| 23378 | { | ||
| 23379 | ✗ | handleBeam(grid, age, d, rpos, set, block, refl); | |
| 23380 | ✗ | } | |
| 23381 | ✗ | return; | |
| 23382 | case cMIRRORNEW: | ||
| 23383 | { | ||
| 23384 | ✗ | auto cid = customTypeMap[(int)rpos]; | |
| 23385 | ✗ | if(unsigned(cid) >= MAXCOMBOS) break; | |
| 23386 | ✗ | newcombo const& cmb = combobuf[cid]; | |
| 23387 | ✗ | byte newdir = cmb.attribytes[spotdir]; | |
| 23388 | ✗ | if(newdir > 7) return; | |
| 23389 | ✗ | if(newdir > 3) break; | |
| 23390 | ✗ | spotdir = newdir; | |
| 23391 | ✗ | break; | |
| 23392 | } | ||
| 23393 | } | ||
| 23394 | } | ||
| 23395 | 14283 | } | |
| 23396 | |||
| 23397 | ✗ | static void handleFFBeam(std::map<dword,spot_t>& grid, size_t age, byte spotdir, lightbeam_xy curxy, byte set, bool block, bool refl, byte beamwid) | |
| 23398 | { | ||
| 23399 | ✗ | if(spotdir > 3) return; //invalid dir | |
| 23400 | ✗ | int32_t trigflag = set ? (1 << (set-1)) : ~0; | |
| 23401 | ✗ | bool doAge = true; | |
| 23402 | ✗ | byte f = 0; | |
| 23403 | ✗ | while(curxy.valid()) | |
| 23404 | { | ||
| 23405 | ✗ | f = SP_FLAG(spotdir); | |
| 23406 | ✗ | if((grid[curxy.ffpos()] & f) != f) | |
| 23407 | { | ||
| 23408 | ✗ | grid[curxy.ffpos()] |= f; | |
| 23409 | ✗ | istrig[(int)curxy.pos()] |= trigflag; | |
| 23410 | ✗ | doAge = false; | |
| 23411 | ✗ | age = 0; | |
| 23412 | ✗ | } | |
| 23413 | ✗ | switch(spotdir) | |
| 23414 | { | ||
| 23415 | case up: | ||
| 23416 | ✗ | curxy.y -= 16; | |
| 23417 | ✗ | break; | |
| 23418 | case down: | ||
| 23419 | ✗ | curxy.y += 16; | |
| 23420 | ✗ | break; | |
| 23421 | case left: | ||
| 23422 | ✗ | curxy.x -= 16; | |
| 23423 | ✗ | break; | |
| 23424 | case right: | ||
| 23425 | ✗ | curxy.x += 16; | |
| 23426 | ✗ | break; | |
| 23427 | } | ||
| 23428 | ✗ | auto curpos = curxy.pos(); | |
| 23429 | ✗ | switch(typeMap[(int)curpos]) | |
| 23430 | { | ||
| 23431 | case SPTYPE_SOLID: case cBLOCKALL: | ||
| 23432 | ✗ | return; | |
| 23433 | case cMIRRORNEW: | ||
| 23434 | { | ||
| 23435 | ✗ | auto cid = customTypeMap[(int)curpos]; | |
| 23436 | ✗ | if(unsigned(cid) >= MAXCOMBOS) break; | |
| 23437 | ✗ | newcombo const& cmb = combobuf[cid]; | |
| 23438 | ✗ | byte newdir = cmb.attribytes[spotdir]; | |
| 23439 | ✗ | if(newdir > 7) return; | |
| 23440 | ✗ | break; | |
| 23441 | } | ||
| 23442 | } | ||
| 23443 | ✗ | bool collided_hero = beam_hero_rpos != rpos_t::None && curxy.herocollide(beamwid); | |
| 23444 | ✗ | if(block && (spotdir == oppositeDir[Hero.getDir()]) && collided_hero) | |
| 23445 | ✗ | return; | |
| 23446 | |||
| 23447 | ✗ | f = SP_FLAG(oppositeDir[spotdir]); | |
| 23448 | ✗ | if((grid[curxy.ffpos()] & f) != f) | |
| 23449 | { | ||
| 23450 | ✗ | grid[curxy.ffpos()] |= f; | |
| 23451 | ✗ | istrig[(int)curpos] |= trigflag; | |
| 23452 | ✗ | doAge = false; | |
| 23453 | ✗ | age = 0; | |
| 23454 | ✗ | } | |
| 23455 | ✗ | if(!curxy.valid()) return; | |
| 23456 | ✗ | if(doAge) | |
| 23457 | { | ||
| 23458 | ✗ | if(++age > BEAM_AGE_LIMIT) | |
| 23459 | ✗ | return; | |
| 23460 | ✗ | } | |
| 23461 | ✗ | else doAge = true; | |
| 23462 | |||
| 23463 | ✗ | if(refl && collided_hero) | |
| 23464 | ✗ | spotdir = Hero.getDir(); | |
| 23465 | ✗ | else switch(typeMap[(int)curpos]) | |
| 23466 | { | ||
| 23467 | case cLIGHTTARGET: | ||
| 23468 | { | ||
| 23469 | ✗ | int cid = beamGrabComboFromPos(curpos, cLIGHTTARGET); | |
| 23470 | ✗ | if(cid > -1 && combobuf[cid].usrflags&cflag3) //Blocks light | |
| 23471 | ✗ | return; | |
| 23472 | ✗ | if(get_qr(qr_BROKEN_LIGHTBEAM_HITBOX)) | |
| 23473 | ✗ | spotdir = oppositeDir[spotdir]; | |
| 23474 | ✗ | break; | |
| 23475 | } | ||
| 23476 | case cMIRROR: | ||
| 23477 | ✗ | spotdir = oppositeDir[spotdir]; | |
| 23478 | ✗ | break; | |
| 23479 | case cMIRRORSLASH: | ||
| 23480 | ✗ | switch(spotdir) | |
| 23481 | { | ||
| 23482 | case up: | ||
| 23483 | ✗ | spotdir = right; break; | |
| 23484 | case right: | ||
| 23485 | ✗ | spotdir = up; break; | |
| 23486 | case down: | ||
| 23487 | ✗ | spotdir = left; break; | |
| 23488 | case left: | ||
| 23489 | ✗ | spotdir = down; break; | |
| 23490 | } | ||
| 23491 | ✗ | break; | |
| 23492 | case cMIRRORBACKSLASH: | ||
| 23493 | ✗ | switch(spotdir) | |
| 23494 | { | ||
| 23495 | case up: | ||
| 23496 | ✗ | spotdir = left; break; | |
| 23497 | case left: | ||
| 23498 | ✗ | spotdir = up; break; | |
| 23499 | case down: | ||
| 23500 | ✗ | spotdir = right; break; | |
| 23501 | case right: | ||
| 23502 | ✗ | spotdir = down; break; | |
| 23503 | } | ||
| 23504 | ✗ | break; | |
| 23505 | case cMAGICPRISM: | ||
| 23506 | ✗ | for(byte d = 0; d < 4; ++d) | |
| 23507 | { | ||
| 23508 | ✗ | if(d == oppositeDir[spotdir]) continue; | |
| 23509 | ✗ | handleFFBeam(grid, age, d, curxy, set, block, refl, beamwid); | |
| 23510 | ✗ | } | |
| 23511 | ✗ | return; | |
| 23512 | case cMAGICPRISM4: | ||
| 23513 | ✗ | for(byte d = 0; d < 4; ++d) | |
| 23514 | { | ||
| 23515 | ✗ | handleFFBeam(grid, age, d, curxy, set, block, refl, beamwid); | |
| 23516 | ✗ | } | |
| 23517 | ✗ | return; | |
| 23518 | case cMIRRORNEW: | ||
| 23519 | { | ||
| 23520 | ✗ | auto cid = customTypeMap[(int)curpos]; | |
| 23521 | ✗ | if(unsigned(cid) >= MAXCOMBOS) break; | |
| 23522 | ✗ | newcombo const& cmb = combobuf[cid]; | |
| 23523 | ✗ | byte newdir = cmb.attribytes[spotdir]; | |
| 23524 | ✗ | if(newdir > 3) break; | |
| 23525 | ✗ | spotdir = newdir; | |
| 23526 | ✗ | break; | |
| 23527 | } | ||
| 23528 | } | ||
| 23529 | } | ||
| 23530 | ✗ | } | |
| 23531 | |||
| 23532 | #define BEAMID_COLOR0 (1<<24) //must have rightmost 24 bits empty | ||
| 23533 | 14283 | static int get_beamid(newcombo const& cmb) | |
| 23534 | { | ||
| 23535 | //Positive ID is a tile, negative is a color trio. 0 is nil in either case. | ||
| 23536 |
2/2✓ Branch 0 taken 1234 times.
✓ Branch 1 taken 13049 times.
|
14283 | if(cmb.usrflags&cflag1) //use tile/cset style |
| 23537 | 1234 | return std::max(0,cmb.attributes[0]/10000)|(cmb.attribytes[1]%12)<<24; | |
| 23538 | else //use 3-color style | ||
| 23539 | { | ||
| 23540 | 13049 | auto id = -((cmb.attribytes[3]<<16)|(cmb.attribytes[2]<<8)|(cmb.attribytes[1])); | |
| 23541 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 13049 times.
|
13049 | if(!id) //0 would clash with the tile/cset style |
| 23542 | ✗ | id = BEAMID_COLOR0; | |
| 23543 | 13049 | return id; | |
| 23544 | } | ||
| 23545 | 14283 | } | |
| 23546 | 14283 | static bool launch_lightbeam(const rpos_handle_t& rpos_handle, std::map<int32_t, spot_t*>& maps, bool refl, bool block) | |
| 23547 | { | ||
| 23548 | 14283 | auto& cmb = rpos_handle.combo(); | |
| 23549 | 14283 | int32_t id = get_beamid(cmb); | |
| 23550 | //Get the grid array for this tile/color | ||
| 23551 | spot_t* grid; | ||
| 23552 |
1/2✓ Branch 0 taken 14283 times.
✗ Branch 1 not taken.
|
14283 | if(maps[id]) |
| 23553 | ✗ | grid = maps[id]; | |
| 23554 | else | ||
| 23555 | { | ||
| 23556 | 14283 | maps[id] = grid = new spot_t[region_num_rpos]; | |
| 23557 | 14283 | memset(grid, 0, sizeof(spot_t)*region_num_rpos); | |
| 23558 | } | ||
| 23559 | 14283 | byte spotdir = cmb.attribytes[0]; | |
| 23560 |
2/2✓ Branch 0 taken 3861 times.
✓ Branch 1 taken 10422 times.
|
14283 | if(spotdir > 3) |
| 23561 | { | ||
| 23562 | 10422 | grid[(int)rpos_handle.rpos] |= SP_VISITED; | |
| 23563 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10422 times.
|
10422 | istrig[(int)rpos_handle.rpos] |= cmb.attribytes[4] ? (1 << (cmb.attribytes[4]-1)) : ~0; |
| 23564 | 10422 | } | |
| 23565 |
4/4✓ Branch 0 taken 10892 times.
✓ Branch 1 taken 3391 times.
✓ Branch 2 taken 8090 times.
✓ Branch 3 taken 2802 times.
|
14283 | if(refl && rpos_handle.rpos == beam_hero_rpos) |
| 23566 | { | ||
| 23567 | 2802 | spotdir = Hero.getDir(); | |
| 23568 | 2802 | } | |
| 23569 | 14283 | handleBeam(grid, 0, spotdir, rpos_handle.rpos, cmb.attribytes[4], block, refl); | |
| 23570 | 14283 | return true; | |
| 23571 | } | ||
| 23572 | |||
| 23573 | ✗ | static bool launch_fflightbeam(ffcdata const& ffc, | |
| 23574 | std::map<int32_t, std::map<dword,spot_t>>& ffmaps, bool refl, bool block) | ||
| 23575 | { | ||
| 23576 | ✗ | newcombo const& cmb = combobuf[ffc.data]; | |
| 23577 | ✗ | int32_t id = get_beamid(cmb); | |
| 23578 | //Get the grid array for this tile/color | ||
| 23579 | ✗ | std::map<dword,spot_t>& grid = ffmaps[id]; // grid of (x<<16)|(y&0xFFFF) | |
| 23580 | ✗ | byte spotdir = cmb.attribytes[0]; | |
| 23581 | ✗ | lightbeam_xy sxy(ffc.x+(ffc.hit_width/2), ffc.y+(ffc.hit_height/2)); | |
| 23582 | ✗ | if(spotdir > 3 && sxy.valid()) | |
| 23583 | { | ||
| 23584 | ✗ | grid[sxy.ffpos()] |= SP_VISITED; | |
| 23585 | ✗ | int32_t trigflag = cmb.attribytes[4] ? (1 << (cmb.attribytes[4]-1)) : ~0; | |
| 23586 | ✗ | istrig[(int)sxy.pos()] |= trigflag; | |
| 23587 | ✗ | } | |
| 23588 | ✗ | auto beamwid = cmb.attribytes[5] < 1 ? 8 : cmb.attribytes[5]; | |
| 23589 | ✗ | if(refl && beam_hero_rpos != rpos_t::None && sxy.herocollide(beamwid)) | |
| 23590 | { | ||
| 23591 | ✗ | spotdir = Hero.getDir(); | |
| 23592 | ✗ | } | |
| 23593 | ✗ | switch(spotdir) | |
| 23594 | { | ||
| 23595 | case up: | ||
| 23596 | ✗ | sxy.y = zc_min(world_h-1,sxy.y); | |
| 23597 | ✗ | break; | |
| 23598 | case down: | ||
| 23599 | ✗ | sxy.y = zc_max(0,sxy.y); | |
| 23600 | ✗ | break; | |
| 23601 | case left: | ||
| 23602 | ✗ | sxy.x = zc_min(world_w-1,sxy.x); | |
| 23603 | ✗ | break; | |
| 23604 | case right: | ||
| 23605 | ✗ | sxy.x = zc_max(0,sxy.x); | |
| 23606 | ✗ | break; | |
| 23607 | } | ||
| 23608 | ✗ | handleFFBeam(grid, 0, spotdir, sxy, cmb.attribytes[4], block, refl, beamwid); | |
| 23609 | ✗ | return true; | |
| 23610 | } | ||
| 23611 | |||
| 23612 | 14283 | static BITMAP* generate_beam_bitmap(int32_t id) | |
| 23613 | { | ||
| 23614 | 14283 | BITMAP* cbmp = create_bitmap_ex(8, 16*beamoffs_max, 16); | |
| 23615 | 14283 | clear_bitmap(cbmp); | |
| 23616 |
3/4✓ Branch 0 taken 1234 times.
✓ Branch 1 taken 13049 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1234 times.
|
14283 | if(id < 0 || id == BEAMID_COLOR0) |
| 23617 | { | ||
| 23618 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 13049 times.
|
13049 | int cid = (id == BEAMID_COLOR0) ? 0 : abs(id); |
| 23619 | 13049 | byte c_inner = (cid & 0x0000FF); | |
| 23620 | 13049 | byte c_middle = (cid & 0x00FF00)>>8; | |
| 23621 | 13049 | byte c_outter = (cid & 0xFF0000)>>16; | |
| 23622 |
2/2✓ Branch 0 taken 195735 times.
✓ Branch 1 taken 13049 times.
|
208784 | for(size_t q = 1; q < beamoffs_max; ++q) |
| 23623 | { | ||
| 23624 | 195735 | circlefill(cbmp, 16*q+8, 8, 3, c_outter); | |
| 23625 | 195735 | circlefill(cbmp, 16*q+7, 8, 3, c_outter); | |
| 23626 | 195735 | circlefill(cbmp, 16*q+8, 7, 3, c_outter); | |
| 23627 | 195735 | circlefill(cbmp, 16*q+7, 7, 3, c_outter); | |
| 23628 | 195735 | circlefill(cbmp, 16*q+8, 8, 1, c_middle); | |
| 23629 | 195735 | circlefill(cbmp, 16*q+7, 8, 1, c_middle); | |
| 23630 | 195735 | circlefill(cbmp, 16*q+8, 7, 1, c_middle); | |
| 23631 | 195735 | circlefill(cbmp, 16*q+7, 7, 1, c_middle); | |
| 23632 | 195735 | circlefill(cbmp, 16*q+8, 8, 0, c_inner); | |
| 23633 | 195735 | circlefill(cbmp, 16*q+7, 8, 0, c_inner); | |
| 23634 | 195735 | circlefill(cbmp, 16*q+8, 7, 0, c_inner); | |
| 23635 | 195735 | circlefill(cbmp, 16*q+7, 7, 0, c_inner); | |
| 23636 | 195735 | } | |
| 23637 | //beamoffs_gr | ||
| 23638 | 13049 | circlefill(cbmp, 16*beamoffs_gr+8, 8, 7, c_outter); | |
| 23639 | 13049 | circlefill(cbmp, 16*beamoffs_gr+7, 8, 7, c_outter); | |
| 23640 | 13049 | circlefill(cbmp, 16*beamoffs_gr+8, 7, 7, c_outter); | |
| 23641 | 13049 | circlefill(cbmp, 16*beamoffs_gr+7, 7, 7, c_outter); | |
| 23642 | 13049 | circlefill(cbmp, 16*beamoffs_gr+8, 8, 5, c_middle); | |
| 23643 | 13049 | circlefill(cbmp, 16*beamoffs_gr+7, 8, 5, c_middle); | |
| 23644 | 13049 | circlefill(cbmp, 16*beamoffs_gr+8, 7, 5, c_middle); | |
| 23645 | 13049 | circlefill(cbmp, 16*beamoffs_gr+7, 7, 5, c_middle); | |
| 23646 | 13049 | circlefill(cbmp, 16*beamoffs_gr+8, 8, 3, c_inner); | |
| 23647 | 13049 | circlefill(cbmp, 16*beamoffs_gr+7, 8, 3, c_inner); | |
| 23648 | 13049 | circlefill(cbmp, 16*beamoffs_gr+8, 7, 3, c_inner); | |
| 23649 | 13049 | circlefill(cbmp, 16*beamoffs_gr+7, 7, 3, c_inner); | |
| 23650 | //beamoffs_up | ||
| 23651 | 13049 | rectfill(cbmp, 16*beamoffs_up+4, 0, 16*beamoffs_up+11, 7, c_outter); | |
| 23652 | 13049 | rectfill(cbmp, 16*beamoffs_up+6, 0, 16*beamoffs_up+9, 7, c_middle); | |
| 23653 | 13049 | rectfill(cbmp, 16*beamoffs_up+7, 0, 16*beamoffs_up+8, 7, c_inner); | |
| 23654 | //beamoffs_down | ||
| 23655 | 13049 | rectfill(cbmp, 16*beamoffs_down+4, 8, 16*beamoffs_down+11, 15, c_outter); | |
| 23656 | 13049 | rectfill(cbmp, 16*beamoffs_down+6, 8, 16*beamoffs_down+9, 15, c_middle); | |
| 23657 | 13049 | rectfill(cbmp, 16*beamoffs_down+7, 8, 16*beamoffs_down+8, 15, c_inner); | |
| 23658 | //beamoffs_left | ||
| 23659 | 13049 | rectfill(cbmp, 16*beamoffs_left, 4, 16*beamoffs_left+7, 11, c_outter); | |
| 23660 | 13049 | rectfill(cbmp, 16*beamoffs_left, 6, 16*beamoffs_left+7, 9, c_middle); | |
| 23661 | 13049 | rectfill(cbmp, 16*beamoffs_left, 7, 16*beamoffs_left+7, 8, c_inner); | |
| 23662 | //beamoffs_right | ||
| 23663 | 13049 | rectfill(cbmp, 16*beamoffs_right+8, 4, 16*beamoffs_right+15, 11, c_outter); | |
| 23664 | 13049 | rectfill(cbmp, 16*beamoffs_right+8, 6, 16*beamoffs_right+15, 9, c_middle); | |
| 23665 | 13049 | rectfill(cbmp, 16*beamoffs_right+8, 7, 16*beamoffs_right+15, 8, c_inner); | |
| 23666 | //beamoffs_uleft | ||
| 23667 | 13049 | rectfill(cbmp, 16*beamoffs_uleft+4, 0, 16*beamoffs_uleft+11, 7, c_outter); | |
| 23668 | 13049 | rectfill(cbmp, 16*beamoffs_uleft, 4, 16*beamoffs_uleft+7, 11, c_outter); | |
| 23669 | 13049 | rectfill(cbmp, 16*beamoffs_uleft, 6, 16*beamoffs_uleft+7, 9, c_middle); | |
| 23670 | 13049 | rectfill(cbmp, 16*beamoffs_uleft+6, 0, 16*beamoffs_uleft+9, 7, c_middle); | |
| 23671 | 13049 | rectfill(cbmp, 16*beamoffs_uleft+7, 0, 16*beamoffs_uleft+8, 7, c_inner); | |
| 23672 | 13049 | rectfill(cbmp, 16*beamoffs_uleft, 7, 16*beamoffs_uleft+7, 8, c_inner); | |
| 23673 | //beamoffs_uright | ||
| 23674 | 13049 | rectfill(cbmp, 16*beamoffs_uright+4, 0, 16*beamoffs_uright+11, 7, c_outter); | |
| 23675 | 13049 | rectfill(cbmp, 16*beamoffs_uright+8, 4, 16*beamoffs_uright+15, 11, c_outter); | |
| 23676 | 13049 | rectfill(cbmp, 16*beamoffs_uright+8, 6, 16*beamoffs_uright+15, 9, c_middle); | |
| 23677 | 13049 | rectfill(cbmp, 16*beamoffs_uright+6, 0, 16*beamoffs_uright+9, 7, c_middle); | |
| 23678 | 13049 | rectfill(cbmp, 16*beamoffs_uright+7, 0, 16*beamoffs_uright+8, 7, c_inner); | |
| 23679 | 13049 | rectfill(cbmp, 16*beamoffs_uright+8, 7, 16*beamoffs_uright+15, 8, c_inner); | |
| 23680 | //beamoffs_dleft | ||
| 23681 | 13049 | rectfill(cbmp, 16*beamoffs_dleft+4, 8, 16*beamoffs_dleft+11, 15, c_outter); | |
| 23682 | 13049 | rectfill(cbmp, 16*beamoffs_dleft, 4, 16*beamoffs_dleft+7, 11, c_outter); | |
| 23683 | 13049 | rectfill(cbmp, 16*beamoffs_dleft, 6, 16*beamoffs_dleft+7, 9, c_middle); | |
| 23684 | 13049 | rectfill(cbmp, 16*beamoffs_dleft+6, 8, 16*beamoffs_dleft+9, 15, c_middle); | |
| 23685 | 13049 | rectfill(cbmp, 16*beamoffs_dleft+7, 8, 16*beamoffs_dleft+8, 15, c_inner); | |
| 23686 | 13049 | rectfill(cbmp, 16*beamoffs_dleft, 7, 16*beamoffs_dleft+7, 8, c_inner); | |
| 23687 | //beamoffs_dright | ||
| 23688 | 13049 | rectfill(cbmp, 16*beamoffs_dright+4, 8, 16*beamoffs_dright+11, 15, c_outter); | |
| 23689 | 13049 | rectfill(cbmp, 16*beamoffs_dright+8, 4, 16*beamoffs_dright+15, 11, c_outter); | |
| 23690 | 13049 | rectfill(cbmp, 16*beamoffs_dright+8, 6, 16*beamoffs_dright+15, 9, c_middle); | |
| 23691 | 13049 | rectfill(cbmp, 16*beamoffs_dright+6, 8, 16*beamoffs_dright+9, 15, c_middle); | |
| 23692 | 13049 | rectfill(cbmp, 16*beamoffs_dright+7, 8, 16*beamoffs_dright+8, 15, c_inner); | |
| 23693 | 13049 | rectfill(cbmp, 16*beamoffs_dright+8, 7, 16*beamoffs_dright+15, 8, c_inner); | |
| 23694 | //beamoffs_vert | ||
| 23695 | 13049 | rectfill(cbmp, 16*beamoffs_vert+4, 0, 16*beamoffs_vert+11, 15, c_outter); | |
| 23696 | 13049 | rectfill(cbmp, 16*beamoffs_vert+6, 0, 16*beamoffs_vert+9, 15, c_middle); | |
| 23697 | 13049 | rectfill(cbmp, 16*beamoffs_vert+7, 0, 16*beamoffs_vert+8, 15, c_inner); | |
| 23698 | //beamoffs_horz | ||
| 23699 | 13049 | rectfill(cbmp, 16*beamoffs_horz, 4, 16*beamoffs_horz+15, 11, c_outter); | |
| 23700 | 13049 | rectfill(cbmp, 16*beamoffs_horz, 6, 16*beamoffs_horz+15, 9, c_middle); | |
| 23701 | 13049 | rectfill(cbmp, 16*beamoffs_horz, 7, 16*beamoffs_horz+15, 8, c_inner); | |
| 23702 | //beamoffs_notup | ||
| 23703 | 13049 | rectfill(cbmp, 16*beamoffs_notup, 4, 16*beamoffs_notup+15, 11, c_outter); | |
| 23704 | 13049 | rectfill(cbmp, 16*beamoffs_notup+4, 8, 16*beamoffs_notup+11, 15, c_outter); | |
| 23705 | 13049 | rectfill(cbmp, 16*beamoffs_notup+6, 8, 16*beamoffs_notup+9, 15, c_middle); | |
| 23706 | 13049 | rectfill(cbmp, 16*beamoffs_notup, 6, 16*beamoffs_notup+15, 9, c_middle); | |
| 23707 | 13049 | rectfill(cbmp, 16*beamoffs_notup, 7, 16*beamoffs_notup+15, 8, c_inner); | |
| 23708 | 13049 | rectfill(cbmp, 16*beamoffs_notup+7, 8, 16*beamoffs_notup+8, 15, c_inner); | |
| 23709 | //beamoffs_notdown | ||
| 23710 | 13049 | rectfill(cbmp, 16*beamoffs_notdown, 4, 16*beamoffs_notdown+15, 11, c_outter); | |
| 23711 | 13049 | rectfill(cbmp, 16*beamoffs_notdown+4, 0, 16*beamoffs_notdown+11, 7, c_outter); | |
| 23712 | 13049 | rectfill(cbmp, 16*beamoffs_notdown+6, 0, 16*beamoffs_notdown+9, 7, c_middle); | |
| 23713 | 13049 | rectfill(cbmp, 16*beamoffs_notdown, 6, 16*beamoffs_notdown+15, 9, c_middle); | |
| 23714 | 13049 | rectfill(cbmp, 16*beamoffs_notdown, 7, 16*beamoffs_notdown+15, 8, c_inner); | |
| 23715 | 13049 | rectfill(cbmp, 16*beamoffs_notdown+7, 0, 16*beamoffs_notdown+8, 7, c_inner); | |
| 23716 | //beamoffs_notleft | ||
| 23717 | 13049 | rectfill(cbmp, 16*beamoffs_notleft+4, 0, 16*beamoffs_notleft+11, 15, c_outter); | |
| 23718 | 13049 | rectfill(cbmp, 16*beamoffs_notleft+8, 4, 16*beamoffs_notleft+15, 11, c_outter); | |
| 23719 | 13049 | rectfill(cbmp, 16*beamoffs_notleft+8, 6, 16*beamoffs_notleft+15, 9, c_middle); | |
| 23720 | 13049 | rectfill(cbmp, 16*beamoffs_notleft+6, 0, 16*beamoffs_notleft+9, 15, c_middle); | |
| 23721 | 13049 | rectfill(cbmp, 16*beamoffs_notleft+7, 0, 16*beamoffs_notleft+8, 15, c_inner); | |
| 23722 | 13049 | rectfill(cbmp, 16*beamoffs_notleft+8, 7, 16*beamoffs_notleft+15, 8, c_inner); | |
| 23723 | //beamoffs_notright | ||
| 23724 | 13049 | rectfill(cbmp, 16*beamoffs_notright+4, 0, 16*beamoffs_notright+11, 15, c_outter); | |
| 23725 | 13049 | rectfill(cbmp, 16*beamoffs_notright, 4, 16*beamoffs_notright+7, 11, c_outter); | |
| 23726 | 13049 | rectfill(cbmp, 16*beamoffs_notright, 6, 16*beamoffs_notright+7, 9, c_middle); | |
| 23727 | 13049 | rectfill(cbmp, 16*beamoffs_notright+6, 0, 16*beamoffs_notright+9, 15, c_middle); | |
| 23728 | 13049 | rectfill(cbmp, 16*beamoffs_notright+7, 0, 16*beamoffs_notright+8, 15, c_inner); | |
| 23729 | 13049 | rectfill(cbmp, 16*beamoffs_notright, 7, 16*beamoffs_notright+7, 8, c_inner); | |
| 23730 | //beamoffs_all | ||
| 23731 | 13049 | rectfill(cbmp, 16*beamoffs_all+4, 0, 16*beamoffs_all+11, 15, c_outter); | |
| 23732 | 13049 | rectfill(cbmp, 16*beamoffs_all, 4, 16*beamoffs_all+15, 11, c_outter); | |
| 23733 | 13049 | rectfill(cbmp, 16*beamoffs_all, 6, 16*beamoffs_all+15, 9, c_middle); | |
| 23734 | 13049 | rectfill(cbmp, 16*beamoffs_all+6, 0, 16*beamoffs_all+9, 15, c_middle); | |
| 23735 | 13049 | rectfill(cbmp, 16*beamoffs_all+7, 0, 16*beamoffs_all+8, 15, c_inner); | |
| 23736 | 13049 | rectfill(cbmp, 16*beamoffs_all, 7, 16*beamoffs_all+15, 8, c_inner); | |
| 23737 | 13049 | } | |
| 23738 | else | ||
| 23739 | { | ||
| 23740 | 1234 | int32_t tile = (id&0xFFFFFF); | |
| 23741 | 1234 | int32_t cs = (id>>24); | |
| 23742 |
2/2✓ Branch 0 taken 19744 times.
✓ Branch 1 taken 1234 times.
|
20978 | for(size_t q = 0; q < beamoffs_max; ++q) |
| 23743 | 19744 | puttile16(cbmp, tile+q, q*16, 0, cs, 0); | |
| 23744 | } | ||
| 23745 | 14283 | return cbmp; | |
| 23746 | } | ||
| 23747 | |||
| 23748 | 2499525 | static int32_t get_beamoffs(spot_t val) | |
| 23749 | { | ||
| 23750 |
12/17✗ Branch 0 not taken.
✓ Branch 1 taken 2430030 times.
✓ Branch 2 taken 1469 times.
✓ Branch 3 taken 1188 times.
✓ Branch 4 taken 1795 times.
✓ Branch 5 taken 1768 times.
✓ Branch 6 taken 14821 times.
✓ Branch 7 taken 31678 times.
✓ Branch 8 taken 4877 times.
✓ Branch 9 taken 3412 times.
✓ Branch 10 taken 4161 times.
✓ Branch 11 taken 3791 times.
✗ Branch 12 not taken.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✓ Branch 16 taken 535 times.
|
2499525 | switch((val&SP_MASK)>>1) |
| 23751 | { | ||
| 23752 | 2430030 | case 0: default: | |
| 23753 |
2/2✓ Branch 0 taken 7620 times.
✓ Branch 1 taken 2422410 times.
|
2430030 | if(val) |
| 23754 | 7620 | return beamoffs_gr; | |
| 23755 | 2422410 | return -1; | |
| 23756 | case 0b0001: | ||
| 23757 | 1469 | return beamoffs_up; | |
| 23758 | case 0b0010: | ||
| 23759 | 1188 | return beamoffs_down; | |
| 23760 | case 0b0100: | ||
| 23761 | 1795 | return beamoffs_left; | |
| 23762 | case 0b1000: | ||
| 23763 | 1768 | return beamoffs_right; | |
| 23764 | case 0b0011: | ||
| 23765 | 14821 | return beamoffs_vert; | |
| 23766 | case 0b1100: | ||
| 23767 | 31678 | return beamoffs_horz; | |
| 23768 | case 0b0101: | ||
| 23769 | 4877 | return beamoffs_uleft; | |
| 23770 | case 0b1001: | ||
| 23771 | 3412 | return beamoffs_uright; | |
| 23772 | case 0b0110: | ||
| 23773 | 4161 | return beamoffs_dleft; | |
| 23774 | case 0b1010: | ||
| 23775 | 3791 | return beamoffs_dright; | |
| 23776 | case 0b1110: | ||
| 23777 | ✗ | return beamoffs_notup; | |
| 23778 | case 0b1101: | ||
| 23779 | ✗ | return beamoffs_notdown; | |
| 23780 | case 0b1011: | ||
| 23781 | ✗ | return beamoffs_notleft; | |
| 23782 | case 0b0111: | ||
| 23783 | ✗ | return beamoffs_notright; | |
| 23784 | case 0b1111: | ||
| 23785 | 535 | return beamoffs_all; | |
| 23786 | } | ||
| 23787 | return -1; | ||
| 23788 | 2499525 | } | |
| 23789 | |||
| 23790 | 14835443 | void HeroClass::handleSpotlights() | |
| 23791 | { | ||
| 23792 | static bool had_spotlight = true; | ||
| 23793 |
2/2✓ Branch 0 taken 14283 times.
✓ Branch 1 taken 14821160 times.
|
14835443 | if (cpos_exists_spotlight()) |
| 23794 | { | ||
| 23795 | 14283 | istrig.clear(); | |
| 23796 | 14283 | customTypeMap.clear(); | |
| 23797 | 14283 | typeMap.clear(); | |
| 23798 | |||
| 23799 | 14283 | typeMap.resize(region_num_rpos); | |
| 23800 | 14283 | customTypeMap.resize(region_num_rpos); | |
| 23801 | 14283 | istrig.resize(region_num_rpos); | |
| 23802 | |||
| 23803 | //Store each different tile/color as grids | ||
| 23804 | 14283 | std::map<int32_t, spot_t*> maps; | |
| 23805 | 14283 | std::map<int32_t, std::map<dword, spot_t>> ffmaps; | |
| 23806 |
1/2✓ Branch 0 taken 14283 times.
✗ Branch 1 not taken.
|
14283 | int32_t shieldid = getCurrentShield(false); |
| 23807 |
2/8✓ Branch 0 taken 14283 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 14283 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
14283 | if((itemsbuf[shieldid].flags & item_flag9) && !usingActiveShield(shieldid)) |
| 23808 | ✗ | shieldid = -1; | |
| 23809 |
2/2✓ Branch 0 taken 3391 times.
✓ Branch 1 taken 10892 times.
|
14283 | bool refl = shieldid > -1 && (itemsbuf[shieldid].misc2 & sh_lightbeam); |
| 23810 |
3/4✓ Branch 0 taken 3391 times.
✓ Branch 1 taken 10892 times.
✓ Branch 2 taken 3391 times.
✗ Branch 3 not taken.
|
14283 | bool block = !refl && shieldid > -1 && (itemsbuf[shieldid].misc1 & sh_lightbeam); |
| 23811 |
3/6✓ Branch 0 taken 14283 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 14283 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 14283 times.
✗ Branch 5 not taken.
|
14283 | beam_hero_rpos = COMBOPOS_REGION_B(x.getInt()+8, y.getInt()+8); |
| 23812 | |||
| 23813 |
1/2✓ Branch 0 taken 14283 times.
✗ Branch 1 not taken.
|
14283 | clear_bitmap(lightbeam_bmp); |
| 23814 | |||
| 23815 | 14283 | bool found_any_light = false; | |
| 23816 | |||
| 23817 |
1/2✓ Branch 0 taken 14283 times.
✗ Branch 1 not taken.
|
28566 | for_every_base_screen_in_region([&](mapscr* scr, unsigned int region_scr_x, unsigned int region_scr_y) { |
| 23818 | 14283 | bool pos_has_seen_cmb[176] = {0}; | |
| 23819 | |||
| 23820 |
2/2✓ Branch 0 taken 99981 times.
✓ Branch 1 taken 14283 times.
|
114264 | for(int32_t lyr = 6; lyr >= 0; --lyr) |
| 23821 | { | ||
| 23822 | 99981 | mapscr* layer_scr = get_scr_layer(scr->screen, lyr); | |
| 23823 |
2/2✓ Branch 0 taken 17596656 times.
✓ Branch 1 taken 99981 times.
|
17696637 | for(size_t pos = 0; pos < 176; ++pos) |
| 23824 | { | ||
| 23825 |
2/2✓ Branch 0 taken 3723 times.
✓ Branch 1 taken 17592933 times.
|
17596656 | if (pos_has_seen_cmb[pos]) |
| 23826 | 3723 | continue; | |
| 23827 | |||
| 23828 | 17592933 | rpos_t rpos = POS_TO_RPOS(pos, region_scr_x, region_scr_y); | |
| 23829 | 17592933 | auto& cmb = combobuf[layer_scr->data[pos]]; | |
| 23830 | 17592933 | bool found_combo = false; | |
| 23831 |
5/6✓ Branch 0 taken 162275 times.
✓ Branch 1 taken 13142 times.
✓ Branch 2 taken 17399531 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 3702 times.
✓ Branch 5 taken 14283 times.
|
17592933 | switch(cmb.type) |
| 23832 | { | ||
| 23833 | case cMIRROR: case cMIRRORSLASH: case cMIRRORBACKSLASH: | ||
| 23834 | case cMAGICPRISM: case cMAGICPRISM4: | ||
| 23835 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 162275 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
162275 | if(!cmb.attributes[0] || (cmb.attributes[0] & sh_lightbeam)) |
| 23836 | { | ||
| 23837 | 162275 | typeMap[(int)rpos] = cmb.type; | |
| 23838 | 162275 | found_combo = true; | |
| 23839 | 162275 | } | |
| 23840 | 162275 | break; | |
| 23841 | case cBLOCKALL: case cLIGHTTARGET: | ||
| 23842 | 13142 | typeMap[(int)rpos] = cmb.type; | |
| 23843 | 13142 | found_combo = true; | |
| 23844 | 13142 | break; | |
| 23845 | case cMIRRORNEW: | ||
| 23846 | ✗ | if(!cmb.attributes[0] || (cmb.attributes[0] & sh_lightbeam)) | |
| 23847 | { | ||
| 23848 | ✗ | typeMap[(int)rpos] = cMIRRORNEW; | |
| 23849 | ✗ | customTypeMap[(int)rpos] = layer_scr->data[pos]; | |
| 23850 | ✗ | found_combo = true; | |
| 23851 | ✗ | } | |
| 23852 | ✗ | break; | |
| 23853 | case cGLASS: | ||
| 23854 | 3702 | found_combo = true; | |
| 23855 | // Already been initialized to zero. | ||
| 23856 | 3702 | break; | |
| 23857 | case cSPOTLIGHT: | ||
| 23858 | 14283 | found_any_light = true; | |
| 23859 | 14283 | break; | |
| 23860 | } | ||
| 23861 |
2/2✓ Branch 0 taken 179119 times.
✓ Branch 1 taken 17413814 times.
|
17592933 | if(found_combo) |
| 23862 | 179119 | pos_has_seen_cmb[pos] = true; | |
| 23863 |
4/4✓ Branch 0 taken 7358582 times.
✓ Branch 1 taken 10055232 times.
✓ Branch 2 taken 6017045 times.
✓ Branch 3 taken 1341537 times.
|
17413814 | else if(lyr < 3 && (cmb.walk & 0xF)) |
| 23864 | 1341537 | typeMap[(int)rpos] = SPTYPE_SOLID; | |
| 23865 | 17592933 | } | |
| 23866 | 99981 | } | |
| 23867 | |||
| 23868 |
2/2✓ Branch 0 taken 2513808 times.
✓ Branch 1 taken 14283 times.
|
2528091 | for (int pos = 0; pos < 176; pos++) |
| 23869 | { | ||
| 23870 | 2513808 | rpos_t rpos = POS_TO_RPOS(pos, region_scr_x, region_scr_y); | |
| 23871 |
4/4✓ Branch 0 taken 2296624 times.
✓ Branch 1 taken 217184 times.
✓ Branch 2 taken 1421859 times.
✓ Branch 3 taken 874765 times.
|
2513808 | if (!get_qr(qr_SPOTLIGHT_IGNR_SOLIDOBJ) && !typeMap[(int)rpos]) |
| 23872 | { | ||
| 23873 | 1749530 | auto [x, y] = COMBOXY_REGION(rpos); | |
| 23874 |
2/4✓ Branch 0 taken 874765 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 874765 times.
✗ Branch 3 not taken.
|
1749530 | if (collide_object(x, y, 16, 16, this)) |
| 23875 | ✗ | typeMap[(int)rpos] = SPTYPE_SOLID; | |
| 23876 | 874765 | } | |
| 23877 | 2513808 | } | |
| 23878 | 14283 | }); | |
| 23879 | |||
| 23880 | // The world is dark and full of terrors. | ||
| 23881 |
1/2✓ Branch 0 taken 14283 times.
✗ Branch 1 not taken.
|
14283 | if (!found_any_light) return; |
| 23882 | |||
| 23883 |
2/2✓ Branch 0 taken 252 times.
✓ Branch 1 taken 14031 times.
|
14283 | switch (typeMap[(int)beam_hero_rpos]) |
| 23884 | { | ||
| 23885 | case SPTYPE_SOLID: case cBLOCKALL: | ||
| 23886 | 252 | beam_hero_rpos = rpos_t::None; //Blocked from hitting player | |
| 23887 | 252 | } | |
| 23888 | |||
| 23889 |
1/2✓ Branch 0 taken 14283 times.
✗ Branch 1 not taken.
|
12148955 | for_every_rpos([&](const rpos_handle_t& rpos_handle) { |
| 23890 |
2/2✓ Branch 0 taken 12120389 times.
✓ Branch 1 taken 14283 times.
|
12134672 | if (rpos_handle.ctype() == cSPOTLIGHT) |
| 23891 | 14283 | launch_lightbeam(rpos_handle, maps, refl, block); | |
| 23892 | 12134672 | }); | |
| 23893 | |||
| 23894 |
1/2✓ Branch 0 taken 14283 times.
✗ Branch 1 not taken.
|
17985 | for_every_ffc([&](const ffc_handle_t& ffc_handle) { |
| 23895 | 3702 | ffcdata& ffc = *ffc_handle.ffc; | |
| 23896 |
1/2✓ Branch 0 taken 3702 times.
✗ Branch 1 not taken.
|
3702 | if (ffc.flags & (ffc_changer|ffc_ethereal)) |
| 23897 | ✗ | return; | |
| 23898 | |||
| 23899 | 3702 | newcombo const& cmb = combobuf[ffc.data]; | |
| 23900 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 3702 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
3702 | if (ffc_handle.ctype() == cSPOTLIGHT && (cmb.usrflags&cflag2)) |
| 23901 | ✗ | launch_fflightbeam(ffc,ffmaps,refl,block); | |
| 23902 | 3702 | }); | |
| 23903 | |||
| 23904 |
1/2✓ Branch 0 taken 14283 times.
✗ Branch 1 not taken.
|
14283 | lightbeam_present = !maps.empty() || !ffmaps.empty(); |
| 23905 | |||
| 23906 | //Draw visuals | ||
| 23907 |
2/2✓ Branch 0 taken 14283 times.
✓ Branch 1 taken 14283 times.
|
28566 | for(auto it = maps.begin(); it != maps.end();) |
| 23908 | { | ||
| 23909 | 14283 | int32_t id = it->first; | |
| 23910 | 14283 | spot_t* grid = it->second; | |
| 23911 |
1/2✓ Branch 0 taken 14283 times.
✗ Branch 1 not taken.
|
14283 | BITMAP* cbmp = generate_beam_bitmap(id); |
| 23912 |
2/2✓ Branch 0 taken 14283 times.
✓ Branch 1 taken 2499525 times.
|
2513808 | for (rpos_t rpos = (rpos_t)0; rpos < region_max_rpos; rpos = (rpos_t)((int)rpos + 1)) |
| 23913 | { | ||
| 23914 |
1/2✓ Branch 0 taken 2499525 times.
✗ Branch 1 not taken.
|
2499525 | int32_t offs = get_beamoffs(grid[(int)rpos]); |
| 23915 |
2/2✓ Branch 0 taken 77115 times.
✓ Branch 1 taken 2422410 times.
|
2499525 | if(offs > -1) |
| 23916 | { | ||
| 23917 |
1/2✓ Branch 0 taken 77115 times.
✗ Branch 1 not taken.
|
77115 | auto [x, y] = COMBOXY_REGION(rpos); |
| 23918 |
3/6✓ Branch 0 taken 77115 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 77115 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 77115 times.
✗ Branch 5 not taken.
|
231345 | masked_blit(cbmp, lightbeam_bmp, offs*16, 0, x-viewport.x, y-viewport.y, 16, 16); |
| 23919 | 77115 | } | |
| 23920 | 2499525 | } | |
| 23921 |
1/2✓ Branch 0 taken 14283 times.
✗ Branch 1 not taken.
|
14283 | destroy_bitmap(cbmp); |
| 23922 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14283 times.
|
14283 | delete[] it->second; |
| 23923 |
1/2✓ Branch 0 taken 14283 times.
✗ Branch 1 not taken.
|
14283 | it = maps.erase(it); |
| 23924 | } | ||
| 23925 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14283 times.
|
14283 | for(auto it = ffmaps.begin(); it != ffmaps.end();) |
| 23926 | { | ||
| 23927 | ✗ | int32_t id = it->first; | |
| 23928 | ✗ | std::map<dword,spot_t> const& grid = it->second; | |
| 23929 | ✗ | BITMAP* cbmp = generate_beam_bitmap(id); | |
| 23930 | ✗ | for(auto it2 = grid.begin(); it2 != grid.end(); ++it2) | |
| 23931 | { | ||
| 23932 | ✗ | lightbeam_xy ffxy(it2->first); | |
| 23933 | ✗ | int32_t offs = get_beamoffs(it2->second); | |
| 23934 | ✗ | if(offs > -1) | |
| 23935 | ✗ | masked_blit(cbmp, lightbeam_bmp, offs*16, 0, ffxy.x-8-viewport.x, ffxy.y-8-viewport.y, 16, 16); | |
| 23936 | ✗ | } | |
| 23937 | ✗ | destroy_bitmap(cbmp); | |
| 23938 | ✗ | it = ffmaps.erase(it); | |
| 23939 | } | ||
| 23940 |
1/3✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 14283 times.
|
14283 | } |
| 23941 | else | ||
| 23942 | { | ||
| 23943 |
2/2✓ Branch 0 taken 14820831 times.
✓ Branch 1 taken 329 times.
|
14821160 | if(had_spotlight) |
| 23944 | { | ||
| 23945 | 329 | istrig.clear(); | |
| 23946 | 329 | istrig.resize(region_num_rpos); | |
| 23947 | 329 | clear_bitmap(lightbeam_bmp); | |
| 23948 | 329 | } | |
| 23949 | 14821160 | lightbeam_present = false; | |
| 23950 | } | ||
| 23951 | |||
| 23952 | 14835443 | had_spotlight = lightbeam_present; | |
| 23953 | |||
| 23954 | //Check triggers | ||
| 23955 | 14835443 | auto& combo_cache = combo_caches::spotlight; | |
| 23956 | 14835443 | std::set<int> screens_triggered; | |
| 23957 | 14835443 | bool istrigged = true; | |
| 23958 |
1/2✓ Branch 0 taken 14835443 times.
✗ Branch 1 not taken.
|
5999158755 | for_every_rpos([&](const rpos_handle_t& rpos_handle) { |
| 23959 | 5984323312 | auto& mini_cmb = combo_cache.minis[rpos_handle.data()]; | |
| 23960 |
2/2✓ Branch 0 taken 13121 times.
✓ Branch 1 taken 5984310191 times.
|
5984323312 | if (mini_cmb.target) |
| 23961 | { | ||
| 23962 | 13121 | auto& cmb = rpos_handle.combo(); | |
| 23963 | 13121 | bool alltrig = getmapflag(rpos_handle.scr, mLIGHTBEAM); | |
| 23964 |
2/2✓ Branch 0 taken 11887 times.
✓ Branch 1 taken 1234 times.
|
13121 | int32_t trigflag = cmb.attribytes[4] ? (1 << (cmb.attribytes[4]-1)) : ~0; |
| 23965 | 13121 | screens_triggered.insert(rpos_handle.screen); | |
| 23966 | 13121 | bool trigged = (istrig[(int)rpos_handle.rpos]&trigflag); | |
| 23967 |
1/2✓ Branch 0 taken 13121 times.
✗ Branch 1 not taken.
|
13121 | if(cmb.usrflags&cflag2) //Invert |
| 23968 | ✗ | trigged = !trigged; | |
| 23969 |
2/2✓ Branch 0 taken 249 times.
✓ Branch 1 taken 12872 times.
|
13121 | if(cmb.usrflags&cflag1) //Solved Version |
| 23970 | { | ||
| 23971 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 249 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
249 | if(!(alltrig || trigged)) //Revert |
| 23972 | { | ||
| 23973 | ✗ | rpos_handle.decrement_data(); | |
| 23974 | ✗ | istrigged = false; | |
| 23975 | ✗ | } | |
| 23976 | 249 | } | |
| 23977 | else //Unsolved version | ||
| 23978 | { | ||
| 23979 |
3/4✓ Branch 0 taken 12872 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 12868 times.
|
12872 | if(alltrig || trigged) //Light |
| 23980 | 4 | rpos_handle.increment_data(); | |
| 23981 | 12868 | else istrigged = false; | |
| 23982 | } | ||
| 23983 | 13121 | } | |
| 23984 |
2/2✓ Branch 0 taken 5984306489 times.
✓ Branch 1 taken 3702 times.
|
5984310191 | else if (mini_cmb.trigger) |
| 23985 | { | ||
| 23986 |
1/2✓ Branch 0 taken 3702 times.
✗ Branch 1 not taken.
|
7404 | trig_each_combo_trigger(rpos_handle, [&](combo_trigger const& trig){ |
| 23987 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3702 times.
|
3702 | int32_t trigflag = trig.triglbeam ? (1 << (trig.triglbeam-1)) : ~0; |
| 23988 | 3702 | bool trigged = (istrig[(int)rpos_handle.rpos]&trigflag); | |
| 23989 | 3702 | return trig.trigger_flags.get(trigged ? TRIGFLAG_LIGHTON : TRIGFLAG_LIGHTOFF); | |
| 23990 | }); | ||
| 23991 | 3702 | } | |
| 23992 | 5984323312 | }); | |
| 23993 | |||
| 23994 |
1/2✓ Branch 0 taken 14835443 times.
✗ Branch 1 not taken.
|
455278479 | for_every_ffc([&](const ffc_handle_t& ffc_handle) { |
| 23995 | 440443036 | ffcdata& ffc = *ffc_handle.ffc; | |
| 23996 |
2/2✓ Branch 0 taken 438991540 times.
✓ Branch 1 taken 1451496 times.
|
440443036 | rpos_t rpos = get_qr(qr_BROKEN_LIGHTBEAM_HITBOX) |
| 23997 | 438991540 | ? COMBOPOS_REGION_B(ffc.x+8, ffc.y+8) | |
| 23998 | 1451496 | : COMBOPOS_REGION_B(ffc.x+(ffc.hit_width/2), ffc.y+(ffc.hit_height/2)); | |
| 23999 |
2/2✓ Branch 0 taken 312920 times.
✓ Branch 1 taken 440130116 times.
|
440443036 | if (rpos == rpos_t::None) |
| 24000 | 312920 | return; | |
| 24001 | |||
| 24002 | 440130116 | auto& mini_cmb = combo_cache.minis[ffc_handle.data()]; | |
| 24003 |
2/2✓ Branch 0 taken 1234 times.
✓ Branch 1 taken 440128882 times.
|
440130116 | if (mini_cmb.target) |
| 24004 | { | ||
| 24005 | 1234 | auto& cmb = ffc_handle.combo(); | |
| 24006 | 1234 | bool alltrig = getmapflag(ffc_handle.scr, mLIGHTBEAM); | |
| 24007 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1234 times.
|
1234 | int32_t trigflag = cmb.attribytes[4] ? (1 << (cmb.attribytes[4]-1)) : ~0; |
| 24008 | 1234 | screens_triggered.insert(ffc_handle.screen); | |
| 24009 | 1234 | bool trigged = (istrig[(int)rpos]&trigflag); | |
| 24010 |
1/2✓ Branch 0 taken 1234 times.
✗ Branch 1 not taken.
|
1234 | if(cmb.usrflags&cflag2) //Invert |
| 24011 | ✗ | trigged = !trigged; | |
| 24012 |
2/2✓ Branch 0 taken 249 times.
✓ Branch 1 taken 985 times.
|
1234 | if(cmb.usrflags&cflag1) //Solved Version |
| 24013 | { | ||
| 24014 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 249 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
249 | if(!(alltrig || trigged)) //Revert |
| 24015 | { | ||
| 24016 | ✗ | zc_ffc_modify(ffc, -1); | |
| 24017 | ✗ | istrigged = false; | |
| 24018 | ✗ | } | |
| 24019 | 249 | } | |
| 24020 | else //Unsolved version | ||
| 24021 | { | ||
| 24022 |
3/4✓ Branch 0 taken 985 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 984 times.
|
985 | if(alltrig || trigged) //Light |
| 24023 | 1 | zc_ffc_modify(ffc, 1); | |
| 24024 | 984 | else istrigged = false; | |
| 24025 | } | ||
| 24026 | 1234 | } | |
| 24027 | else //if (mini_cmb.trigger) | ||
| 24028 | { | ||
| 24029 |
1/2✓ Branch 0 taken 440128882 times.
✗ Branch 1 not taken.
|
440256752 | trig_each_combo_trigger(ffc_handle, [&](combo_trigger const& trig){ |
| 24030 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 127870 times.
|
127870 | int32_t trigflag = trig.triglbeam ? (1 << (trig.triglbeam-1)) : ~0; |
| 24031 | 127870 | bool trigged = (istrig[(int)rpos]&trigflag); | |
| 24032 | 127870 | return trig.trigger_flags.get(trigged ? TRIGFLAG_LIGHTON : TRIGFLAG_LIGHTOFF); | |
| 24033 | }); | ||
| 24034 | } | ||
| 24035 | 440443036 | }); | |
| 24036 | |||
| 24037 | // Trigger secrets for every screen that has a light trigger. | ||
| 24038 |
4/4✓ Branch 0 taken 14822575 times.
✓ Branch 1 taken 12868 times.
✓ Branch 2 taken 14822322 times.
✓ Branch 3 taken 253 times.
|
14835443 | if (istrigged && !screens_triggered.empty()) |
| 24039 | { | ||
| 24040 |
2/2✓ Branch 0 taken 253 times.
✓ Branch 1 taken 253 times.
|
506 | for (int screen : screens_triggered) |
| 24041 | { | ||
| 24042 |
1/2✓ Branch 0 taken 253 times.
✗ Branch 1 not taken.
|
253 | mapscr* scr = get_scr(screen); |
| 24043 |
1/2✓ Branch 0 taken 253 times.
✗ Branch 1 not taken.
|
253 | bool alltrig = getmapflag(scr, mLIGHTBEAM); |
| 24044 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 249 times.
|
253 | if (alltrig) |
| 24045 | 249 | continue; | |
| 24046 | |||
| 24047 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | trigger_secrets_for_screen(TriggerSource::LightTrigger, screen, false); |
| 24048 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | sfx(scr->secretsfx); |
| 24049 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | if(!(scr->flags5&fTEMPSECRETS)) |
| 24050 | { | ||
| 24051 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | setmapflag(scr, mSECRET); |
| 24052 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | setmapflag(scr, mLIGHTBEAM); |
| 24053 | 4 | } | |
| 24054 | } | ||
| 24055 | 253 | } | |
| 24056 | 14835443 | } | |
| 24057 | |||
| 24058 | 14809352 | void HeroClass::checktouchblk() | |
| 24059 | { | ||
| 24060 |
2/2✓ Branch 0 taken 14993 times.
✓ Branch 1 taken 14794359 times.
|
14809352 | if (walk_through_walls) return; |
| 24061 | |||
| 24062 |
3/4✓ Branch 0 taken 11901 times.
✓ Branch 1 taken 14782458 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 11901 times.
|
14794359 | if (getAction() == hopping && !isSideViewHero()) |
| 24063 | 11901 | return; | |
| 24064 | |||
| 24065 |
2/2✓ Branch 0 taken 997408 times.
✓ Branch 1 taken 13785050 times.
|
14782458 | if (!pushing) |
| 24066 | 13785050 | return; | |
| 24067 | |||
| 24068 | 997408 | int32_t tdir = dir; //Bad hack #2. _L_, your welcome to fix this properly. ;) | |
| 24069 | |||
| 24070 |
4/4✓ Branch 0 taken 988079 times.
✓ Branch 1 taken 9329 times.
✓ Branch 2 taken 121 times.
✓ Branch 3 taken 987958 times.
|
997408 | if (charging > 0 || spins > 0) //if not I probably will at some point... |
| 24071 | { | ||
| 24072 |
4/4✓ Branch 0 taken 4369 times.
✓ Branch 1 taken 5081 times.
✓ Branch 2 taken 3211 times.
✓ Branch 3 taken 1158 times.
|
9450 | if (getInput(btnUp, INPUT_HERO_ACTION) && getInput(btnLeft, INPUT_HERO_ACTION)) tdir = (charging % 2) * 2; |
| 24073 |
4/4✓ Branch 0 taken 3211 times.
✓ Branch 1 taken 5081 times.
✓ Branch 2 taken 1590 times.
✓ Branch 3 taken 1621 times.
|
8292 | else if (getInput(btnUp, INPUT_HERO_ACTION) && getInput(btnRight, INPUT_HERO_ACTION)) tdir = (charging % 2) * 3; |
| 24074 |
4/4✓ Branch 0 taken 2731 times.
✓ Branch 1 taken 3940 times.
✓ Branch 2 taken 1841 times.
✓ Branch 3 taken 890 times.
|
6671 | else if (getInput(btnDown, INPUT_HERO_ACTION) && getInput(btnLeft, INPUT_HERO_ACTION)) tdir = 1 + (charging % 2) * 1; |
| 24075 |
4/4✓ Branch 0 taken 1841 times.
✓ Branch 1 taken 3940 times.
✓ Branch 2 taken 933 times.
✓ Branch 3 taken 908 times.
|
5781 | else if (getInput(btnDown, INPUT_HERO_ACTION) && getInput(btnRight, INPUT_HERO_ACTION)) tdir = 1 + (charging % 2) * 2; |
| 24076 | else | ||
| 24077 | { | ||
| 24078 |
2/2✓ Branch 0 taken 1590 times.
✓ Branch 1 taken 3283 times.
|
4873 | if (getInput(btnUp, INPUT_HERO_ACTION)) tdir = 0; |
| 24079 |
2/2✓ Branch 0 taken 928 times.
✓ Branch 1 taken 2355 times.
|
3283 | else if (getInput(btnDown, INPUT_HERO_ACTION)) tdir = 1; |
| 24080 |
2/2✓ Branch 0 taken 900 times.
✓ Branch 1 taken 1455 times.
|
2355 | else if (getInput(btnLeft, INPUT_HERO_ACTION)) tdir = 2; |
| 24081 |
2/2✓ Branch 0 taken 1432 times.
✓ Branch 1 taken 23 times.
|
1455 | else if (getInput(btnRight, INPUT_HERO_ACTION)) tdir = 3; |
| 24082 | } | ||
| 24083 | 9450 | } | |
| 24084 | |||
| 24085 | int xs[2], ys[2]; | ||
| 24086 | 997408 | int pos_count = 0; | |
| 24087 |
2/2✓ Branch 0 taken 977026 times.
✓ Branch 1 taken 20382 times.
|
997408 | bool fixed_big_hitbox = bigHitbox && !get_qr(qr_BROKEN_ARMOS_GRAVE_BIGHITBOX_COLLISION); |
| 24088 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 251636 times.
✓ Branch 2 taken 224409 times.
✓ Branch 3 taken 244221 times.
✓ Branch 4 taken 277142 times.
|
997408 | switch (tdir) |
| 24089 | { | ||
| 24090 | case up: | ||
| 24091 | 251636 | xs[0] = x; | |
| 24092 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 251636 times.
|
251636 | ys[0] = y + (fixed_big_hitbox ? -1 : (bigHitbox ? 0 : 7)); |
| 24093 | 251636 | xs[1] = x + 8; | |
| 24094 | 251636 | ys[1] = ys[0]; | |
| 24095 | 251636 | pos_count = 2; | |
| 24096 | 251636 | break; | |
| 24097 | |||
| 24098 | case down: | ||
| 24099 | 224409 | xs[0] = x; | |
| 24100 | 224409 | ys[0] = y + 16; | |
| 24101 | 224409 | xs[1] = x + 8; | |
| 24102 | 224409 | ys[1] = ys[0]; | |
| 24103 | 224409 | pos_count = 2; | |
| 24104 | 224409 | break; | |
| 24105 | |||
| 24106 | case left: | ||
| 24107 | 244221 | xs[0] = x - 1; | |
| 24108 | 244221 | ys[0] = y + 15; | |
| 24109 | 244221 | pos_count = 1; | |
| 24110 |
1/2✓ Branch 0 taken 244221 times.
✗ Branch 1 not taken.
|
244221 | if (fixed_big_hitbox) |
| 24111 | { | ||
| 24112 | ✗ | xs[1] = xs[0]; | |
| 24113 | ✗ | ys[1] = y + 7; | |
| 24114 | ✗ | pos_count = 2; | |
| 24115 | ✗ | } | |
| 24116 | 244221 | break; | |
| 24117 | |||
| 24118 | case right: | ||
| 24119 | 277142 | xs[0] = x + 16; | |
| 24120 | 277142 | ys[0] = y + 15; | |
| 24121 | 277142 | pos_count = 1; | |
| 24122 |
1/2✓ Branch 0 taken 277142 times.
✗ Branch 1 not taken.
|
277142 | if (fixed_big_hitbox) |
| 24123 | { | ||
| 24124 | ✗ | xs[1] = xs[0]; | |
| 24125 | ✗ | ys[1] = y + 7; | |
| 24126 | ✗ | pos_count = 2; | |
| 24127 | ✗ | } | |
| 24128 | 277142 | break; | |
| 24129 | } | ||
| 24130 | 997408 | int max_layer = get_qr(qr_ARMOS_GRAVE_ON_LAYERS) ? 6 : 0; | |
| 24131 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 997408 times.
|
997408 | int start_layer = zc_max(2, max_layer); |
| 24132 | 997408 | bool pos_done[2] = { false,false }; | |
| 24133 |
2/2✓ Branch 0 taken 997352 times.
✓ Branch 1 taken 2992280 times.
|
3989632 | for (int layer = start_layer; layer >= 0; --layer) |
| 24134 | { | ||
| 24135 |
2/2✓ Branch 0 taken 2987936 times.
✓ Branch 1 taken 4418480 times.
|
7406416 | for (int idx = 0; idx < pos_count; ++idx) |
| 24136 | { | ||
| 24137 |
2/2✓ Branch 0 taken 147 times.
✓ Branch 1 taken 4418333 times.
|
4418480 | if (pos_done[idx]) continue; |
| 24138 | 4418333 | auto tx = xs[idx]; | |
| 24139 | 4418333 | auto ty = ys[idx]; | |
| 24140 | 4418333 | auto rpos_handle = get_rpos_handle_for_world_xy(tx, ty, layer); | |
| 24141 | 4418333 | newcombo const& cmb = rpos_handle.combo(); | |
| 24142 |
2/2✓ Branch 0 taken 4417860 times.
✓ Branch 1 taken 473 times.
|
4418333 | if (cmb.type == cBRIDGE) |
| 24143 | { | ||
| 24144 |
4/4✓ Branch 0 taken 417 times.
✓ Branch 1 taken 56 times.
✓ Branch 2 taken 28 times.
✓ Branch 3 taken 28 times.
|
473 | if (get_qr(qr_OLD_BRIDGE_COMBOS) |
| 24145 | 56 | ? !_walkflag_layer(x, y, layer - 1) | |
| 24146 | 417 | : _effectflag_layer(x, y, layer - 1)) | |
| 24147 | { | ||
| 24148 | 445 | pos_done[idx] = true; // cover lower layers at this position | |
| 24149 | 445 | continue; | |
| 24150 | } | ||
| 24151 | 28 | } | |
| 24152 |
2/2✓ Branch 0 taken 2946759 times.
✓ Branch 1 taken 1471129 times.
|
4417888 | if (layer > max_layer) continue; // only checking this layer for bridges |
| 24153 |
2/2✓ Branch 0 taken 1470963 times.
✓ Branch 1 taken 166 times.
|
1471129 | if (!_effectflag(x, y, 1, layer - 1)) continue; |
| 24154 |
2/2✓ Branch 0 taken 48 times.
✓ Branch 1 taken 1470915 times.
|
1470963 | if (cmb.only_gentrig) continue; |
| 24155 |
3/3✓ Branch 0 taken 1465115 times.
✓ Branch 1 taken 3830 times.
✓ Branch 2 taken 1970 times.
|
1470915 | switch (cmb.type) |
| 24156 | { | ||
| 24157 | case cBSGRAVE: case cGRAVE: | ||
| 24158 |
4/4✓ Branch 0 taken 3305 times.
✓ Branch 1 taken 525 times.
✓ Branch 2 taken 987 times.
✓ Branch 3 taken 2318 times.
|
3830 | if (cmb.flag || rpos_handle.sflag()) |
| 24159 | 1512 | continue; | |
| 24160 | 2318 | break; | |
| 24161 | case cARMOS: | ||
| 24162 | 1970 | break; | |
| 24163 | default: | ||
| 24164 | 1465115 | continue; | |
| 24165 | } | ||
| 24166 | 4288 | trigger_armos_grave(rpos_handle, dir); | |
| 24167 | 4288 | break; // only one per layer, even if multiple poses match | |
| 24168 | } | ||
| 24169 | 2992224 | } | |
| 24170 | 14809296 | } | |
| 24171 | |||
| 24172 | ✗ | int32_t HeroClass::nextcombo(int32_t cx, int32_t cy, int32_t cdir) | |
| 24173 | { | ||
| 24174 | ✗ | switch(cdir) | |
| 24175 | { | ||
| 24176 | case up: | ||
| 24177 | ✗ | cy-=16; | |
| 24178 | ✗ | break; | |
| 24179 | |||
| 24180 | case down: | ||
| 24181 | ✗ | cy+=16; | |
| 24182 | ✗ | break; | |
| 24183 | |||
| 24184 | case left: | ||
| 24185 | ✗ | cx-=16; | |
| 24186 | ✗ | break; | |
| 24187 | |||
| 24188 | case right: | ||
| 24189 | ✗ | cx+=16; | |
| 24190 | ✗ | break; | |
| 24191 | } | ||
| 24192 | |||
| 24193 | // off the screen | ||
| 24194 | ✗ | if(cx<0 || cy<0 || cx>=world_w || cy>=world_h) | |
| 24195 | { | ||
| 24196 | ✗ | auto [map, screen] = nextscr2(cdir); | |
| 24197 | ✗ | if (map == -1) | |
| 24198 | ✗ | return 0; | |
| 24199 | |||
| 24200 | ✗ | switch(cdir) | |
| 24201 | { | ||
| 24202 | case up: | ||
| 24203 | ✗ | cy=160; | |
| 24204 | ✗ | break; | |
| 24205 | |||
| 24206 | case down: | ||
| 24207 | ✗ | cy=0; | |
| 24208 | ✗ | break; | |
| 24209 | |||
| 24210 | case left: | ||
| 24211 | ✗ | cx=240; | |
| 24212 | ✗ | break; | |
| 24213 | |||
| 24214 | case right: | ||
| 24215 | ✗ | cx=0; | |
| 24216 | ✗ | break; | |
| 24217 | } | ||
| 24218 | |||
| 24219 | ✗ | int32_t cmb = COMBOPOS(cx%256, cy%176); | |
| 24220 | ✗ | return get_canonical_scr(map, screen)->data[cmb]; | |
| 24221 | } | ||
| 24222 | |||
| 24223 | ✗ | return MAPCOMBO(cx,cy); | |
| 24224 | ✗ | } | |
| 24225 | |||
| 24226 | 16158 | int32_t HeroClass::nextflag(int32_t cx, int32_t cy, int32_t cdir, bool comboflag) | |
| 24227 | { | ||
| 24228 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 3203 times.
✓ Branch 2 taken 3660 times.
✓ Branch 3 taken 4150 times.
✓ Branch 4 taken 5145 times.
|
16158 | switch(cdir) |
| 24229 | { | ||
| 24230 | case up: | ||
| 24231 | 3203 | cy-=16; | |
| 24232 | 3203 | break; | |
| 24233 | |||
| 24234 | case down: | ||
| 24235 | 3660 | cy+=16; | |
| 24236 | 3660 | break; | |
| 24237 | |||
| 24238 | case left: | ||
| 24239 | 4150 | cx-=16; | |
| 24240 | 4150 | break; | |
| 24241 | |||
| 24242 | case right: | ||
| 24243 | 5145 | cx+=16; | |
| 24244 | 5145 | break; | |
| 24245 | } | ||
| 24246 | |||
| 24247 | // off the screen | ||
| 24248 |
8/8✓ Branch 0 taken 16053 times.
✓ Branch 1 taken 105 times.
✓ Branch 2 taken 15908 times.
✓ Branch 3 taken 145 times.
✓ Branch 4 taken 15734 times.
✓ Branch 5 taken 174 times.
✓ Branch 6 taken 194 times.
✓ Branch 7 taken 15540 times.
|
16158 | if(cx<0 || cy<0 || cx>=world_w || cy>=world_h) |
| 24249 | { | ||
| 24250 | 1846 | auto [map, screen] = nextscr2(cdir); | |
| 24251 |
2/2✓ Branch 0 taken 614 times.
✓ Branch 1 taken 4 times.
|
618 | if (map == -1) |
| 24252 | 4 | return 0; | |
| 24253 | |||
| 24254 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 143 times.
✓ Branch 2 taken 192 times.
✓ Branch 3 taken 105 times.
✓ Branch 4 taken 174 times.
|
614 | switch(cdir) |
| 24255 | { | ||
| 24256 | case up: | ||
| 24257 | 143 | cy=160; | |
| 24258 | 143 | break; | |
| 24259 | |||
| 24260 | case down: | ||
| 24261 | 192 | cy=0; | |
| 24262 | 192 | break; | |
| 24263 | |||
| 24264 | case left: | ||
| 24265 | 105 | cx=240; | |
| 24266 | 105 | break; | |
| 24267 | |||
| 24268 | case right: | ||
| 24269 | 174 | cx=0; | |
| 24270 | 174 | break; | |
| 24271 | } | ||
| 24272 | |||
| 24273 | 614 | int32_t pos = COMBOPOS(cx%256, cy%176); | |
| 24274 | 1228 | const mapscr* scr = get_canonical_scr(map, screen); | |
| 24275 |
2/2✓ Branch 0 taken 87 times.
✓ Branch 1 taken 527 times.
|
614 | if (!comboflag) |
| 24276 | { | ||
| 24277 | 527 | return scr->sflag[pos]; | |
| 24278 | } | ||
| 24279 | else | ||
| 24280 | { | ||
| 24281 | 87 | return combo_caches::flag.minis[scr->data[pos]].flag; | |
| 24282 | } | ||
| 24283 | } | ||
| 24284 | |||
| 24285 |
2/2✓ Branch 0 taken 3966 times.
✓ Branch 1 taken 11574 times.
|
15540 | if(comboflag) |
| 24286 | { | ||
| 24287 | 3966 | return MAPCOMBOFLAG(cx,cy); | |
| 24288 | } | ||
| 24289 | |||
| 24290 | 11574 | return MAPFLAG(cx,cy); | |
| 24291 | 16158 | } | |
| 24292 | |||
| 24293 | 14809352 | void HeroClass::checkspecial() | |
| 24294 | { | ||
| 24295 | 14809352 | checktouchblk(); | |
| 24296 | |||
| 24297 | 29971126 | for_every_base_screen_in_region([&](mapscr* scr, unsigned int region_scr_x, unsigned int region_scr_y) { | |
| 24298 | 15161774 | int screen = scr->screen; | |
| 24299 | 15161774 | auto& state = get_screen_state(screen); | |
| 24300 | 15161774 | bool hasmainguy = hasMainGuy(screen); | |
| 24301 |
4/4✓ Branch 0 taken 14731497 times.
✓ Branch 1 taken 430277 times.
✓ Branch 2 taken 8907946 times.
✓ Branch 3 taken 5823551 times.
|
15161774 | if (!state.loaded_enemies || hasmainguy) |
| 24302 | { | ||
| 24303 | 9338223 | state.did_enemy_secret = false; | |
| 24304 | 9338223 | } | |
| 24305 | else | ||
| 24306 | { | ||
| 24307 | // Enemies have been defeated. | ||
| 24308 | |||
| 24309 | // generic 'Enemies->' trigger | ||
| 24310 | 2304838026 | for_every_combo_in_screen(create_screen_handles(scr), [&](const auto& handle) { | |
| 24311 |
2/4✓ Branch 0 taken 2297090928 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1923547 times.
✗ Branch 3 not taken.
|
2436359782 | trig_each_combo_trigger(handle, [&](combo_trigger const& trig){ |
| 24312 | 137345307 | return trig.trigger_flags.get(TRIGFLAG_ENEMIESKILLED); | |
| 24313 | }); | ||
| 24314 | 2299014475 | }); | |
| 24315 | |||
| 24316 |
1/2✓ Branch 0 taken 5823551 times.
✗ Branch 1 not taken.
|
5823551 | if (scr->flags9 & fENEMY_WAVES) |
| 24317 | { | ||
| 24318 | ✗ | hasmainguy = hasMainGuy(screen); //possibly un-beat the enemies (another 'wave'?) | |
| 24319 | ✗ | } | |
| 24320 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5823551 times.
|
5823551 | if(!hasmainguy) |
| 24321 | { | ||
| 24322 | // item | ||
| 24323 |
5/6✓ Branch 0 taken 5823543 times.
✓ Branch 1 taken 8 times.
✓ Branch 2 taken 5823543 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 815 times.
✓ Branch 5 taken 5822728 times.
|
5823551 | if (state.item_state == ScreenItemState::MustGiveToEnemy || state.item_state == ScreenItemState::CarriedByEnemy || state.item_state == ScreenItemState::WhenKillEnemies) |
| 24324 | { | ||
| 24325 | 823 | int32_t Item=scr->item; | |
| 24326 | |||
| 24327 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 823 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 823 times.
|
823 | if((!getmapflag(screen, mITEM) || (scr->flags9&fITEMRETURN)) && (scr->hasitem != 0)) |
| 24328 | { | ||
| 24329 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 815 times.
|
823 | if (state.item_state == ScreenItemState::WhenKillEnemies) |
| 24330 | 815 | sfx(WAV_CLEARED); | |
| 24331 | |||
| 24332 | 823 | zfix x = region_scr_x*256 + scr->itemx; | |
| 24333 |
3/4✓ Branch 0 taken 93 times.
✓ Branch 1 taken 730 times.
✓ Branch 2 taken 93 times.
✗ Branch 3 not taken.
|
823 | zfix y = region_scr_y*176 + ((scr->flags7&fITEMFALLS && isSideViewHero()) ? -170 : scr->itemy+1); |
| 24334 |
9/16✓ Branch 0 taken 823 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 823 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 93 times.
✓ Branch 5 taken 730 times.
✓ Branch 6 taken 93 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 93 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 93 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 730 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 823 times.
✗ Branch 15 not taken.
|
1646 | add_item_for_screen(screen, new item(x, y, (scr->flags7&fITEMFALLS && !isSideViewHero()) ? (zfix)170 : (zfix)0, |
| 24335 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 822 times.
|
823 | Item,ipONETIME|ipBIGRANGE|((itemsbuf[Item].type==itype_triforcepiece || |
| 24336 | 823 | (scr->flags3&fHOLDITEM)) ? ipHOLDUP : 0) | ((scr->flags8&fITEMSECRET) ? ipSECRETS : 0),0)); | |
| 24337 | 823 | } | |
| 24338 | |||
| 24339 | 823 | state.item_state = ScreenItemState::None; | |
| 24340 | 823 | } | |
| 24341 |
2/2✓ Branch 0 taken 117987 times.
✓ Branch 1 taken 5705564 times.
|
5823551 | if(!getmapflag(scr, mTMPNORET)) |
| 24342 | { | ||
| 24343 | // if room has traps, guys don't come back | ||
| 24344 |
2/2✓ Branch 0 taken 5705461 times.
✓ Branch 1 taken 2921206166 times.
|
2926911627 | for (int32_t i=0; i<eMAXGUYS; i++) |
| 24345 | { | ||
| 24346 |
4/4✓ Branch 0 taken 85098851 times.
✓ Branch 1 taken 2836107315 times.
✓ Branch 2 taken 11348788 times.
✓ Branch 3 taken 103 times.
|
2921206166 | if (guysbuf[i].type==eeTRAP && guysbuf[i].attributes[1] |
| 24347 |
2/2✓ Branch 0 taken 11348891 times.
✓ Branch 1 taken 73749960 times.
|
85098851 | && guys.idCount(i, screen)) |
| 24348 | { | ||
| 24349 | 103 | setmapflag(scr, mTMPNORET); | |
| 24350 | 103 | break; | |
| 24351 | } | ||
| 24352 | 2921206063 | } | |
| 24353 | 5705564 | } | |
| 24354 | // clear enemies and open secret | ||
| 24355 |
4/4✓ Branch 0 taken 5620730 times.
✓ Branch 1 taken 202821 times.
✓ Branch 2 taken 5619833 times.
✓ Branch 3 taken 897 times.
|
5823551 | if (!state.did_enemy_secret && (scr->flags2&fCLEARSECRET)) |
| 24356 | { | ||
| 24357 | 897 | bool only16_31 = get_qr(qr_ENEMIES_SECRET_ONLY_16_31)?true:false; | |
| 24358 | 897 | trigger_secrets_for_screen(TriggerSource::EnemiesScreenFlag, scr, only16_31); | |
| 24359 | |||
| 24360 |
4/4✓ Branch 0 taken 146 times.
✓ Branch 1 taken 751 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 141 times.
|
897 | if (scr->flags4&fENEMYSCRTPERM && canPermSecret(cur_dmap, screen)) |
| 24361 | { | ||
| 24362 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 141 times.
|
141 | if (!(scr->flags5&fTEMPSECRETS)) setmapflag(scr, mSECRET); |
| 24363 | 141 | } | |
| 24364 | |||
| 24365 | 897 | sfx(scr->secretsfx); | |
| 24366 | 897 | state.did_enemy_secret = true; | |
| 24367 | 897 | } | |
| 24368 |
1/2✓ Branch 0 taken 5823551 times.
✗ Branch 1 not taken.
|
5823551 | if(scr->flags9 & fENEMIES_STAY_DEAD) |
| 24369 | { | ||
| 24370 | ✗ | if(!getmapflag(scr, mNO_ENEMIES_RETURN)) | |
| 24371 | ✗ | setmapflag(scr, mNO_ENEMIES_RETURN); | |
| 24372 | ✗ | } | |
| 24373 | 5823551 | } | |
| 24374 | } | ||
| 24375 | |||
| 24376 | // doors | ||
| 24377 | 15161774 | bool has_shutter = false; | |
| 24378 | |||
| 24379 |
2/2✓ Branch 0 taken 13129916 times.
✓ Branch 1 taken 57004874 times.
|
70134790 | for (int i = 0; i < 4; i++) |
| 24380 | { | ||
| 24381 |
2/2✓ Branch 0 taken 54973016 times.
✓ Branch 1 taken 2031858 times.
|
57004874 | if (scr->door[i]==dSHUTTER) |
| 24382 | { | ||
| 24383 | 2031858 | has_shutter = true; | |
| 24384 |
4/4✓ Branch 0 taken 1991600 times.
✓ Branch 1 taken 40258 times.
✓ Branch 2 taken 1424 times.
✓ Branch 3 taken 1990176 times.
|
2031858 | if (state.open_doors == 0 && state.loaded_enemies) |
| 24385 | { | ||
| 24386 |
4/4✓ Branch 0 taken 1657895 times.
✓ Branch 1 taken 332281 times.
✓ Branch 2 taken 1655472 times.
✓ Branch 3 taken 2423 times.
|
1990176 | if (!(scr->flags&fSHUTTERS) && !hasmainguy) |
| 24387 | 2423 | state.open_doors=12; | |
| 24388 | 1990176 | } | |
| 24389 |
2/2✓ Branch 0 taken 32960 times.
✓ Branch 1 taken 8722 times.
|
41682 | else if (state.open_doors < 0) |
| 24390 | 8722 | ++state.open_doors; | |
| 24391 |
2/2✓ Branch 0 taken 30229 times.
✓ Branch 1 taken 2731 times.
|
32960 | else if (--state.open_doors == 0) |
| 24392 | 2731 | openshutters(scr); | |
| 24393 | |||
| 24394 | 2031858 | break; | |
| 24395 | } | ||
| 24396 | 54973016 | } | |
| 24397 | |||
| 24398 |
10/10✓ Branch 0 taken 13129916 times.
✓ Branch 1 taken 2031858 times.
✓ Branch 2 taken 12976675 times.
✓ Branch 3 taken 153241 times.
✓ Branch 4 taken 12553254 times.
✓ Branch 5 taken 423421 times.
✓ Branch 6 taken 12479744 times.
✓ Branch 7 taken 73510 times.
✓ Branch 8 taken 6952439 times.
✓ Branch 9 taken 5527305 times.
|
15161774 | if (!has_shutter && !state.open_doors && state.loaded_enemies && !(scr->flags&fSHUTTERS) && !hasmainguy) |
| 24399 | { | ||
| 24400 | 5527305 | openshutters(scr); | |
| 24401 | 5527305 | } | |
| 24402 | |||
| 24403 | // set boss flag when boss is gone | ||
| 24404 |
6/6✓ Branch 0 taken 14731497 times.
✓ Branch 1 taken 430277 times.
✓ Branch 2 taken 251991 times.
✓ Branch 3 taken 14479506 times.
✓ Branch 4 taken 197739 times.
✓ Branch 5 taken 54252 times.
|
15161774 | if (state.loaded_enemies && scr->flags11&efBOSS && !hasmainguy) |
| 24405 | { | ||
| 24406 | 54252 | game->lvlitems[dlevel]|=(1 << li_boss_killed); | |
| 24407 | 54252 | stop_sfx(scr->bosssfx); | |
| 24408 | 54252 | } | |
| 24409 | |||
| 24410 | 15161774 | auto screen_handles = create_screen_handles(scr); | |
| 24411 | |||
| 24412 |
2/2✓ Branch 0 taken 15078389 times.
✓ Branch 1 taken 83385 times.
|
15161774 | if (getmapflag(screen, mCHEST)) // if special stuff done before |
| 24413 | { | ||
| 24414 | 83385 | remove_chests(screen_handles); | |
| 24415 | 83385 | } | |
| 24416 | |||
| 24417 |
2/2✓ Branch 0 taken 15159314 times.
✓ Branch 1 taken 2460 times.
|
15161774 | if(getmapflag(screen, mLOCKEDCHEST)) // if special stuff done before |
| 24418 | { | ||
| 24419 | 2460 | remove_lockedchests(screen_handles); | |
| 24420 | 2460 | } | |
| 24421 | |||
| 24422 |
2/2✓ Branch 0 taken 15135573 times.
✓ Branch 1 taken 26201 times.
|
15161774 | if(getmapflag(screen, mBOSSCHEST)) // if special stuff done before |
| 24423 | { | ||
| 24424 | 26201 | remove_bosschests(screen_handles); | |
| 24425 | 26201 | } | |
| 24426 | |||
| 24427 | 15161774 | clear_xdoors(screen_handles, true); | |
| 24428 | 15161774 | clear_xstatecombos(screen_handles, true); | |
| 24429 | |||
| 24430 |
4/4✓ Branch 0 taken 1495537 times.
✓ Branch 1 taken 13666237 times.
✓ Branch 2 taken 1495506 times.
✓ Branch 3 taken 31 times.
|
15161774 | if (state.triggered_secrets && state.item_state == ScreenItemState::WhenTriggerSecrets) |
| 24431 | { | ||
| 24432 | 31 | int32_t Item=scr->item; | |
| 24433 | |||
| 24434 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 31 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 29 times.
|
31 | if((!getmapflag(screen, mITEM) || (scr->flags9&fITEMRETURN)) && (scr->hasitem != 0)) |
| 24435 | { | ||
| 24436 |
3/4✓ Branch 0 taken 22 times.
✓ Branch 1 taken 7 times.
✓ Branch 2 taken 22 times.
✗ Branch 3 not taken.
|
29 | auto [x, y] = translate_screen_coordinates_to_world(screen, scr->itemx, (scr->flags7&fITEMFALLS && isSideViewHero()) ? -170 : scr->itemy+1); |
| 24437 |
4/8✓ Branch 0 taken 29 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 29 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 29 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 29 times.
✗ Branch 7 not taken.
|
87 | add_item_for_screen(screen, new item(x, y, |
| 24438 |
6/10✓ Branch 0 taken 22 times.
✓ Branch 1 taken 7 times.
✓ Branch 2 taken 22 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 22 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 22 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 7 times.
✗ Branch 9 not taken.
|
29 | (scr->flags7&fITEMFALLS && !isSideViewHero()) ? (zfix)170 : (zfix)0, |
| 24439 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 29 times.
|
29 | Item,ipONETIME|ipBIGRANGE|((itemsbuf[Item].type==itype_triforcepiece || |
| 24440 | 29 | (scr->flags3&fHOLDITEM)) ? ipHOLDUP : 0) | ((scr->flags8&fITEMSECRET) ? ipSECRETS : 0),0)); | |
| 24441 | 29 | } | |
| 24442 | |||
| 24443 | 31 | state.item_state = ScreenItemState::None; | |
| 24444 | 31 | } | |
| 24445 | 15161774 | }); | |
| 24446 | 14809352 | } | |
| 24447 | |||
| 24448 | // Returns 4 rpos indicated by all combinations of the coordinates, replacing duplicates with rpos_t::None | ||
| 24449 | 14665686 | static std::array<rpos_t, 4> getRposes(int32_t x1, int32_t y1, int32_t x2, int32_t y2) | |
| 24450 | { | ||
| 24451 | std::array<rpos_t, 4> rposes; | ||
| 24452 | rpos_t tmp; | ||
| 24453 | |||
| 24454 | 14665686 | rposes[0] = COMBOPOS_REGION_B(x1,y1); | |
| 24455 | |||
| 24456 | 14665686 | tmp = COMBOPOS_REGION_B(x1,y2); | |
| 24457 |
2/2✓ Branch 0 taken 10524422 times.
✓ Branch 1 taken 4141264 times.
|
14665686 | if (tmp == rposes[0]) |
| 24458 | 10524422 | rposes[1] = rpos_t::None; | |
| 24459 | 4141264 | else rposes[1] = tmp; | |
| 24460 | |||
| 24461 | 14665686 | tmp = COMBOPOS_REGION_B(x2,y1); | |
| 24462 |
3/4✓ Branch 0 taken 7227295 times.
✓ Branch 1 taken 7438391 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 7227295 times.
|
14665686 | if (tmp == rposes[0] || tmp == rposes[1]) |
| 24463 | 7438391 | rposes[2] = rpos_t::None; | |
| 24464 | 7227295 | else rposes[2] = tmp; | |
| 24465 | |||
| 24466 | 14665686 | tmp = COMBOPOS_REGION_B(x2,y2); | |
| 24467 |
6/6✓ Branch 0 taken 9364132 times.
✓ Branch 1 taken 5301554 times.
✓ Branch 2 taken 7227295 times.
✓ Branch 3 taken 2136837 times.
✓ Branch 4 taken 5222868 times.
✓ Branch 5 taken 2004427 times.
|
14665686 | if (tmp == rposes[0] || tmp == rposes[1] || tmp == rposes[2]) |
| 24468 | 12661259 | rposes[3] = rpos_t::None; | |
| 24469 | 2004427 | else rposes[3] = tmp; | |
| 24470 | |||
| 24471 | 14665686 | return rposes; | |
| 24472 | } | ||
| 24473 | |||
| 24474 | 14761722 | void HeroClass::checkspecial2(int32_t *ls) | |
| 24475 | { | ||
| 24476 |
6/8✓ Branch 0 taken 9981839 times.
✓ Branch 1 taken 4779883 times.
✓ Branch 2 taken 9717786 times.
✓ Branch 3 taken 264053 times.
✓ Branch 4 taken 9717786 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 9717786 times.
|
14761722 | if(get_qr(qr_OLDSTYLEWARP) && !(diagonalMovement||NO_GRIDLOCK)) |
| 24477 | { | ||
| 24478 | // Must run fairycircle stuff if currently active, otherwise hero gets stuck! | ||
| 24479 |
2/2✓ Branch 0 taken 21923 times.
✓ Branch 1 taken 9695863 times.
|
9717786 | if (!fairyclk) |
| 24480 | { | ||
| 24481 |
2/2✓ Branch 0 taken 2922314 times.
✓ Branch 1 taken 6773549 times.
|
9695863 | if(y.getInt()&7) |
| 24482 | 2922314 | return; | |
| 24483 | |||
| 24484 |
2/2✓ Branch 0 taken 3818491 times.
✓ Branch 1 taken 2955058 times.
|
6773549 | if(x.getInt()&7) |
| 24485 | 3818491 | return; | |
| 24486 | 2955058 | } | |
| 24487 | 2976981 | } | |
| 24488 | |||
| 24489 |
2/2✓ Branch 0 taken 6099 times.
✓ Branch 1 taken 8014818 times.
|
8020917 | if(walk_through_walls) return; |
| 24490 | |||
| 24491 | 8014818 | bool didstrig = false; | |
| 24492 | |||
| 24493 |
2/2✓ Branch 0 taken 16029602 times.
✓ Branch 1 taken 8014778 times.
|
24044380 | for(int32_t i=bigHitbox?0:8; i<16; i+=bigHitbox?15:7) |
| 24494 | { | ||
| 24495 |
4/4✓ Branch 0 taken 32059175 times.
✓ Branch 1 taken 16029562 times.
✓ Branch 2 taken 64118310 times.
✓ Branch 3 taken 32059135 times.
|
112207007 | for(int32_t j=0; j<16; j+=15) for(int32_t k=0; k<2; k++) |
| 24496 | { | ||
| 24497 | 64118310 | int comboid = 0; | |
| 24498 | mapscr* scr; | ||
| 24499 |
2/2✓ Branch 0 taken 32059135 times.
✓ Branch 1 taken 32059175 times.
|
64118310 | if (k > 0) |
| 24500 | { | ||
| 24501 | 32059135 | auto ffc_handle = getFFCAt(x+j, y+i); | |
| 24502 |
2/2✓ Branch 0 taken 31536406 times.
✓ Branch 1 taken 522729 times.
|
32059135 | if (ffc_handle) |
| 24503 | { | ||
| 24504 | 522729 | comboid = ffc_handle->data(); | |
| 24505 | 522729 | scr = ffc_handle->scr; | |
| 24506 | 522729 | } | |
| 24507 | 32059135 | } | |
| 24508 | else | ||
| 24509 | { | ||
| 24510 | 32059175 | auto rpos_handle = get_rpos_handle_for_world_xy(x+j, y+i, 0); | |
| 24511 | 32059175 | comboid = rpos_handle.data(); | |
| 24512 | 32059175 | scr = rpos_handle.scr; | |
| 24513 | } | ||
| 24514 | 64118310 | newcombo const& cmb = combobuf[comboid]; | |
| 24515 | 64118310 | int32_t stype = cmb.type; | |
| 24516 | 64118310 | int32_t warpsound = cmb.attribytes[0]; | |
| 24517 |
2/2✓ Branch 0 taken 64118108 times.
✓ Branch 1 taken 202 times.
|
64118310 | if(cmb.only_gentrig) |
| 24518 | 202 | stype = cNONE; | |
| 24519 |
2/2✓ Branch 0 taken 64118276 times.
✓ Branch 1 taken 34 times.
|
64118310 | if(stype==cSWARPA) |
| 24520 | { | ||
| 24521 |
2/2✓ Branch 0 taken 33 times.
✓ Branch 1 taken 1 times.
|
34 | if(scr->flags5&fDIRECTSWARP) |
| 24522 | { | ||
| 24523 | 1 | setpit(); | |
| 24524 | 1 | } | |
| 24525 | |||
| 24526 | 34 | sdir=dir; | |
| 24527 | 34 | dowarp(scr,0,0,warpsound); | |
| 24528 | 34 | return; | |
| 24529 | } | ||
| 24530 | |||
| 24531 |
2/2✓ Branch 0 taken 64118271 times.
✓ Branch 1 taken 5 times.
|
64118276 | if(stype==cSWARPB) |
| 24532 | { | ||
| 24533 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if(scr->flags5&fDIRECTSWARP) |
| 24534 | { | ||
| 24535 | ✗ | setpit(); | |
| 24536 | ✗ | } | |
| 24537 | |||
| 24538 | 5 | sdir=dir; | |
| 24539 | 5 | dowarp(scr,0,1,warpsound); | |
| 24540 | 5 | return; | |
| 24541 | } | ||
| 24542 | |||
| 24543 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 64118270 times.
|
64118271 | if(stype==cSWARPC) |
| 24544 | { | ||
| 24545 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | if(scr->flags5&fDIRECTSWARP) |
| 24546 | { | ||
| 24547 | ✗ | setpit(); | |
| 24548 | ✗ | } | |
| 24549 | |||
| 24550 | 1 | sdir=dir; | |
| 24551 | 1 | dowarp(scr,0,2,warpsound); | |
| 24552 | 1 | return; | |
| 24553 | } | ||
| 24554 | |||
| 24555 |
1/2✓ Branch 0 taken 64118270 times.
✗ Branch 1 not taken.
|
64118270 | if(stype==cSWARPD) |
| 24556 | { | ||
| 24557 | ✗ | if(scr->flags5&fDIRECTSWARP) | |
| 24558 | { | ||
| 24559 | ✗ | setpit(); | |
| 24560 | ✗ | } | |
| 24561 | |||
| 24562 | ✗ | sdir=dir; | |
| 24563 | ✗ | dowarp(scr,0,3,warpsound); | |
| 24564 | ✗ | return; | |
| 24565 | } | ||
| 24566 | |||
| 24567 |
1/2✓ Branch 0 taken 64118270 times.
✗ Branch 1 not taken.
|
64118270 | if(stype==cSWARPR) |
| 24568 | { | ||
| 24569 | ✗ | if(scr->flags5&fDIRECTSWARP) | |
| 24570 | { | ||
| 24571 | ✗ | setpit(); | |
| 24572 | ✗ | } | |
| 24573 | |||
| 24574 | ✗ | sdir=dir; | |
| 24575 | ✗ | dowarp(scr,0,(zc_oldrand()%4),warpsound); | |
| 24576 | ✗ | return; | |
| 24577 | } | ||
| 24578 | |||
| 24579 | 64118270 | rpos_t rpos = COMBOPOS_REGION(x+j, y+i); | |
| 24580 |
4/4✓ Branch 0 taken 64114113 times.
✓ Branch 1 taken 4157 times.
✓ Branch 2 taken 64115776 times.
✓ Branch 3 taken 2494 times.
|
64118270 | if((stype==cSTRIGNOFLAG || stype==cSTRIGFLAG) && stepsecret!=rpos) |
| 24581 | { | ||
| 24582 | 2494 | auto rpos_handle = get_rpos_handle(rpos, 0); | |
| 24583 | |||
| 24584 |
3/4✓ Branch 0 taken 903 times.
✓ Branch 1 taken 1591 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 903 times.
|
2494 | if(stype==cSTRIGFLAG && canPermSecret(cur_dmap, rpos_handle.screen)) |
| 24585 | { | ||
| 24586 |
2/2✓ Branch 0 taken 292 times.
✓ Branch 1 taken 611 times.
|
903 | if(!didstrig) |
| 24587 | { | ||
| 24588 | 611 | stepsecret = rpos; | |
| 24589 | |||
| 24590 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 609 times.
|
611 | if(!(rpos_handle.scr->flags5&fTEMPSECRETS)) |
| 24591 | { | ||
| 24592 | 609 | setmapflag(rpos_handle.scr, mSECRET); | |
| 24593 | 609 | } | |
| 24594 | 611 | sfx(warpsound,pan((int32_t)x)); | |
| 24595 | 611 | trigger_secrets_for_screen(TriggerSource::Unspecified, rpos_handle.base_scr(), false); | |
| 24596 | 611 | didstrig = true; | |
| 24597 | 611 | } | |
| 24598 | 903 | } | |
| 24599 | else | ||
| 24600 | { | ||
| 24601 |
2/2✓ Branch 0 taken 680 times.
✓ Branch 1 taken 911 times.
|
1591 | if(!didstrig) |
| 24602 | { | ||
| 24603 | 911 | stepsecret = rpos; | |
| 24604 | |||
| 24605 | 911 | bool high16only = get_qr(qr_STEPTEMP_SECRET_ONLY_16_31)?true:false; | |
| 24606 | 911 | trigger_secrets_for_screen(TriggerSource::Unspecified, rpos_handle.base_scr(), high16only); | |
| 24607 | 911 | didstrig = true; | |
| 24608 | 911 | sfx(warpsound,pan((int32_t)x)); | |
| 24609 | 911 | } | |
| 24610 | } | ||
| 24611 | 2494 | } | |
| 24612 | 96177405 | } | |
| 24613 | 16029562 | } | |
| 24614 | |||
| 24615 | 8014778 | bool RaftPass = false;//Special case for the raft, where only the raft stuff gets checked and nothing else. | |
| 24616 | |||
| 24617 | // check if he's standing on a warp he just came out of | ||
| 24618 | // But if the QR is checked, it uses the old logic, cause some quests like Ballad of a Bloodline warp you onto a trigger and this new logic bricks that. | ||
| 24619 |
2/2✓ Branch 0 taken 2008545 times.
✓ Branch 1 taken 6006233 times.
|
8014778 | if (!get_qr(qr_210_WARPRETURN)) |
| 24620 | { | ||
| 24621 |
6/6✓ Branch 0 taken 6004167 times.
✓ Branch 1 taken 2066 times.
✓ Branch 2 taken 383484 times.
✓ Branch 3 taken 5620683 times.
✓ Branch 4 taken 60417 times.
✓ Branch 5 taken 323067 times.
|
6006233 | if(((int32_t)y>=warpy-8&&(int32_t)y<=warpy+7)&&warpy!=-1) |
| 24622 | { | ||
| 24623 |
5/6✓ Branch 0 taken 321918 times.
✓ Branch 1 taken 1149 times.
✓ Branch 2 taken 320349 times.
✓ Branch 3 taken 1569 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 320349 times.
|
323067 | if(((int32_t)x>=warpx-8&&(int32_t)x<=warpx+7)&&warpx!=-1) |
| 24624 | { | ||
| 24625 |
4/4✓ Branch 0 taken 14095 times.
✓ Branch 1 taken 306254 times.
✓ Branch 2 taken 4010 times.
✓ Branch 3 taken 10085 times.
|
320349 | if (get_qr(qr_BETTER_RAFT_2) && dir != up) RaftPass = true; |
| 24626 | 310264 | else return; | |
| 24627 | 10085 | } | |
| 24628 | 12803 | } | |
| 24629 | 5695969 | } | |
| 24630 | else | ||
| 24631 | { | ||
| 24632 |
2/2✓ Branch 0 taken 1677137 times.
✓ Branch 1 taken 331408 times.
|
2008545 | if(TRUNCATE_HALF_TILE(int32_t(y))==warpy) |
| 24633 | { | ||
| 24634 |
2/2✓ Branch 0 taken 4076 times.
✓ Branch 1 taken 327332 times.
|
331408 | if(x==warpx) |
| 24635 | { | ||
| 24636 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 327332 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
327332 | if (get_qr(qr_BETTER_RAFT_2) && dir != up) RaftPass = true; |
| 24637 | 327332 | else return; | |
| 24638 | ✗ | } | |
| 24639 | 4076 | } | |
| 24640 | } | ||
| 24641 |
2/2✓ Branch 0 taken 10085 times.
✓ Branch 1 taken 7367097 times.
|
7377182 | if (!RaftPass) warpy=-1; |
| 24642 | |||
| 24643 |
6/6✓ Branch 0 taken 7369621 times.
✓ Branch 1 taken 7561 times.
✓ Branch 2 taken 347581 times.
✓ Branch 3 taken 7022040 times.
✓ Branch 4 taken 259119 times.
✓ Branch 5 taken 88462 times.
|
7377182 | if(((int32_t)y<raftwarpy-(get_qr(qr_BETTER_RAFT_2)?12:8)||(int32_t)y>raftwarpy+(get_qr(qr_BETTER_RAFT_2)?3:7))||raftwarpy==-1) |
| 24644 | { | ||
| 24645 | 7118063 | raftwarpy = -1; | |
| 24646 | 7118063 | } | |
| 24647 |
6/6✓ Branch 0 taken 7370955 times.
✓ Branch 1 taken 6227 times.
✓ Branch 2 taken 338123 times.
✓ Branch 3 taken 7032832 times.
✓ Branch 4 taken 258333 times.
✓ Branch 5 taken 79790 times.
|
7377182 | if (((int32_t)x<raftwarpx - 8 || (int32_t)x>raftwarpx + 7) || raftwarpx == -1) |
| 24648 | { | ||
| 24649 | 7118849 | raftwarpx = -1; | |
| 24650 | 7118849 | } | |
| 24651 | 7377182 | int32_t tx=x; | |
| 24652 | 7377182 | int32_t ty=y; | |
| 24653 | |||
| 24654 | 7377182 | int32_t flag=0; | |
| 24655 | 7377182 | int32_t flag2=0; | |
| 24656 | 7377182 | int32_t flag3=0; | |
| 24657 | 7377182 | mapscr* flag_scr=nullptr; | |
| 24658 | 7377182 | mapscr* flag2_scr=nullptr; | |
| 24659 | 7377182 | mapscr* flag3_scr=nullptr; | |
| 24660 | 7377182 | mapscr* scrs[4]={}; | |
| 24661 | 7377182 | rpos_handle_t rpos_handles[4]; | |
| 24662 | 7377182 | int32_t type=0; | |
| 24663 | 7377182 | int32_t water=0; | |
| 24664 | 7377182 | int32_t index = 0; | |
| 24665 | |||
| 24666 | 7377182 | bool setsave=false; | |
| 24667 | 7377182 | int32_t warpsfx2 = 0; | |
| 24668 |
2/2✓ Branch 0 taken 10085 times.
✓ Branch 1 taken 7367097 times.
|
7377182 | if (RaftPass) goto RaftingStuff; |
| 24669 | |||
| 24670 | int32_t x1,x2,y1,y2; | ||
| 24671 | 7367097 | x1 = tx; | |
| 24672 | 7367097 | x2 = tx+15; | |
| 24673 | 7367097 | y1 = ty; | |
| 24674 | 7367097 | y2 = ty+15; | |
| 24675 | |||
| 24676 |
4/6✓ Branch 0 taken 2514335 times.
✓ Branch 1 taken 4852762 times.
✓ Branch 2 taken 2514335 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2514335 times.
|
7367097 | if((diagonalMovement||NO_GRIDLOCK)) |
| 24677 | { | ||
| 24678 | 4852762 | x1 = tx+4; | |
| 24679 | 4852762 | x2 = tx+11; | |
| 24680 | 4852762 | y1 = ty+4; | |
| 24681 | 4852762 | y2 = ty+11; | |
| 24682 | 4852762 | } | |
| 24683 | |||
| 24684 | int32_t types[4]; | ||
| 24685 | 7367097 | types[0]=types[1]=types[2]=types[3]=-1; | |
| 24686 | int32_t cids[4]; | ||
| 24687 | int32_t ffcids[4]; | ||
| 24688 | 7367097 | cids[0]=cids[1]=cids[2]=cids[3]=-1; | |
| 24689 | 7367097 | ffcids[0]=ffcids[1]=ffcids[2]=ffcids[3]=-1; | |
| 24690 | // | ||
| 24691 | // First, let's find flag1 (combo flag), flag2 (inherent flag) and flag3 (FFC flag)... | ||
| 24692 | // | ||
| 24693 | |||
| 24694 | 7367097 | rpos_handles[0] = get_rpos_handle_for_world_xy(x1, y1, 0); | |
| 24695 | 7367097 | rpos_handles[1] = get_rpos_handle_for_world_xy(x1, y2, 0); | |
| 24696 | 7367097 | rpos_handles[2] = get_rpos_handle_for_world_xy(x2, y1, 0); | |
| 24697 | 7367097 | rpos_handles[3] = get_rpos_handle_for_world_xy(x2, y2, 0); | |
| 24698 | |||
| 24699 | 7367097 | types[0] = rpos_handles[0].sflag(); | |
| 24700 | 7367097 | types[1] = rpos_handles[1].sflag(); | |
| 24701 | 7367097 | types[2] = rpos_handles[2].sflag(); | |
| 24702 | 7367097 | types[3] = rpos_handles[3].sflag(); | |
| 24703 | |||
| 24704 | 7367097 | flag_scr = rpos_handles[0].scr; | |
| 24705 | |||
| 24706 | //MAPFFCOMBO | ||
| 24707 | |||
| 24708 |
6/6✓ Branch 0 taken 7131370 times.
✓ Branch 1 taken 235727 times.
✓ Branch 2 taken 7102244 times.
✓ Branch 3 taken 29126 times.
✓ Branch 4 taken 88323 times.
✓ Branch 5 taken 7013921 times.
|
7367097 | if(types[0]==types[1]&&types[2]==types[3]&&types[1]==types[2]) |
| 24709 | 7013921 | flag = types[0]; | |
| 24710 | // 2.10 compatibility... | ||
| 24711 |
10/10✓ Branch 0 taken 156594 times.
✓ Branch 1 taken 196582 times.
✓ Branch 2 taken 129093 times.
✓ Branch 3 taken 27501 times.
✓ Branch 4 taken 115228 times.
✓ Branch 5 taken 13865 times.
✓ Branch 6 taken 115132 times.
✓ Branch 7 taken 96 times.
✓ Branch 8 taken 1839 times.
✓ Branch 9 taken 113293 times.
|
353176 | else if(y.getInt()%16==8 && types[0]==types[2] && (types[0]==mfFAIRY || types[0]==mfMAGICFAIRY || types[0]==mfALLFAIRY)) |
| 24712 | 15800 | flag = types[0]; | |
| 24713 | |||
| 24714 | |||
| 24715 | 7367097 | types[0] = rpos_handles[0].cflag(); | |
| 24716 | 7367097 | types[1] = rpos_handles[1].cflag(); | |
| 24717 | 7367097 | types[2] = rpos_handles[2].cflag(); | |
| 24718 | 7367097 | types[3] = rpos_handles[3].cflag(); | |
| 24719 | 7367097 | flag2_scr = rpos_handles[0].scr; | |
| 24720 | |||
| 24721 |
6/6✓ Branch 0 taken 7304646 times.
✓ Branch 1 taken 62451 times.
✓ Branch 2 taken 7297380 times.
✓ Branch 3 taken 7266 times.
✓ Branch 4 taken 18154 times.
✓ Branch 5 taken 7279226 times.
|
7367097 | if(types[0]==types[1]&&types[2]==types[3]&&types[1]==types[2]) |
| 24722 | 7279226 | flag2 = types[0]; | |
| 24723 |
10/12✓ Branch 0 taken 23037 times.
✓ Branch 1 taken 64834 times.
✓ Branch 2 taken 4201 times.
✓ Branch 3 taken 18836 times.
✓ Branch 4 taken 3403 times.
✓ Branch 5 taken 798 times.
✓ Branch 6 taken 3403 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 3403 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 208 times.
✓ Branch 11 taken 3195 times.
|
87871 | else if(!get_qr(qr_FAIRY_FLAG_COMPAT) && y.getInt()%16==8 && types[0]==types[2] && (types[0]==mfFAIRY || types[0]==mfMAGICFAIRY || types[0]==mfALLFAIRY)) |
| 24724 | 208 | flag2 = types[0]; | |
| 24725 | |||
| 24726 | { | ||
| 24727 | 7367097 | auto ffc_handle_1 = getFFCAt(x1, y1); | |
| 24728 | 7367097 | auto ffc_handle_2 = getFFCAt(x1, y2); | |
| 24729 | 7367097 | auto ffc_handle_3 = getFFCAt(x2, y1); | |
| 24730 | 7367097 | auto ffc_handle_4 = getFFCAt(x2, y2); | |
| 24731 | |||
| 24732 |
2/2✓ Branch 0 taken 180496 times.
✓ Branch 1 taken 7186601 times.
|
7367097 | types[0] = ffc_handle_1 ? ffc_handle_1->cflag() : 0; |
| 24733 |
2/2✓ Branch 0 taken 132651 times.
✓ Branch 1 taken 7234446 times.
|
7367097 | types[1] = ffc_handle_2 ? ffc_handle_2->cflag() : 0; |
| 24734 |
2/2✓ Branch 0 taken 179726 times.
✓ Branch 1 taken 7187371 times.
|
7367097 | types[2] = ffc_handle_3 ? ffc_handle_3->cflag() : 0; |
| 24735 |
2/2✓ Branch 0 taken 133232 times.
✓ Branch 1 taken 7233865 times.
|
7367097 | types[3] = ffc_handle_4 ? ffc_handle_4->cflag() : 0; |
| 24736 | |||
| 24737 |
2/2✓ Branch 0 taken 180496 times.
✓ Branch 1 taken 7186601 times.
|
7367097 | if (ffc_handle_1) |
| 24738 | 180496 | flag3_scr = ffc_handle_1->scr; | |
| 24739 |
2/2✓ Branch 0 taken 22403 times.
✓ Branch 1 taken 7164198 times.
|
7186601 | else if (ffc_handle_2) |
| 24740 | 22403 | flag3_scr = ffc_handle_2->scr; | |
| 24741 |
2/2✓ Branch 0 taken 18829 times.
✓ Branch 1 taken 7145369 times.
|
7164198 | else if (ffc_handle_3) |
| 24742 | 18829 | flag3_scr = ffc_handle_3->scr; | |
| 24743 |
2/2✓ Branch 0 taken 7140283 times.
✓ Branch 1 taken 5086 times.
|
7145369 | else if (ffc_handle_4) |
| 24744 | 5086 | flag3_scr = ffc_handle_4->scr; | |
| 24745 | } | ||
| 24746 | |||
| 24747 | // | ||
| 24748 | |||
| 24749 |
6/6✓ Branch 0 taken 7366484 times.
✓ Branch 1 taken 613 times.
✓ Branch 2 taken 7366329 times.
✓ Branch 3 taken 155 times.
✓ Branch 4 taken 49 times.
✓ Branch 5 taken 7366280 times.
|
7367097 | if(types[0]==types[1]&&types[2]==types[3]&&types[1]==types[2]) |
| 24750 | 7366280 | flag3 = types[0]; | |
| 24751 |
9/12✓ Branch 0 taken 54 times.
✓ Branch 1 taken 763 times.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 48 times.
✓ Branch 4 taken 4 times.
✓ Branch 5 taken 2 times.
✓ Branch 6 taken 4 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 4 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 4 times.
|
817 | else if(!get_qr(qr_FAIRY_FLAG_COMPAT) && y.getInt()%16==8 && types[0]==types[2] && (types[0]==mfFAIRY || types[0]==mfMAGICFAIRY || types[0]==mfALLFAIRY)) |
| 24752 | ✗ | flag3 = types[0]; | |
| 24753 | |||
| 24754 | // | ||
| 24755 | // Now, let's check for warp combos... | ||
| 24756 | // | ||
| 24757 | |||
| 24758 | // | ||
| 24759 | |||
| 24760 | 7367097 | cids[0] = rpos_handles[0].data(); | |
| 24761 | 7367097 | cids[1] = rpos_handles[1].data(); | |
| 24762 | 7367097 | cids[2] = rpos_handles[2].data(); | |
| 24763 | 7367097 | cids[3] = rpos_handles[3].data(); | |
| 24764 | |||
| 24765 | 7367097 | types[0] = rpos_handles[0].ctype(); | |
| 24766 |
2/2✓ Branch 0 taken 7186601 times.
✓ Branch 1 taken 180496 times.
|
7367097 | if (auto ffc_handle = getFFCAt(x1, y1)) |
| 24767 | { | ||
| 24768 | 180496 | types[0] = ffc_handle->ctype(); | |
| 24769 | 180496 | cids[0] = ffc_handle->data(); | |
| 24770 | 180496 | } | |
| 24771 | |||
| 24772 | 7367097 | types[1] = rpos_handles[1].ctype(); | |
| 24773 |
2/2✓ Branch 0 taken 7234446 times.
✓ Branch 1 taken 132651 times.
|
7367097 | if (auto ffc_handle = getFFCAt(x1, y2)) |
| 24774 | { | ||
| 24775 | 132651 | types[1] = ffc_handle->ctype(); | |
| 24776 | 132651 | cids[1] = ffc_handle->data(); | |
| 24777 | 132651 | } | |
| 24778 | |||
| 24779 | 7367097 | types[2] = rpos_handles[2].ctype(); | |
| 24780 |
2/2✓ Branch 0 taken 7187371 times.
✓ Branch 1 taken 179726 times.
|
7367097 | if (auto ffc_handle = getFFCAt(x2, y1)) |
| 24781 | { | ||
| 24782 | 179726 | types[2] = ffc_handle->ctype(); | |
| 24783 | 179726 | cids[2] = ffc_handle->data(); | |
| 24784 | 179726 | } | |
| 24785 | |||
| 24786 | 7367097 | types[3] = rpos_handles[3].ctype(); | |
| 24787 |
2/2✓ Branch 0 taken 7233865 times.
✓ Branch 1 taken 133232 times.
|
7367097 | if (auto ffc_handle = getFFCAt(x2, y2)) |
| 24788 | { | ||
| 24789 | 133232 | types[3] = ffc_handle->ctype(); | |
| 24790 | 133232 | cids[3] = ffc_handle->data(); | |
| 24791 | 133232 | } | |
| 24792 | |||
| 24793 | // Change B, C and D warps into A, for the comparison below... | ||
| 24794 |
2/2✓ Branch 0 taken 29468388 times.
✓ Branch 1 taken 7367097 times.
|
36835485 | for(int32_t i=0; i<4; i++) |
| 24795 | { | ||
| 24796 |
2/2✓ Branch 0 taken 324 times.
✓ Branch 1 taken 29468064 times.
|
29468388 | if(combobuf[cids[i]].only_gentrig) |
| 24797 | { | ||
| 24798 | 324 | types[i] = cNONE; | |
| 24799 | 324 | continue; | |
| 24800 | } | ||
| 24801 |
2/2✓ Branch 0 taken 6937 times.
✓ Branch 1 taken 29461127 times.
|
29468064 | if(types[i]==cCAVE) |
| 24802 | { | ||
| 24803 | 6937 | index=0; | |
| 24804 | 6937 | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24805 | 6937 | } | |
| 24806 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 29461127 times.
|
29461127 | else if(types[i]==cCAVEB) |
| 24807 | { | ||
| 24808 | ✗ | types[i]=cCAVE; | |
| 24809 | ✗ | index=1; | |
| 24810 | ✗ | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24811 | ✗ | } | |
| 24812 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 29461127 times.
|
29461127 | else if(types[i]==cCAVEC) |
| 24813 | { | ||
| 24814 | ✗ | types[i]=cCAVE; | |
| 24815 | ✗ | index=2; | |
| 24816 | ✗ | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24817 | ✗ | } | |
| 24818 |
1/2✓ Branch 0 taken 29461127 times.
✗ Branch 1 not taken.
|
29461127 | else if(types[i]==cCAVED) |
| 24819 | { | ||
| 24820 | ✗ | types[i]=cCAVE; | |
| 24821 | ✗ | index=3; | |
| 24822 | ✗ | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24823 | ✗ | } | |
| 24824 | |||
| 24825 |
2/2✓ Branch 0 taken 9519 times.
✓ Branch 1 taken 29458545 times.
|
29468064 | if(types[i]==cPIT) |
| 24826 | { | ||
| 24827 | 9519 | index=0; | |
| 24828 | 9519 | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24829 | 9519 | } | |
| 24830 |
2/2✓ Branch 0 taken 5708 times.
✓ Branch 1 taken 29452837 times.
|
29458545 | else if(types[i]==cPITB) |
| 24831 | { | ||
| 24832 | 5708 | types[i]=cPIT; | |
| 24833 | 5708 | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24834 | 5708 | index=1; | |
| 24835 | 5708 | } | |
| 24836 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 29452837 times.
|
29452837 | else if(types[i]==cPITC) |
| 24837 | { | ||
| 24838 | ✗ | types[i]=cPIT; | |
| 24839 | ✗ | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24840 | ✗ | index=2; | |
| 24841 | ✗ | } | |
| 24842 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 29452831 times.
|
29452837 | else if(types[i]==cPITD) |
| 24843 | { | ||
| 24844 | 6 | types[i]=cPIT; | |
| 24845 | 6 | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24846 | 6 | index=3; | |
| 24847 | 6 | } | |
| 24848 |
1/2✓ Branch 0 taken 29452831 times.
✗ Branch 1 not taken.
|
29452831 | else if(types[i]==cPITR) |
| 24849 | { | ||
| 24850 | ✗ | types[i]=cPIT; | |
| 24851 | ✗ | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24852 | ✗ | index=zc_oldrand()%4; | |
| 24853 | ✗ | } | |
| 24854 | |||
| 24855 |
2/2✓ Branch 0 taken 36683 times.
✓ Branch 1 taken 29431381 times.
|
29468064 | if(types[i]==cSTAIR) |
| 24856 | { | ||
| 24857 | 36683 | index=0; | |
| 24858 | 36683 | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24859 | 36683 | } | |
| 24860 |
2/2✓ Branch 0 taken 2243 times.
✓ Branch 1 taken 29429138 times.
|
29431381 | else if(types[i]==cSTAIRB) |
| 24861 | { | ||
| 24862 | 2243 | types[i]=cSTAIR; | |
| 24863 | 2243 | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24864 | 2243 | index=1; | |
| 24865 | 2243 | } | |
| 24866 |
2/2✓ Branch 0 taken 402 times.
✓ Branch 1 taken 29428736 times.
|
29429138 | else if(types[i]==cSTAIRC) |
| 24867 | { | ||
| 24868 | 402 | types[i]=cSTAIR; | |
| 24869 | 402 | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24870 | 402 | index=2; | |
| 24871 | 402 | } | |
| 24872 |
2/2✓ Branch 0 taken 259 times.
✓ Branch 1 taken 29428477 times.
|
29428736 | else if(types[i]==cSTAIRD) |
| 24873 | { | ||
| 24874 | 259 | types[i]=cSTAIR; | |
| 24875 | 259 | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24876 | 259 | index=3; | |
| 24877 | 259 | } | |
| 24878 |
1/2✓ Branch 0 taken 29428477 times.
✗ Branch 1 not taken.
|
29428477 | else if(types[i]==cSTAIRR) |
| 24879 | { | ||
| 24880 | ✗ | types[i]=cSTAIR; | |
| 24881 | ✗ | index=zc_oldrand()%4; | |
| 24882 | ✗ | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24883 | ✗ | } | |
| 24884 | |||
| 24885 |
2/2✓ Branch 0 taken 6587 times.
✓ Branch 1 taken 29461477 times.
|
29468064 | if(types[i]==cCAVE2) |
| 24886 | { | ||
| 24887 | 6587 | index=0; | |
| 24888 | 6587 | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24889 | 6587 | } | |
| 24890 |
2/2✓ Branch 0 taken 333 times.
✓ Branch 1 taken 29461144 times.
|
29461477 | else if(types[i]==cCAVE2B) |
| 24891 | { | ||
| 24892 | 333 | types[i]=cCAVE2; | |
| 24893 | 333 | index=1; | |
| 24894 | 333 | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24895 | 333 | } | |
| 24896 |
2/2✓ Branch 0 taken 163 times.
✓ Branch 1 taken 29460981 times.
|
29461144 | else if(types[i]==cCAVE2C) |
| 24897 | { | ||
| 24898 | 163 | types[i]=cCAVE2; | |
| 24899 | 163 | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24900 | 163 | index=2; | |
| 24901 | 163 | } | |
| 24902 |
1/2✓ Branch 0 taken 29460981 times.
✗ Branch 1 not taken.
|
29460981 | else if(types[i]==cCAVE2D) |
| 24903 | { | ||
| 24904 | ✗ | types[i]=cCAVE2; | |
| 24905 | ✗ | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24906 | ✗ | index=3; | |
| 24907 | ✗ | } | |
| 24908 | |||
| 24909 |
2/2✓ Branch 0 taken 155 times.
✓ Branch 1 taken 29467909 times.
|
29468064 | if(types[i]==cSWIMWARP) |
| 24910 | { | ||
| 24911 | 155 | index=0; | |
| 24912 | 155 | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24913 | 155 | } | |
| 24914 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 29467909 times.
|
29467909 | else if(types[i]==cSWIMWARPB) |
| 24915 | { | ||
| 24916 | ✗ | types[i]=cSWIMWARP; | |
| 24917 | ✗ | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24918 | ✗ | index=1; | |
| 24919 | ✗ | } | |
| 24920 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 29467909 times.
|
29467909 | else if(types[i]==cSWIMWARPC) |
| 24921 | { | ||
| 24922 | ✗ | types[i]=cSWIMWARP; | |
| 24923 | ✗ | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24924 | ✗ | index=2; | |
| 24925 | ✗ | } | |
| 24926 |
1/2✓ Branch 0 taken 29467909 times.
✗ Branch 1 not taken.
|
29467909 | else if(types[i]==cSWIMWARPD) |
| 24927 | { | ||
| 24928 | ✗ | types[i]=cSWIMWARP; | |
| 24929 | ✗ | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24930 | ✗ | index=3; | |
| 24931 | ✗ | } | |
| 24932 | |||
| 24933 |
2/2✓ Branch 0 taken 595 times.
✓ Branch 1 taken 29467469 times.
|
29468064 | if(types[i]==cDIVEWARP) |
| 24934 | { | ||
| 24935 | 595 | index=0; | |
| 24936 | 595 | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24937 | 595 | } | |
| 24938 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 29467469 times.
|
29467469 | else if(types[i]==cDIVEWARPB) |
| 24939 | { | ||
| 24940 | ✗ | types[i]=cDIVEWARP; | |
| 24941 | ✗ | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24942 | ✗ | index=1; | |
| 24943 | ✗ | } | |
| 24944 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 29467469 times.
|
29467469 | else if(types[i]==cDIVEWARPC) |
| 24945 | { | ||
| 24946 | ✗ | types[i]=cDIVEWARP; | |
| 24947 | ✗ | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24948 | ✗ | index=2; | |
| 24949 | ✗ | } | |
| 24950 |
1/2✓ Branch 0 taken 29467469 times.
✗ Branch 1 not taken.
|
29467469 | else if(types[i]==cDIVEWARPD) |
| 24951 | { | ||
| 24952 | ✗ | types[i]=cDIVEWARP; | |
| 24953 | ✗ | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 24954 | ✗ | index=3; | |
| 24955 | ✗ | } | |
| 24956 | |||
| 24957 |
2/2✓ Branch 0 taken 8275 times.
✓ Branch 1 taken 29459789 times.
|
29468064 | if(types[i]==cSTEP) warpsfx2 = combobuf[cids[i]].attribytes[0]; |
| 24958 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 29459789 times.
|
29459789 | else if(types[i]==cSTEPSAME) { types[i]=cSTEP; warpsfx2 = combobuf[cids[i]].attribytes[0];} |
| 24959 |
2/2✓ Branch 0 taken 29459645 times.
✓ Branch 1 taken 144 times.
|
29459789 | else if(types[i]==cSTEPALL) { types[i]=cSTEP; warpsfx2 = combobuf[cids[i]].attribytes[0]; } |
| 24960 | 29468064 | } | |
| 24961 | |||
| 24962 | // Special case for step combos; otherwise, they act oddly in some cases | ||
| 24963 |
8/8✓ Branch 0 taken 6751916 times.
✓ Branch 1 taken 615181 times.
✓ Branch 2 taken 6682649 times.
✓ Branch 3 taken 69267 times.
✓ Branch 4 taken 1452 times.
✓ Branch 5 taken 682996 times.
✓ Branch 6 taken 142303 times.
✓ Branch 7 taken 140851 times.
|
7367097 | if((types[0]==types[1]&&types[2]==types[3]&&types[1]==types[2])||(types[1]==cSTEP&&types[3]==cSTEP)) |
| 24964 | { | ||
| 24965 |
7/8✓ Branch 0 taken 6508667 times.
✓ Branch 1 taken 31679 times.
✓ Branch 2 taken 6508667 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1758 times.
✓ Branch 5 taken 6506909 times.
✓ Branch 6 taken 629 times.
✓ Branch 7 taken 1129 times.
|
6824952 | if(action!=freeze&&action!=sideswimfreeze&&(!msg_active || !get_qr(qr_MSGFREEZE))) |
| 24966 | 6508038 | type = types[1]; | |
| 24967 | 6540346 | } | |
| 24968 | |||
| 24969 | //Generic Step | ||
| 24970 |
7/8✓ Branch 0 taken 7332685 times.
✓ Branch 1 taken 31508 times.
✓ Branch 2 taken 7332685 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 2166 times.
✓ Branch 5 taken 7330519 times.
✓ Branch 6 taken 1032 times.
✓ Branch 7 taken 1134 times.
|
7364193 | if(action!=freeze&&action!=sideswimfreeze&&(!msg_active || !get_qr(qr_MSGFREEZE))) |
| 24971 | { | ||
| 24972 |
4/6✓ Branch 0 taken 2491698 times.
✓ Branch 1 taken 4839955 times.
✓ Branch 2 taken 2491698 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2491698 times.
|
7331653 | auto rposes = diagonalMovement||NO_GRIDLOCK ? |
| 24973 | 4839955 | getRposes(tx+4, ty+4, tx+11, ty+11) : | |
| 24974 | 2491698 | getRposes(tx+4, ty+4, tx+11, ty+11); | |
| 24975 | 7331653 | auto sensRposes = getRposes(tx, ty+(bigHitbox?0:8), tx+15, ty+15); | |
| 24976 | 7331653 | int32_t xPoses[4] = {tx + 4, tx + 11, tx, tx + 15}; | |
| 24977 | 7331653 | int32_t yPoses[4] = {ty + 4, ty + 11, ty+(bigHitbox?0:8), ty + 15}; | |
| 24978 | |||
| 24979 | 7331653 | bool hasStep[4] = {false}; | |
| 24980 |
2/2✓ Branch 0 taken 29326612 times.
✓ Branch 1 taken 7331653 times.
|
36658265 | for(auto p = 0; p < 4; ++p) |
| 24981 | { | ||
| 24982 |
2/2✓ Branch 0 taken 13748534 times.
✓ Branch 1 taken 15578078 times.
|
29326612 | if (rposes[p] == rpos_t::None) continue; |
| 24983 | |||
| 24984 |
2/2✓ Branch 0 taken 13743297 times.
✓ Branch 1 taken 96208742 times.
|
109952039 | for (auto lyr = 0; lyr < 7; ++lyr) |
| 24985 | { | ||
| 24986 | 96208742 | auto rpos_handle = get_rpos_handle(rposes[p], lyr); | |
| 24987 |
4/4✓ Branch 0 taken 95938486 times.
✓ Branch 1 taken 270256 times.
✓ Branch 2 taken 95942336 times.
✓ Branch 3 taken 266406 times.
|
96208742 | if ((z > 0 || fakez > 0) && !(rpos_handle.base_scr()->flags2 & fAIRCOMBOS)) |
| 24988 | 266406 | continue; | |
| 24989 | 95942336 | auto& cmb = rpos_handle.combo(); | |
| 24990 |
2/2✓ Branch 0 taken 95937099 times.
✓ Branch 1 taken 5252703 times.
|
101189802 | for(size_t idx = 0; idx < cmb.triggers.size(); ++idx) |
| 24991 | { | ||
| 24992 | 5252703 | auto& trig = cmb.triggers[idx]; | |
| 24993 |
4/6✓ Branch 0 taken 5252703 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5252703 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 5247466 times.
✓ Branch 5 taken 5237 times.
|
10505406 | if (trig.trigger_flags.any({TRIGFLAG_STEP,TRIGFLAG_STEPSENS}) |
| 24994 |
2/2✓ Branch 0 taken 5237 times.
✓ Branch 1 taken 5247466 times.
|
5252703 | || types[p] == cSTEP) |
| 24995 | { | ||
| 24996 | 5237 | hasStep[p] = true; | |
| 24997 | 5237 | break; | |
| 24998 | } | ||
| 24999 | 5247466 | } | |
| 25000 |
2/2✓ Branch 0 taken 95937099 times.
✓ Branch 1 taken 5237 times.
|
95942336 | if(hasStep[p]) |
| 25001 | 5237 | break; | |
| 25002 | 95937099 | } | |
| 25003 | 13748534 | } | |
| 25004 | 7331653 | bool canNormalStep = true; | |
| 25005 |
2/2✓ Branch 0 taken 1501 times.
✓ Branch 1 taken 7337420 times.
|
7338921 | for(auto p = 0; p < 4; ++p) |
| 25006 | { | ||
| 25007 |
2/2✓ Branch 0 taken 7333729 times.
✓ Branch 1 taken 3691 times.
|
7337420 | if(rposes[p] == rpos_t::None) continue; |
| 25008 |
2/2✓ Branch 0 taken 3577 times.
✓ Branch 1 taken 7330152 times.
|
7333729 | if(!hasStep[p]) |
| 25009 | { | ||
| 25010 | 7330152 | canNormalStep = false; | |
| 25011 | 7330152 | break; | |
| 25012 | } | ||
| 25013 | 3577 | } | |
| 25014 |
2/2✓ Branch 0 taken 29326612 times.
✓ Branch 1 taken 7331653 times.
|
36658265 | for (auto p = 0; p < 4; ++p) |
| 25015 | { | ||
| 25016 |
2/2✓ Branch 0 taken 205286284 times.
✓ Branch 1 taken 29326612 times.
|
234612896 | for (auto lyr = 0; lyr < 7; ++lyr) |
| 25017 | { | ||
| 25018 |
2/2✓ Branch 0 taken 109046546 times.
✓ Branch 1 taken 96239738 times.
|
205286284 | if (rposes[p] != rpos_t::None) |
| 25019 | { | ||
| 25020 | 96239738 | auto rpos_handle = get_rpos_handle(rposes[p], lyr); | |
| 25021 |
5/8✓ Branch 0 taken 96222280 times.
✓ Branch 1 taken 17458 times.
✓ Branch 2 taken 17458 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 96222280 times.
✓ Branch 5 taken 17458 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
96260206 | bool did_trig = canNormalStep && trig_each_combo_trigger(rpos_handle, [&](combo_trigger const& trig){ |
| 25022 | 3010 | return trig.trigger_flags.get(TRIGFLAG_STEP); | |
| 25023 | }); | ||
| 25024 |
4/4✓ Branch 0 taken 115 times.
✓ Branch 1 taken 96239623 times.
✓ Branch 2 taken 57 times.
✓ Branch 3 taken 58 times.
|
96239738 | if (did_trig && rposes[p] == sensRposes[p]) continue; |
| 25025 | 96239680 | } | |
| 25026 |
2/2✓ Branch 0 taken 105288911 times.
✓ Branch 1 taken 99997315 times.
|
205286226 | if (sensRposes[p] != rpos_t::None) |
| 25027 | { | ||
| 25028 | 99997315 | auto rpos_handle = get_rpos_handle(sensRposes[p], lyr); | |
| 25029 |
1/2✓ Branch 0 taken 99997315 times.
✗ Branch 1 not taken.
|
106143830 | trig_each_combo_trigger(rpos_handle, [&](combo_trigger const& trig){ |
| 25030 | 6146515 | return trig.trigger_flags.get(TRIGFLAG_STEPSENS); | |
| 25031 | }); | ||
| 25032 | 99997315 | } | |
| 25033 | 205286226 | } | |
| 25034 | 29326612 | } | |
| 25035 | |||
| 25036 | 208372957 | for_every_ffc([&](const ffc_handle_t& ffc_handle) { | |
| 25037 | 201041304 | bool found = false; | |
| 25038 |
2/2✓ Branch 0 taken 402082608 times.
✓ Branch 1 taken 201041304 times.
|
603123912 | for (int xch = 0; xch < 2; ++xch) |
| 25039 | { | ||
| 25040 |
2/2✓ Branch 0 taken 804165216 times.
✓ Branch 1 taken 402082608 times.
|
1206247824 | for(int ych = 0; ych < 2; ++ych) |
| 25041 | { | ||
| 25042 |
2/2✓ Branch 0 taken 803533165 times.
✓ Branch 1 taken 632051 times.
|
804165216 | if (ffcIsAt(ffc_handle, xPoses[xch], yPoses[ych])) |
| 25043 | { | ||
| 25044 | 632051 | found = true; | |
| 25045 | 632051 | } | |
| 25046 | 804165216 | } | |
| 25047 | 402082608 | } | |
| 25048 |
2/2✓ Branch 0 taken 200806858 times.
✓ Branch 1 taken 234446 times.
|
201041304 | if (found) |
| 25049 | { | ||
| 25050 |
1/2✓ Branch 0 taken 234446 times.
✗ Branch 1 not taken.
|
235294 | trig_each_combo_trigger(ffc_handle, [&](combo_trigger const& trig){ |
| 25051 |
2/4✓ Branch 0 taken 848 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 848 times.
|
848 | return trig.trigger_flags.any({TRIGFLAG_STEP,TRIGFLAG_STEPSENS}); |
| 25052 | ✗ | }); | |
| 25053 | 234446 | } | |
| 25054 | 201041304 | }); | |
| 25055 | 7331653 | } | |
| 25056 | |||
| 25057 |
2/2✓ Branch 0 taken 7361813 times.
✓ Branch 1 taken 2380 times.
|
7364193 | if(isDiving()) //Dive-> triggerflag |
| 25058 | { | ||
| 25059 | 2380 | rpos_t rpos = COMBOPOS_REGION(x+8,y+8); | |
| 25060 | 2380 | int x1=x,x2=x+15,y1=y+(bigHitbox?0:8),y2=y+15; | |
| 25061 | 2380 | int xposes[] = {x1,x1,x2,x2}; | |
| 25062 | 2380 | int yposes[] = {y1,y2,y1,y2}; | |
| 25063 | 2380 | auto rposes = getRposes(x1,y1,x2,y2); | |
| 25064 |
2/2✓ Branch 0 taken 16660 times.
✓ Branch 1 taken 2380 times.
|
19040 | for(auto lyr = 0; lyr < 7; ++lyr) |
| 25065 | { | ||
| 25066 | 16660 | bool didtrig = false; | |
| 25067 | 16660 | auto rpos_handle = get_rpos_handle(rpos, lyr); | |
| 25068 | 16660 | auto& cmb = rpos_handle.combo(); | |
| 25069 | 16660 | auto cid = rpos_handle.data(); | |
| 25070 |
1/2✓ Branch 0 taken 16660 times.
✗ Branch 1 not taken.
|
18851 | didtrig = trig_each_combo_trigger(rpos_handle, [&](combo_trigger const& trig){ |
| 25071 | 2191 | return trig.trigger_flags.get(TRIGFLAG_DIVETRIG); | |
| 25072 | }); | ||
| 25073 |
2/2✓ Branch 0 taken 66640 times.
✓ Branch 1 taken 16660 times.
|
83300 | for(auto q = 0; q < 4; ++q) |
| 25074 | { | ||
| 25075 |
2/2✓ Branch 0 taken 33593 times.
✓ Branch 1 taken 33047 times.
|
66640 | if(rposes[q] == rpos_t::None) continue; |
| 25076 |
3/4✓ Branch 0 taken 16660 times.
✓ Branch 1 taken 16933 times.
✓ Branch 2 taken 16660 times.
✗ Branch 3 not taken.
|
33593 | if(rposes[q] == rpos && didtrig) continue; |
| 25077 | |||
| 25078 | 33593 | auto rpos_handle_2 = get_rpos_handle(rposes[q], lyr); | |
| 25079 |
1/2✓ Branch 0 taken 33593 times.
✗ Branch 1 not taken.
|
38102 | trig_each_combo_trigger(rpos_handle_2, [&](combo_trigger const& trig){ |
| 25080 | 4509 | return trig.trigger_flags.get(TRIGFLAG_DIVESENSTRIG); | |
| 25081 | }); | ||
| 25082 | 33593 | } | |
| 25083 | 16660 | } | |
| 25084 | |||
| 25085 | 68688 | for_every_ffc([&](const ffc_handle_t& ffc_handle) { | |
| 25086 |
2/2✓ Branch 0 taken 66272 times.
✓ Branch 1 taken 36 times.
|
66308 | if(ffcIsAt(ffc_handle, x+8, y+8)) |
| 25087 | { | ||
| 25088 |
2/4✓ Branch 0 taken 36 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 36 times.
|
36 | if(trig_each_combo_trigger(ffc_handle, [&](combo_trigger const& trig){ |
| 25089 | ✗ | return trig.trigger_flags.get(TRIGFLAG_DIVETRIG); | |
| 25090 | ✗ | })) return; | |
| 25091 | 36 | } | |
| 25092 |
2/2✓ Branch 0 taken 66308 times.
✓ Branch 1 taken 265232 times.
|
331540 | for(auto q = 0; q < 4; ++q) |
| 25093 | { | ||
| 25094 |
2/2✓ Branch 0 taken 265143 times.
✓ Branch 1 taken 89 times.
|
265232 | if(ffcIsAt(ffc_handle, xposes[q], yposes[q])) |
| 25095 | { | ||
| 25096 |
2/4✓ Branch 0 taken 89 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 89 times.
✗ Branch 3 not taken.
|
89 | if(trig_each_combo_trigger(ffc_handle, [&](combo_trigger const& trig){ |
| 25097 | ✗ | return trig.trigger_flags.get(TRIGFLAG_DIVESENSTRIG); | |
| 25098 | ✗ | })) break; | |
| 25099 | 89 | } | |
| 25100 | 265232 | } | |
| 25101 | 66308 | }); | |
| 25102 | 2380 | } | |
| 25103 | |||
| 25104 | // | ||
| 25105 | // Now, let's check for Save combos... | ||
| 25106 | // | ||
| 25107 | 7364193 | x1 = tx+4; | |
| 25108 | 7364193 | x2 = tx+11; | |
| 25109 | 7364193 | y1 = ty+4; | |
| 25110 | 7364193 | y2 = ty+11; | |
| 25111 | |||
| 25112 | 7364193 | rpos_handles[0] = get_rpos_handle_for_world_xy(x1, y1, 0); | |
| 25113 | 7364193 | rpos_handles[1] = get_rpos_handle_for_world_xy(x1, y2, 0); | |
| 25114 | 7364193 | rpos_handles[2] = get_rpos_handle_for_world_xy(x2, y1, 0); | |
| 25115 | 7364193 | rpos_handles[3] = get_rpos_handle_for_world_xy(x2, y2, 0); | |
| 25116 | |||
| 25117 | 7364193 | cids[0] = rpos_handles[0].data(); | |
| 25118 | 7364193 | cids[1] = rpos_handles[1].data(); | |
| 25119 | 7364193 | cids[2] = rpos_handles[2].data(); | |
| 25120 | 7364193 | cids[3] = rpos_handles[3].data(); | |
| 25121 | |||
| 25122 | 7364193 | types[0] = rpos_handles[0].ctype(); | |
| 25123 |
2/2✓ Branch 0 taken 7183720 times.
✓ Branch 1 taken 180473 times.
|
7364193 | if (auto ffc_handle = getFFCAt(x1, y1)) |
| 25124 | { | ||
| 25125 | 180473 | types[0] = ffc_handle->ctype(); | |
| 25126 | 180473 | cids[0] = ffc_handle->data(); | |
| 25127 | 180473 | } | |
| 25128 | |||
| 25129 | 7364193 | types[1] = rpos_handles[1].ctype(); | |
| 25130 |
2/2✓ Branch 0 taken 7231528 times.
✓ Branch 1 taken 132665 times.
|
7364193 | if (auto ffc_handle = getFFCAt(x1, y2)) |
| 25131 | { | ||
| 25132 | 132665 | types[1] = ffc_handle->ctype(); | |
| 25133 | 132665 | cids[1] = ffc_handle->data(); | |
| 25134 | 132665 | } | |
| 25135 | |||
| 25136 | 7364193 | types[2] = rpos_handles[2].ctype(); | |
| 25137 |
2/2✓ Branch 0 taken 7184482 times.
✓ Branch 1 taken 179711 times.
|
7364193 | if (auto ffc_handle = getFFCAt(x2, y1)) |
| 25138 | { | ||
| 25139 | 179711 | types[2] = ffc_handle->ctype(); | |
| 25140 | 179711 | cids[2] = ffc_handle->data(); | |
| 25141 | 179711 | } | |
| 25142 | |||
| 25143 | 7364193 | types[3] = rpos_handles[3].ctype(); | |
| 25144 |
2/2✓ Branch 0 taken 7230946 times.
✓ Branch 1 taken 133247 times.
|
7364193 | if (auto ffc_handle = getFFCAt(x2, y2)) |
| 25145 | { | ||
| 25146 | 133247 | types[3] = ffc_handle->ctype(); | |
| 25147 | 133247 | cids[3] = ffc_handle->data(); | |
| 25148 | 133247 | } | |
| 25149 | |||
| 25150 |
2/2✓ Branch 0 taken 7364193 times.
✓ Branch 1 taken 29468388 times.
|
36832581 | for(int32_t i=0; i<4; i++) |
| 25151 | { | ||
| 25152 |
2/2✓ Branch 0 taken 29468064 times.
✓ Branch 1 taken 324 times.
|
29468388 | if(combobuf[cids[i]].only_gentrig) |
| 25153 | { | ||
| 25154 |
2/4✓ Branch 0 taken 324 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 324 times.
|
324 | if(types[i] == cSAVE || types[i] == cSAVE2) |
| 25155 | { | ||
| 25156 | ✗ | types[i] = cNONE; | |
| 25157 | ✗ | setsave = false; | |
| 25158 | ✗ | break; | |
| 25159 | } | ||
| 25160 | 324 | } | |
| 25161 |
2/2✓ Branch 0 taken 29467102 times.
✓ Branch 1 taken 1286 times.
|
29468388 | if(types[i]==cSAVE) setsave=true; |
| 25162 | |||
| 25163 |
1/2✓ Branch 0 taken 29468388 times.
✗ Branch 1 not taken.
|
29468388 | if(types[i]==cSAVE2) setsave=true; |
| 25164 | 29468388 | } | |
| 25165 | |||
| 25166 |
8/8✓ Branch 0 taken 431 times.
✓ Branch 1 taken 7363762 times.
✓ Branch 2 taken 343 times.
✓ Branch 3 taken 88 times.
✓ Branch 4 taken 335 times.
✓ Branch 5 taken 8 times.
✓ Branch 6 taken 106 times.
✓ Branch 7 taken 229 times.
|
7364193 | if(setsave && types[0]==types[1]&&types[2]==types[3]&&types[1]==types[2]) |
| 25167 | { | ||
| 25168 | 229 | last_savepoint_id = cids[0]; | |
| 25169 | 229 | type = types[0]; | |
| 25170 | 229 | } | |
| 25171 | // | ||
| 25172 | // Now, let's check for Drowning combos... | ||
| 25173 | // | ||
| 25174 |
4/4✓ Branch 0 taken 2625640 times.
✓ Branch 1 taken 4738553 times.
✓ Branch 2 taken 2904 times.
✓ Branch 3 taken 2622736 times.
|
7364193 | if(get_qr(qr_DROWN) || CanSideSwim()) |
| 25175 | { | ||
| 25176 | 4741457 | water = onWater(false); | |
| 25177 |
4/4✓ Branch 0 taken 10958 times.
✓ Branch 1 taken 4730499 times.
✓ Branch 2 taken 10953 times.
✓ Branch 3 taken 5 times.
|
4741457 | if (water && diveclk == 1) |
| 25178 | { | ||
| 25179 | 5 | auto old_stand_z = standing_on_z; | |
| 25180 | 5 | standing_on_z = 0; | |
| 25181 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if (!onWater(false)) // player hits head on the solid above them, stay underwater longer |
| 25182 | ✗ | diveclk = 2; | |
| 25183 | 5 | standing_on_z = old_stand_z; | |
| 25184 | 5 | } | |
| 25185 | 4741457 | } | |
| 25186 | |||
| 25187 | // Pits (aka direct warps) have a bigger 'hitbox' than stairs... | ||
| 25188 | 7364193 | x1 = tx+7; | |
| 25189 | 7364193 | x2 = tx+8; | |
| 25190 | 7364193 | y1 = ty+7+(bigHitbox?0:4); | |
| 25191 | 7364193 | y2 = ty+8+(bigHitbox?0:4); | |
| 25192 | |||
| 25193 | 7364193 | rpos_handles[0] = get_rpos_handle_for_world_xy(x1, y1, 0); | |
| 25194 | 7364193 | rpos_handles[1] = get_rpos_handle_for_world_xy(x1, y2, 0); | |
| 25195 | 7364193 | rpos_handles[2] = get_rpos_handle_for_world_xy(x2, y1, 0); | |
| 25196 | 7364193 | rpos_handles[3] = get_rpos_handle_for_world_xy(x2, y2, 0); | |
| 25197 | |||
| 25198 | 7364193 | cids[0] = rpos_handles[0].data(); | |
| 25199 | 7364193 | cids[1] = rpos_handles[1].data(); | |
| 25200 | 7364193 | cids[2] = rpos_handles[2].data(); | |
| 25201 | 7364193 | cids[3] = rpos_handles[3].data(); | |
| 25202 | |||
| 25203 | 7364193 | types[0] = rpos_handles[0].ctype(); | |
| 25204 | 7364193 | scrs[0] = rpos_handles[0].scr; | |
| 25205 |
2/2✓ Branch 0 taken 7230343 times.
✓ Branch 1 taken 133850 times.
|
7364193 | if (auto ffc_handle = getFFCAt(x1, y1)) |
| 25206 | { | ||
| 25207 | 133850 | types[0] = ffc_handle->ctype(); | |
| 25208 | 133850 | cids[0] = ffc_handle->data(); | |
| 25209 | 133850 | scrs[0] = ffc_handle->scr; | |
| 25210 | 133850 | } | |
| 25211 | |||
| 25212 | 7364193 | types[1] = rpos_handles[1].ctype(); | |
| 25213 | 7364193 | scrs[1] = rpos_handles[1].scr; | |
| 25214 |
2/2✓ Branch 0 taken 7231299 times.
✓ Branch 1 taken 132894 times.
|
7364193 | if (auto ffc_handle = getFFCAt(x1, y2)) |
| 25215 | { | ||
| 25216 | 132894 | types[1] = ffc_handle->ctype(); | |
| 25217 | 132894 | cids[1] = ffc_handle->data(); | |
| 25218 | 132894 | scrs[1] = ffc_handle->scr; | |
| 25219 | 132894 | } | |
| 25220 | |||
| 25221 | 7364193 | types[2] = rpos_handles[2].ctype(); | |
| 25222 | 7364193 | scrs[2] = rpos_handles[2].scr; | |
| 25223 |
2/2✓ Branch 0 taken 7229672 times.
✓ Branch 1 taken 134521 times.
|
7364193 | if (auto ffc_handle = getFFCAt(x2, y1)) |
| 25224 | { | ||
| 25225 | 134521 | types[2] = ffc_handle->ctype(); | |
| 25226 | 134521 | cids[2] = ffc_handle->data(); | |
| 25227 | 134521 | scrs[2] = ffc_handle->scr; | |
| 25228 | 134521 | } | |
| 25229 | |||
| 25230 | 7364193 | types[3] = rpos_handles[3].ctype(); | |
| 25231 | 7364193 | scrs[3] = rpos_handles[3].scr; | |
| 25232 |
2/2✓ Branch 0 taken 7230598 times.
✓ Branch 1 taken 133595 times.
|
7364193 | if (auto ffc_handle = getFFCAt(x2, y2)) |
| 25233 | { | ||
| 25234 | 133595 | types[3] = ffc_handle->ctype(); | |
| 25235 | 133595 | cids[3] = ffc_handle->data(); | |
| 25236 | 133595 | scrs[3] = ffc_handle->scr; | |
| 25237 | 133595 | } | |
| 25238 | |||
| 25239 |
2/2✓ Branch 0 taken 29468388 times.
✓ Branch 1 taken 7364193 times.
|
36832581 | for(int32_t i=0; i<4; i++) |
| 25240 | { | ||
| 25241 |
2/2✓ Branch 0 taken 264 times.
✓ Branch 1 taken 29468124 times.
|
29468388 | if(combobuf[cids[i]].only_gentrig) |
| 25242 | { | ||
| 25243 | 264 | types[i] = cNONE; | |
| 25244 | 264 | continue; | |
| 25245 | } | ||
| 25246 |
2/2✓ Branch 0 taken 3037 times.
✓ Branch 1 taken 29465087 times.
|
29468124 | if(types[i]==cPIT) |
| 25247 | { | ||
| 25248 | 3037 | index=0; | |
| 25249 | 3037 | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 25250 | 3037 | } | |
| 25251 |
2/2✓ Branch 0 taken 5004 times.
✓ Branch 1 taken 29460083 times.
|
29465087 | else if(types[i]==cPITB) |
| 25252 | { | ||
| 25253 | 5004 | types[i]=cPIT; | |
| 25254 | 5004 | index=1; | |
| 25255 | 5004 | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 25256 | 5004 | } | |
| 25257 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 29460083 times.
|
29460083 | else if(types[i]==cPITC) |
| 25258 | { | ||
| 25259 | ✗ | types[i]=cPIT; | |
| 25260 | ✗ | index=2; | |
| 25261 | ✗ | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 25262 | ✗ | } | |
| 25263 |
2/2✓ Branch 0 taken 29460081 times.
✓ Branch 1 taken 2 times.
|
29460083 | else if(types[i]==cPITD) |
| 25264 | { | ||
| 25265 | 2 | types[i]=cPIT; | |
| 25266 | 2 | index=3; | |
| 25267 | 2 | warpsfx2 = combobuf[cids[i]].attribytes[0]; | |
| 25268 | 2 | } | |
| 25269 | 29468124 | } | |
| 25270 | |||
| 25271 |
8/8✓ Branch 0 taken 7365092 times.
✓ Branch 1 taken 3983 times.
✓ Branch 2 taken 7365074 times.
✓ Branch 3 taken 18 times.
✓ Branch 4 taken 7364876 times.
✓ Branch 5 taken 198 times.
✓ Branch 6 taken 2366 times.
✓ Branch 7 taken 7362510 times.
|
7364193 | if(types[0]==cPIT||types[1]==cPIT||types[2]==cPIT||types[3]==cPIT) |
| 25272 |
3/8✓ Branch 0 taken 2221 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2221 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2221 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
8786 | if(action!=freeze&&action!=sideswimfreeze&& (!msg_active || !get_qr(qr_MSGFREEZE))) |
| 25273 | 2221 | type = cPIT; | |
| 25274 | |||
| 25275 | // | ||
| 25276 | // Time to act on our results for type, flag, flag2 and flag3... | ||
| 25277 | // | ||
| 25278 |
3/4✓ Branch 0 taken 229 times.
✓ Branch 1 taken 7364502 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 229 times.
|
7364731 | if(type==cSAVE&&cur_screen<128) |
| 25279 | 229 | *ls=1; | |
| 25280 | |||
| 25281 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 7364731 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
7364731 | if(type==cSAVE2&&cur_screen<128) |
| 25282 | ✗ | *ls=2; | |
| 25283 | |||
| 25284 |
7/8✓ Branch 0 taken 7356747 times.
✓ Branch 1 taken 7984 times.
✓ Branch 2 taken 7340332 times.
✓ Branch 3 taken 16415 times.
✓ Branch 4 taken 7339802 times.
✓ Branch 5 taken 530 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 7339802 times.
|
7364731 | if(refilling==REFILL_LIFE || flag==mfFAIRY||flag2==mfFAIRY||flag3==mfFAIRY) |
| 25285 | { | ||
| 25286 | 24929 | fairycircle(REFILL_LIFE); | |
| 25287 | |||
| 25288 |
2/2✓ Branch 0 taken 4332 times.
✓ Branch 1 taken 20597 times.
|
24929 | if(fairyclk!=0) return; |
| 25289 | 4332 | } | |
| 25290 | |||
| 25291 |
6/8✓ Branch 0 taken 7344120 times.
✓ Branch 1 taken 14 times.
✓ Branch 2 taken 7344038 times.
✓ Branch 3 taken 82 times.
✓ Branch 4 taken 7344038 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 7344038 times.
|
7344134 | if(refilling==REFILL_MAGIC || flag==mfMAGICFAIRY||flag2==mfMAGICFAIRY||flag3==mfMAGICFAIRY) |
| 25292 | { | ||
| 25293 | 96 | fairycircle(REFILL_MAGIC); | |
| 25294 | |||
| 25295 |
2/2✓ Branch 0 taken 95 times.
✓ Branch 1 taken 1 times.
|
96 | if(fairyclk!=0) return; |
| 25296 | 1 | } | |
| 25297 | |||
| 25298 |
7/8✓ Branch 0 taken 7343427 times.
✓ Branch 1 taken 612 times.
✓ Branch 2 taken 7342043 times.
✓ Branch 3 taken 1384 times.
✓ Branch 4 taken 7341875 times.
✓ Branch 5 taken 168 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 7341875 times.
|
7344039 | if(refilling==REFILL_ALL || flag==mfALLFAIRY||flag2==mfALLFAIRY||flag3==mfALLFAIRY) |
| 25299 | { | ||
| 25300 | 2164 | fairycircle(REFILL_ALL); | |
| 25301 | |||
| 25302 |
2/2✓ Branch 0 taken 2070 times.
✓ Branch 1 taken 94 times.
|
2164 | if(fairyclk!=0) return; |
| 25303 | 94 | } | |
| 25304 | |||
| 25305 | // Just in case Hero was moved off of the fairy flag | ||
| 25306 |
1/2✓ Branch 0 taken 7341969 times.
✗ Branch 1 not taken.
|
7341969 | if(refilling==REFILL_FAIRYDONE) |
| 25307 | { | ||
| 25308 | ✗ | fairycircle(REFILL_NONE); | |
| 25309 | |||
| 25310 | ✗ | if(fairyclk!=0) return; | |
| 25311 | ✗ | } | |
| 25312 | |||
| 25313 |
5/8✓ Branch 0 taken 7341959 times.
✓ Branch 1 taken 10 times.
✓ Branch 2 taken 7341959 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 7341959 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 7341959 times.
|
7341969 | if(flag==mfZELDA||flag2==mfZELDA||flag3==mfZELDA || combo_class_buf[type].win_game) |
| 25314 | { | ||
| 25315 | 10 | attackclk = 0; //get rid of Hero's sword if it was stuck out, charged. | |
| 25316 | 10 | win_game(); | |
| 25317 | 10 | return; | |
| 25318 | } | ||
| 25319 | |||
| 25320 |
4/4✓ Branch 0 taken 7322623 times.
✓ Branch 1 taken 19336 times.
✓ Branch 2 taken 7322903 times.
✓ Branch 3 taken 19056 times.
|
7341959 | if((z>0 || fakez>0) && !(hero_scr->flags2&fAIRCOMBOS)) |
| 25321 | 19056 | return; | |
| 25322 | |||
| 25323 |
4/4✓ Branch 0 taken 7320270 times.
✓ Branch 1 taken 2633 times.
✓ Branch 2 taken 728 times.
✓ Branch 3 taken 7319542 times.
|
7322903 | if((type==cTRIGNOFLAG || type==cTRIGFLAG)) |
| 25324 | { | ||
| 25325 |
4/4✓ Branch 0 taken 2089 times.
✓ Branch 1 taken 1272 times.
✓ Branch 2 taken 1593 times.
✓ Branch 3 taken 496 times.
|
3361 | if (COMBOPOS_REGION(tx+8, ty+8)!=stepsecret || get_qr(qr_TRIGGERSREPEAT)) |
| 25326 | { | ||
| 25327 | 2865 | stepsecret = COMBOPOS_REGION(tx+8, ty+8); | |
| 25328 | 2865 | auto rpos_handle = get_rpos_handle(stepsecret, 0); | |
| 25329 | 2865 | sfx(combobuf[MAPCOMBO(rpos_handle)].attribytes[0],pan((int32_t)x)); | |
| 25330 | |||
| 25331 |
4/4✓ Branch 0 taken 232 times.
✓ Branch 1 taken 2633 times.
✓ Branch 2 taken 27 times.
✓ Branch 3 taken 205 times.
|
2865 | if(type==cTRIGFLAG && canPermSecret(cur_dmap, rpos_handle.screen)) |
| 25332 | { | ||
| 25333 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 205 times.
|
205 | if(!(rpos_handle.scr->flags5&fTEMPSECRETS)) setmapflag(rpos_handle.scr, mSECRET); |
| 25334 | |||
| 25335 | 205 | trigger_secrets_for_screen(TriggerSource::Unspecified, rpos_handle.base_scr(), false); | |
| 25336 | 205 | } | |
| 25337 | else | ||
| 25338 | { | ||
| 25339 | 2660 | bool only16_31 = get_qr(qr_STEPTEMP_SECRET_ONLY_16_31)?true:false; | |
| 25340 | 2660 | trigger_secrets_for_screen(TriggerSource::Unspecified, rpos_handle.base_scr(), only16_31); | |
| 25341 | } | ||
| 25342 | 2865 | } | |
| 25343 | 3361 | } | |
| 25344 |
2/2✓ Branch 0 taken 1428 times.
✓ Branch 1 taken 7318114 times.
|
7319542 | else if(!didstrig) |
| 25345 | { | ||
| 25346 | 7318114 | stepsecret = rpos_t::None; | |
| 25347 | 7318114 | } | |
| 25348 | |||
| 25349 | //Better? Dock collision | ||
| 25350 | |||
| 25351 | // Drown if: | ||
| 25352 | // * Water (obviously walkable), | ||
| 25353 | // * Quest Rule allows it, | ||
| 25354 | // * Not on stepladder, | ||
| 25355 | // * Not jumping, | ||
| 25356 | // * Not hovering, | ||
| 25357 | // * Not rafting, | ||
| 25358 | // * Not swallowed, | ||
| 25359 | // * Not a dried lake. | ||
| 25360 | |||
| 25361 | // This used to check for swimming too, but I moved that into the block so that you can drown in higher-leveled water. -Dimi | ||
| 25362 | // Moved some of the checks into `onWater()`, others into `drown_check()` -Em | ||
| 25363 |
3/6✓ Branch 0 taken 10922 times.
✓ Branch 1 taken 7311981 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 10922 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
7322903 | if(water > 0 && (get_qr(qr_DROWN) || CanSideSwim())) |
| 25364 | { | ||
| 25365 |
2/2✓ Branch 0 taken 421 times.
✓ Branch 1 taken 10501 times.
|
10922 | if(drown_check(water)) |
| 25366 | { | ||
| 25367 |
3/4✓ Branch 0 taken 219 times.
✓ Branch 1 taken 202 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 219 times.
|
421 | if(!ladderx && !laddery) |
| 25368 | { | ||
| 25369 | 219 | drownCombo = water; | |
| 25370 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 211 times.
|
219 | if (combobuf[water].usrflags&cflag1) |
| 25371 | 8 | Drown(1); | |
| 25372 | 211 | else Drown(); | |
| 25373 |
2/2✓ Branch 0 taken 203 times.
✓ Branch 1 taken 16 times.
|
219 | if(byte drown_sfx = combobuf[water].attribytes[4]) |
| 25374 | 16 | sfx(drown_sfx, pan(x)); | |
| 25375 | 219 | } | |
| 25376 | 421 | } | |
| 25377 |
2/2✓ Branch 0 taken 10237 times.
✓ Branch 1 taken 264 times.
|
10501 | else if (!isSwimming()) |
| 25378 | { | ||
| 25379 | 264 | SetSwim(); | |
| 25380 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 264 times.
|
264 | if (!IsSideSwim()) attackclk = charging = spins = 0; |
| 25381 | 264 | landswim=0; | |
| 25382 | 264 | return; | |
| 25383 | } | ||
| 25384 | 10658 | } | |
| 25385 | |||
| 25386 | |||
| 25387 |
2/2✓ Branch 0 taken 334 times.
✓ Branch 1 taken 7322305 times.
|
7322639 | if(type==cSTEP) |
| 25388 | { | ||
| 25389 | 334 | rpos_t next_step = COMBOPOS_REGION(tx+8, ty+8); | |
| 25390 |
2/2✓ Branch 0 taken 148 times.
✓ Branch 1 taken 186 times.
|
334 | if (next_step != stepnext) |
| 25391 | { | ||
| 25392 | 186 | stepnext = next_step; | |
| 25393 | 186 | auto rpos_handle = get_rpos_handle(stepnext, 0); | |
| 25394 | 186 | int cid = MAPCOMBO(rpos_handle); | |
| 25395 | |||
| 25396 | if | ||
| 25397 | ( | ||
| 25398 |
2/2✓ Branch 0 taken 167 times.
✓ Branch 1 taken 19 times.
|
186 | COMBOTYPE(tx+8,ty+8)==cSTEP && /*required item*/ |
| 25399 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 167 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
167 | (!combobuf[cid].attribytes[1] || (combobuf[cid].attribytes[1] && game->item[combobuf[cid].attribytes[1]]) ) |
| 25400 | ✗ | && /*HEAVY*/ | |
| 25401 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 167 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
167 | ( ( !(combobuf[cid].usrflags&cflag1) ) || ((combobuf[cid].usrflags&cflag1) && Hero.HasHeavyBoots() ) ) |
| 25402 | ) | ||
| 25403 | { | ||
| 25404 | 167 | sfx(combobuf[cid].attribytes[0],pan((int32_t)x)); | |
| 25405 | 167 | rpos_handle.increment_data(); | |
| 25406 | 167 | } | |
| 25407 | |||
| 25408 | if | ||
| 25409 | ( | ||
| 25410 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 186 times.
|
186 | COMBOTYPE(tx+8,ty+8)==cSTEPSAME && /*required item*/ |
| 25411 | ✗ | (!combobuf[cid].attribytes[1] || (combobuf[cid].attribytes[1] && game->item[combobuf[cid].attribytes[1]]) ) | |
| 25412 | ✗ | && /*HEAVY*/ | |
| 25413 | ✗ | ( ( !(combobuf[cid].usrflags&cflag1) ) || ((combobuf[cid].usrflags&cflag1) && Hero.HasHeavyBoots() ) ) | |
| 25414 | ) | ||
| 25415 | { | ||
| 25416 | ✗ | sfx(combobuf[cid].attribytes[0],pan((int32_t)x)); | |
| 25417 | ✗ | for_every_rpos([&](const rpos_handle_t& rpos_handle) { | |
| 25418 | ✗ | if (rpos_handle.data() == cid) | |
| 25419 | ✗ | rpos_handle.increment_data(); | |
| 25420 | ✗ | }); | |
| 25421 | ✗ | } | |
| 25422 | |||
| 25423 | if | ||
| 25424 | ( | ||
| 25425 |
2/2✓ Branch 0 taken 7 times.
✓ Branch 1 taken 179 times.
|
186 | COMBOTYPE(tx+8,ty+8)==cSTEPALL && /*required item*/ |
| 25426 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
7 | (!combobuf[MAPCOMBO(tx+8,ty+8)].attribytes[1] || (combobuf[cid].attribytes[1] && game->item[combobuf[cid].attribytes[1]]) ) |
| 25427 | ✗ | && /*HEAVY*/ | |
| 25428 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 7 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
7 | ( ( !(combobuf[cid].usrflags&cflag1) ) || ((combobuf[cid].usrflags&cflag1) && Hero.HasHeavyBoots() ) ) |
| 25429 | ) | ||
| 25430 | { | ||
| 25431 | 7 | sfx(combobuf[cid].attribytes[0],pan((int32_t)x)); | |
| 25432 | |||
| 25433 | 1239 | for_every_rpos([&](const rpos_handle_t& rpos_handle) { | |
| 25434 |
2/2✓ Branch 0 taken 1051 times.
✓ Branch 1 taken 181 times.
|
1232 | if (isStepType(rpos_handle.ctype())) |
| 25435 | 181 | rpos_handle.increment_data(); | |
| 25436 | 1232 | }); | |
| 25437 | 7 | } | |
| 25438 | 186 | } | |
| 25439 | 334 | } | |
| 25440 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 7322305 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
7322305 | else if(type==cSTEPSFX && action == walking) |
| 25441 | { | ||
| 25442 | ✗ | trigger_stepfx(get_rpos_handle_for_world_xy(tx + 8, ty + 8, 0), true); | |
| 25443 | ✗ | } | |
| 25444 | 7322305 | else stepnext = rpos_t::None; | |
| 25445 | |||
| 25446 | 7322639 | detail_int[0]=tx; | |
| 25447 | 7322639 | detail_int[1]=ty; | |
| 25448 | |||
| 25449 | |||
| 25450 |
8/8✓ Branch 0 taken 7322181 times.
✓ Branch 1 taken 458 times.
✓ Branch 2 taken 881 times.
✓ Branch 3 taken 7321758 times.
✓ Branch 4 taken 7319577 times.
✓ Branch 5 taken 2181 times.
✓ Branch 6 taken 14 times.
✓ Branch 7 taken 11 times.
|
7322664 | if(!((type==cCAVE || type==cCAVE2) && z==0 && fakez==0) && type!=cSTAIR && |
| 25451 |
5/6✓ Branch 0 taken 7318625 times.
✓ Branch 1 taken 952 times.
✓ Branch 2 taken 7318604 times.
✓ Branch 3 taken 21 times.
✓ Branch 4 taken 7318604 times.
✗ Branch 5 not taken.
|
7319577 | type!=cPIT && type!=cSWIMWARP && type!=cRESET && |
| 25452 |
2/2✓ Branch 0 taken 25 times.
✓ Branch 1 taken 7318579 times.
|
7318604 | !(type==cDIVEWARP && isDiving())) |
| 25453 | 7318590 | { | |
| 25454 | RaftingStuff: | ||
| 25455 |
2/2✓ Branch 0 taken 6815921 times.
✓ Branch 1 taken 512754 times.
|
7328675 | if (get_qr(qr_BETTER_RAFT_2)) |
| 25456 | { | ||
| 25457 | 512754 | bool doraft = true; | |
| 25458 |
5/6✓ Branch 0 taken 512754 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 23241 times.
✓ Branch 3 taken 489513 times.
✓ Branch 4 taken 2453 times.
✓ Branch 5 taken 20788 times.
|
512754 | if(((int32_t)y>=raftwarpy-12&&(int32_t)y<=raftwarpy+3)&&raftwarpy!=-1) |
| 25459 | { | ||
| 25460 |
5/6✓ Branch 0 taken 20788 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 10156 times.
✓ Branch 3 taken 10632 times.
✓ Branch 4 taken 127 times.
✓ Branch 5 taken 10029 times.
|
20788 | if(((int32_t)x>=raftwarpx-8&&(int32_t)x<=raftwarpx+7)&&raftwarpx!=-1) |
| 25461 | { | ||
| 25462 | 10029 | doraft = false; | |
| 25463 | 10029 | } | |
| 25464 | 20788 | } | |
| 25465 | //if (mfRAFT) | ||
| 25466 | int32_t rafttypes[2]; | ||
| 25467 | 512754 | int32_t raftx1 = tx+6; | |
| 25468 | 512754 | int32_t raftx2 = tx+9; | |
| 25469 | 512754 | int32_t rafty = ty+11; | |
| 25470 | int32_t raftflags[3]; | ||
| 25471 | 512754 | rafttypes[0]=rafttypes[1]=-1; | |
| 25472 | 512754 | raftflags[0]=raftflags[1]=raftflags[2]=0; | |
| 25473 | 512754 | rafttypes[0] = MAPFLAG(raftx1,rafty); | |
| 25474 | 512754 | rafttypes[1] = MAPFLAG(raftx2,rafty); | |
| 25475 | |||
| 25476 |
2/2✓ Branch 0 taken 1954 times.
✓ Branch 1 taken 510800 times.
|
512754 | if(rafttypes[0]==rafttypes[1]) |
| 25477 | 510800 | raftflags[0] = rafttypes[0]; | |
| 25478 | |||
| 25479 | |||
| 25480 | 512754 | rafttypes[0] = MAPCOMBOFLAG(raftx1,rafty); | |
| 25481 | 512754 | rafttypes[1] = MAPCOMBOFLAG(raftx2,rafty); | |
| 25482 | |||
| 25483 |
2/2✓ Branch 0 taken 280 times.
✓ Branch 1 taken 512474 times.
|
512754 | if(rafttypes[0]==rafttypes[1]) |
| 25484 | 512474 | raftflags[1] = rafttypes[0]; | |
| 25485 | |||
| 25486 | 512754 | rafttypes[0] = MAPFFCOMBOFLAG(raftx1,rafty); | |
| 25487 | 512754 | rafttypes[1] = MAPFFCOMBOFLAG(raftx2,rafty); | |
| 25488 | |||
| 25489 |
2/2✓ Branch 0 taken 22 times.
✓ Branch 1 taken 512732 times.
|
512754 | if(rafttypes[0]==rafttypes[1]) |
| 25490 | 512732 | raftflags[2] = rafttypes[0]; | |
| 25491 | |||
| 25492 |
2/2✓ Branch 0 taken 1538262 times.
✓ Branch 1 taken 512754 times.
|
2051016 | for (int32_t m = 0; m < 3; ++m) |
| 25493 | { | ||
| 25494 |
3/4✓ Branch 0 taken 1537701 times.
✓ Branch 1 taken 561 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1537701 times.
|
1538262 | if (raftflags[m] == mfRAFT || raftflags[m] == mfRAFT_BRANCH) |
| 25495 | { | ||
| 25496 |
10/18✓ Branch 0 taken 536 times.
✓ Branch 1 taken 25 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 535 times.
✓ Branch 4 taken 1 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 1 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 1 times.
✗ Branch 13 not taken.
✗ Branch 14 not taken.
✓ Branch 15 taken 1 times.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
|
561 | if(current_item(itype_raft) && action!=rafting && action!=swimhit && action!=gothit && action!=sideswimhit && z==0 && fakez==0 && (combo_class_buf[COMBOTYPE(tx+8, ty+11)].dock || combo_class_buf[FFCOMBOTYPE(tx+8, ty+11)].dock)) |
| 25497 | { | ||
| 25498 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1 | if((isRaftFlag(nextflag(tx,ty+11,dir,false))||isRaftFlag(nextflag(tx,ty+11,dir,true)))) |
| 25499 | { | ||
| 25500 | 1 | reset_swordcharge(); | |
| 25501 | 1 | action=rafting; FFCore.setHeroAction(rafting); | |
| 25502 | 1 | raftclk=0; | |
| 25503 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | if (get_qr(qr_RAFT_SOUND)) sfx(itemsbuf[current_item_id(itype_raft)].usesound,pan(x)); |
| 25504 | 1 | else sfx(get_scr_for_world_xy(tx,ty+11)->secretsfx); | |
| 25505 | 1 | } | |
| 25506 | ✗ | else if (get_qr(qr_BETTER_RAFT) && doraft) | |
| 25507 | { | ||
| 25508 | ✗ | for (int32_t i = 0; i < 4; ++i) | |
| 25509 | { | ||
| 25510 | ✗ | if(isRaftFlag(nextflag(GridX(tx+8),GridY(ty+11),i,false))||isRaftFlag(nextflag(GridX(tx+8),GridY(ty+11),i,true))) | |
| 25511 | { | ||
| 25512 | ✗ | reset_swordcharge(); | |
| 25513 | ✗ | action=rafting; FFCore.setHeroAction(rafting); | |
| 25514 | ✗ | raftclk=0; | |
| 25515 | ✗ | if (get_qr(qr_RAFT_SOUND)) sfx(itemsbuf[current_item_id(itype_raft)].usesound,pan(x)); | |
| 25516 | ✗ | else sfx(get_scr_for_world_xy(tx+8,ty+11)->secretsfx); | |
| 25517 | ✗ | dir = i; | |
| 25518 | ✗ | break; | |
| 25519 | } | ||
| 25520 | ✗ | } | |
| 25521 | ✗ | } | |
| 25522 | 1 | } | |
| 25523 | 561 | } | |
| 25524 | 1538262 | } | |
| 25525 | 512754 | } | |
| 25526 |
2/2✓ Branch 0 taken 10085 times.
✓ Branch 1 taken 7318590 times.
|
7328675 | if (RaftPass) return; |
| 25527 |
3/3✓ Branch 0 taken 34546 times.
✓ Branch 1 taken 7282984 times.
✓ Branch 2 taken 1060 times.
|
7318590 | switch(flag) |
| 25528 | { | ||
| 25529 | case mfDIVE_ITEM: | ||
| 25530 |
6/8✓ Branch 0 taken 24 times.
✓ Branch 1 taken 1036 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 24 times.
✓ Branch 4 taken 9 times.
✓ Branch 5 taken 15 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 9 times.
|
1060 | if(isDiving() && (!getmapflag(flag_scr, (cur_screen < 128 && get_qr(qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM) || (flag_scr->flags9&fBELOWRETURN))) |
| 25531 | { | ||
| 25532 | 30 | additem(x, y, flag_scr->catchall, | |
| 25533 | 15 | ipONETIME2 | ipBIGRANGE | ipHOLDUP | ipNODRAW | ((flag_scr->flags8&fITEMSECRET) ? ipSECRETS : 0)); | |
| 25534 | 15 | sfx(flag_scr->secretsfx); | |
| 25535 | 15 | } | |
| 25536 | |||
| 25537 | 1060 | return; | |
| 25538 | |||
| 25539 | case mfRAFT: | ||
| 25540 | case mfRAFT_BRANCH: | ||
| 25541 | |||
| 25542 | // if(current_item(itype_raft) && action!=rafting && action!=swimhit && action!=gothit && type==cOLD_DOCK) | ||
| 25543 |
2/2✓ Branch 0 taken 515 times.
✓ Branch 1 taken 34031 times.
|
34546 | if (!get_qr(qr_BETTER_RAFT_2)) |
| 25544 | { | ||
| 25545 | 34031 | bool doraft = true; | |
| 25546 |
5/6✓ Branch 0 taken 34031 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2122 times.
✓ Branch 3 taken 31909 times.
✓ Branch 4 taken 576 times.
✓ Branch 5 taken 1546 times.
|
34031 | if(((int32_t)y>=raftwarpy-8&&(int32_t)y<=raftwarpy+7)&&raftwarpy!=-1) |
| 25547 | { | ||
| 25548 |
5/6✓ Branch 0 taken 1546 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 808 times.
✓ Branch 3 taken 738 times.
✓ Branch 4 taken 23 times.
✓ Branch 5 taken 785 times.
|
1546 | if(((int32_t)x>=raftwarpx-8&&(int32_t)x<=raftwarpx+7)&&raftwarpx!=-1) |
| 25549 | { | ||
| 25550 | 785 | doraft = false; | |
| 25551 | 785 | } | |
| 25552 | 1546 | } | |
| 25553 |
13/16✓ Branch 0 taken 31056 times.
✓ Branch 1 taken 2975 times.
✓ Branch 2 taken 3282 times.
✓ Branch 3 taken 27774 times.
✓ Branch 4 taken 3262 times.
✓ Branch 5 taken 20 times.
✓ Branch 6 taken 3251 times.
✓ Branch 7 taken 11 times.
✓ Branch 8 taken 3251 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 3251 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 3251 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 1531 times.
✓ Branch 15 taken 1720 times.
|
34031 | if(current_item(itype_raft) && action!=rafting && action!=swimhit && action!=gothit && action!=sideswimhit && z==0 && fakez==0 && combo_class_buf[type].dock) |
| 25554 | { | ||
| 25555 |
3/4✓ Branch 0 taken 1365 times.
✓ Branch 1 taken 355 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1365 times.
|
1720 | if(isRaftFlag(nextflag(tx,ty,dir,false))||isRaftFlag(nextflag(tx,ty,dir,true))) |
| 25556 | { | ||
| 25557 | 355 | reset_swordcharge(); | |
| 25558 | 355 | action=rafting; FFCore.setHeroAction(rafting); | |
| 25559 | 355 | raftclk=0; | |
| 25560 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 355 times.
|
355 | if (get_qr(qr_RAFT_SOUND)) sfx(itemsbuf[current_item_id(itype_raft)].usesound,pan(x)); |
| 25561 | 355 | else sfx(get_scr_for_world_xy(tx,ty)->secretsfx); | |
| 25562 | 355 | } | |
| 25563 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1365 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1365 | else if (get_qr(qr_BETTER_RAFT) && doraft) |
| 25564 | { | ||
| 25565 | ✗ | for (int32_t i = 0; i < 4; ++i) | |
| 25566 | { | ||
| 25567 | ✗ | if(isRaftFlag(nextflag(GridX(tx+8),GridY(ty+8),i,false))||isRaftFlag(nextflag(GridX(tx+8),GridY(ty+8),i,true))) | |
| 25568 | { | ||
| 25569 | ✗ | reset_swordcharge(); | |
| 25570 | ✗ | action=rafting; FFCore.setHeroAction(rafting); | |
| 25571 | ✗ | raftclk=0; | |
| 25572 | ✗ | if (get_qr(qr_RAFT_SOUND)) sfx(itemsbuf[current_item_id(itype_raft)].usesound,pan(x)); | |
| 25573 | ✗ | else sfx(get_scr_for_world_xy(tx+8,ty+8)->secretsfx); | |
| 25574 | ✗ | dir = i; | |
| 25575 | ✗ | break; | |
| 25576 | } | ||
| 25577 | ✗ | } | |
| 25578 | ✗ | } | |
| 25579 | 1720 | } | |
| 25580 | 34031 | } | |
| 25581 | |||
| 25582 | 34546 | return; | |
| 25583 | |||
| 25584 | default: | ||
| 25585 | 7282984 | break; | |
| 25586 | //return; | ||
| 25587 | } | ||
| 25588 | |||
| 25589 |
2/3✓ Branch 0 taken 274 times.
✓ Branch 1 taken 7282710 times.
✗ Branch 2 not taken.
|
7282984 | switch(flag2) |
| 25590 | { | ||
| 25591 | case mfDIVE_ITEM: | ||
| 25592 | ✗ | if(isDiving() && (!getmapflag(flag2_scr, (cur_screen < 128 && get_qr(qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM) || (flag2_scr->flags9&fBELOWRETURN))) | |
| 25593 | { | ||
| 25594 | ✗ | additem(x, y, flag2_scr->catchall, | |
| 25595 | ✗ | ipONETIME2 | ipBIGRANGE | ipHOLDUP | ipNODRAW | ((flag2_scr->flags8&fITEMSECRET) ? ipSECRETS : 0)); | |
| 25596 | ✗ | sfx(flag2_scr->secretsfx); | |
| 25597 | ✗ | } | |
| 25598 | |||
| 25599 | ✗ | return; | |
| 25600 | |||
| 25601 | case mfRAFT: | ||
| 25602 | case mfRAFT_BRANCH: | ||
| 25603 | |||
| 25604 | // if(current_item(itype_raft) && action!=rafting && action!=swimhit && action!=gothit && type==cOLD_DOCK) | ||
| 25605 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 274 times.
|
274 | if (!get_qr(qr_BETTER_RAFT_2)) |
| 25606 | { | ||
| 25607 | 274 | bool doraft = true; | |
| 25608 |
2/6✓ Branch 0 taken 274 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 274 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
274 | if(((int32_t)y>=raftwarpy-8&&(int32_t)y<=raftwarpy+7)&&raftwarpy!=-1) |
| 25609 | { | ||
| 25610 | ✗ | if(((int32_t)x>=raftwarpx-8&&(int32_t)x<=raftwarpx+7)&&raftwarpx!=-1) | |
| 25611 | { | ||
| 25612 | ✗ | doraft = false; | |
| 25613 | ✗ | } | |
| 25614 | ✗ | } | |
| 25615 |
10/16✓ Branch 0 taken 274 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 135 times.
✓ Branch 3 taken 139 times.
✓ Branch 4 taken 135 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 135 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 135 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 135 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 135 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 121 times.
✓ Branch 15 taken 14 times.
|
274 | if(current_item(itype_raft) && action!=rafting && action!=swimhit && action!=gothit && action!=sideswimhit && z==0 && fakez==0 && combo_class_buf[type].dock) |
| 25616 | { | ||
| 25617 |
4/4✓ Branch 0 taken 10 times.
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 9 times.
|
14 | if((isRaftFlag(nextflag(tx,ty,dir,false))||isRaftFlag(nextflag(tx,ty,dir,true)))) |
| 25618 | { | ||
| 25619 | 5 | reset_swordcharge(); | |
| 25620 | 5 | action=rafting; FFCore.setHeroAction(rafting); | |
| 25621 | 5 | raftclk=0; | |
| 25622 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
|
5 | if (get_qr(qr_RAFT_SOUND)) sfx(itemsbuf[current_item_id(itype_raft)].usesound,pan(x)); |
| 25623 | 5 | else sfx(get_scr_for_world_xy(tx,ty)->secretsfx); | |
| 25624 | 5 | } | |
| 25625 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
9 | else if (get_qr(qr_BETTER_RAFT) && doraft) |
| 25626 | { | ||
| 25627 | ✗ | for (int32_t i = 0; i < 4; ++i) | |
| 25628 | { | ||
| 25629 | ✗ | if(isRaftFlag(nextflag(GridX(tx+8),GridY(ty+8),i,false))||isRaftFlag(nextflag(GridX(tx+8),GridY(ty+8),i,true))) | |
| 25630 | { | ||
| 25631 | ✗ | reset_swordcharge(); | |
| 25632 | ✗ | action=rafting; FFCore.setHeroAction(rafting); | |
| 25633 | ✗ | raftclk=0; | |
| 25634 | ✗ | if (get_qr(qr_RAFT_SOUND)) sfx(itemsbuf[current_item_id(itype_raft)].usesound,pan(x)); | |
| 25635 | ✗ | else sfx(get_scr_for_world_xy(tx+8,ty+8)->secretsfx); | |
| 25636 | ✗ | dir = i; | |
| 25637 | ✗ | break; | |
| 25638 | } | ||
| 25639 | ✗ | } | |
| 25640 | ✗ | } | |
| 25641 | 14 | } | |
| 25642 | 274 | } | |
| 25643 | |||
| 25644 | 274 | return; | |
| 25645 | |||
| 25646 | default: | ||
| 25647 | 7282710 | break; | |
| 25648 | //return; | ||
| 25649 | } | ||
| 25650 | |||
| 25651 |
1/3✗ Branch 0 not taken.
✓ Branch 1 taken 7282710 times.
✗ Branch 2 not taken.
|
7282710 | switch(flag3) |
| 25652 | { | ||
| 25653 | case mfDIVE_ITEM: | ||
| 25654 | ✗ | if(isDiving() && (!getmapflag(flag3_scr, (cur_screen < 128 && get_qr(qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM) || (flag3_scr->flags9&fBELOWRETURN))) | |
| 25655 | { | ||
| 25656 | ✗ | additem(x, y, flag3_scr->catchall, | |
| 25657 | ✗ | ipONETIME2 | ipBIGRANGE | ipHOLDUP | ipNODRAW | ((flag3_scr->flags8&fITEMSECRET) ? ipSECRETS : 0)); | |
| 25658 | ✗ | sfx(flag3_scr->secretsfx); | |
| 25659 | ✗ | } | |
| 25660 | |||
| 25661 | ✗ | return; | |
| 25662 | |||
| 25663 | case mfRAFT: | ||
| 25664 | case mfRAFT_BRANCH: | ||
| 25665 | |||
| 25666 | // if(current_item(itype_raft) && action!=rafting && action!=swimhit && action!=gothit && type==cOLD_DOCK) | ||
| 25667 | ✗ | if (!get_qr(qr_BETTER_RAFT_2)) | |
| 25668 | { | ||
| 25669 | ✗ | bool doraft = true; | |
| 25670 | ✗ | if(((int32_t)y>=raftwarpy-8&&(int32_t)y<=raftwarpy+7)&&raftwarpy!=-1) | |
| 25671 | { | ||
| 25672 | ✗ | if(((int32_t)x>=raftwarpx-8&&(int32_t)x<=raftwarpx+7)&&raftwarpx!=-1) | |
| 25673 | { | ||
| 25674 | ✗ | doraft = false; | |
| 25675 | ✗ | } | |
| 25676 | ✗ | } | |
| 25677 | ✗ | if(current_item(itype_raft) && action!=rafting && action!=swimhit && action!=gothit && action!=sideswimhit && z==0 && fakez==0 && combo_class_buf[type].dock) | |
| 25678 | { | ||
| 25679 | ✗ | if((isRaftFlag(nextflag(tx,ty,dir,false))||isRaftFlag(nextflag(tx,ty,dir,true)))) | |
| 25680 | { | ||
| 25681 | ✗ | reset_swordcharge(); | |
| 25682 | ✗ | action=rafting; FFCore.setHeroAction(rafting); | |
| 25683 | ✗ | raftclk=0; | |
| 25684 | ✗ | if (get_qr(qr_RAFT_SOUND)) sfx(itemsbuf[current_item_id(itype_raft)].usesound,pan(x)); | |
| 25685 | ✗ | else sfx(get_scr_for_world_xy(tx,ty)->secretsfx); | |
| 25686 | ✗ | } | |
| 25687 | ✗ | else if (get_qr(qr_BETTER_RAFT) && doraft) | |
| 25688 | { | ||
| 25689 | ✗ | for (int32_t i = 0; i < 4; ++i) | |
| 25690 | { | ||
| 25691 | ✗ | if(isRaftFlag(nextflag(GridX(tx+8),GridY(ty+8),i,false))||isRaftFlag(nextflag(GridX(tx+8),GridY(ty+8),i,true))) | |
| 25692 | { | ||
| 25693 | ✗ | reset_swordcharge(); | |
| 25694 | ✗ | action=rafting; FFCore.setHeroAction(rafting); | |
| 25695 | ✗ | raftclk=0; | |
| 25696 | ✗ | if (get_qr(qr_RAFT_SOUND)) sfx(itemsbuf[current_item_id(itype_raft)].usesound,pan(x)); | |
| 25697 | ✗ | else sfx(get_scr_for_world_xy(tx+8,ty+8)->secretsfx); | |
| 25698 | ✗ | dir = i; | |
| 25699 | ✗ | break; | |
| 25700 | } | ||
| 25701 | ✗ | } | |
| 25702 | ✗ | } | |
| 25703 | ✗ | } | |
| 25704 | ✗ | } | |
| 25705 | |||
| 25706 | ✗ | return; | |
| 25707 | |||
| 25708 | default: | ||
| 25709 | 7282710 | return; | |
| 25710 | } | ||
| 25711 | } | ||
| 25712 | |||
| 25713 | // Either the screen the hero is currently in, or if in a 0x80 room the screen player came from. | ||
| 25714 |
2/2✓ Branch 0 taken 57 times.
✓ Branch 1 taken 3992 times.
|
4049 | mapscr* base_scr = cur_screen >= 128 ? special_warp_return_scr : hero_scr; |
| 25715 | |||
| 25716 |
3/4✓ Branch 0 taken 3591 times.
✓ Branch 1 taken 458 times.
✓ Branch 2 taken 4049 times.
✗ Branch 3 not taken.
|
4049 | if((type==cCAVE || type==cCAVE2) && (base_scr->tilewarptype[index]==wtNOWARP)) return; |
| 25717 | |||
| 25718 | 4049 | bool skippedaframe=false; | |
| 25719 | |||
| 25720 |
6/6✓ Branch 0 taken 3591 times.
✓ Branch 1 taken 458 times.
✓ Branch 2 taken 3168 times.
✓ Branch 3 taken 423 times.
✓ Branch 4 taken 2181 times.
✓ Branch 5 taken 987 times.
|
4049 | if(type==cCAVE || type==cCAVE2 || type==cSTAIR) |
| 25721 | { | ||
| 25722 | // Stop music only if: | ||
| 25723 | // * entering a Guy Cave | ||
| 25724 | // * warping to a DMap whose music is different. | ||
| 25725 | |||
| 25726 | 3062 | int32_t tdm = base_scr->tilewarpdmap[index]; | |
| 25727 | |||
| 25728 |
2/2✓ Branch 0 taken 957 times.
✓ Branch 1 taken 2105 times.
|
3062 | if(base_scr->tilewarptype[index]<=wtPASS) |
| 25729 | { | ||
| 25730 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 957 times.
|
957 | if (FFCore.can_dmap_change_music(tdm)) |
| 25731 | { | ||
| 25732 |
3/4✓ Branch 0 taken 488 times.
✓ Branch 1 taken 469 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 488 times.
|
957 | if ((DMaps[cur_dmap].flags & dmfCAVES) && base_scr->tilewarptype[index] == wtCAVE) |
| 25733 | 488 | music_stop(); | |
| 25734 | 957 | } | |
| 25735 | 957 | } | |
| 25736 | else | ||
| 25737 | { | ||
| 25738 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2105 times.
|
2105 | if (FFCore.can_dmap_change_music(tdm)) |
| 25739 | { | ||
| 25740 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2105 times.
|
2105 | if (zcmusic != NULL) |
| 25741 | { | ||
| 25742 | ✗ | if (strcmp(zcmusic->filename, DMaps[tdm].tmusic) != 0 || | |
| 25743 | ✗ | (zcmusic->type == ZCMF_GME && zcmusic->track != DMaps[tdm].tmusictrack)) | |
| 25744 | ✗ | music_stop(); | |
| 25745 | ✗ | } | |
| 25746 |
2/4✓ Branch 0 taken 2105 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 2105 times.
|
2105 | else if (DMaps[hero_scr->tilewarpdmap[index]].midi != (currmidi - ZC_MIDI_COUNT + 4) && |
| 25747 | 2105 | get_canonical_scr(DMaps[tdm].map, base_scr->tilewarpscr[index] + DMaps[tdm].xoff)->screen_midi != (currmidi - ZC_MIDI_COUNT + 4)) | |
| 25748 | 2105 | music_stop(); | |
| 25749 | 2105 | } | |
| 25750 | } | ||
| 25751 | |||
| 25752 | 3062 | stop_sfx(QMisc.miscsfx[sfxLOWHEART]); | |
| 25753 |
5/6✓ Branch 0 taken 957 times.
✓ Branch 1 taken 2105 times.
✓ Branch 2 taken 488 times.
✓ Branch 3 taken 469 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 488 times.
|
3062 | bool opening = (base_scr->tilewarptype[index]<=wtPASS && !(DMaps[cur_dmap].flags&dmfCAVES && base_scr->tilewarptype[index]==wtCAVE) |
| 25754 | 2593 | ? false : COOLSCROLL); | |
| 25755 | |||
| 25756 | 3062 | FFCore.warpScriptCheck(); | |
| 25757 | 3062 | draw_screen(); | |
| 25758 | 3062 | advanceframe(true); | |
| 25759 | |||
| 25760 | 3062 | skippedaframe=true; | |
| 25761 | |||
| 25762 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 2639 times.
|
3062 | if(type==cCAVE2) walkup2(opening); |
| 25763 |
2/2✓ Branch 0 taken 2181 times.
✓ Branch 1 taken 458 times.
|
2639 | else if(type==cCAVE) walkdown(opening); |
| 25764 | 3062 | } | |
| 25765 | |||
| 25766 |
2/2✓ Branch 0 taken 3097 times.
✓ Branch 1 taken 952 times.
|
4049 | if(type==cPIT) |
| 25767 | { | ||
| 25768 | 952 | setpit(); | |
| 25769 | 952 | warp_sound = warpsfx2; | |
| 25770 | 952 | } | |
| 25771 | |||
| 25772 | 4049 | mapscr* scr = nullptr; | |
| 25773 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 8098 times.
✓ Branch 2 taken 4049 times.
✓ Branch 3 taken 4049 times.
|
8098 | for (int i = 0; i < 4 && !scr; i++) scr = scrs[i]; |
| 25774 |
1/2✓ Branch 0 taken 4049 times.
✗ Branch 1 not taken.
|
4049 | if (!scr) scr = hero_scr; |
| 25775 | |||
| 25776 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 57 times.
|
4106 | if (!is_in_scrolling_region() |
| 25777 |
2/2✓ Branch 0 taken 4047 times.
✓ Branch 1 taken 2 times.
|
4049 | && DMaps[cur_dmap].flags&dmf3STAIR |
| 25778 |
4/4✓ Branch 0 taken 1483 times.
✓ Branch 1 taken 2564 times.
✓ Branch 2 taken 1426 times.
✓ Branch 3 taken 57 times.
|
4047 | && (cur_screen==129 || !(DMaps[cur_dmap].flags&dmfGUYCAVES)) |
| 25779 |
7/8✓ Branch 0 taken 1269 times.
✓ Branch 1 taken 157 times.
✓ Branch 2 taken 57 times.
✓ Branch 3 taken 157 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 57 times.
✓ Branch 6 taken 57 times.
✓ Branch 7 taken 157 times.
|
1483 | && (specialcave > 0 && DMaps[cur_dmap].flags & dmfGUYCAVES ? special_warp_return_scr : scr)->room==rWARP && type==cSTAIR) |
| 25780 | { | ||
| 25781 |
1/2✓ Branch 0 taken 57 times.
✗ Branch 1 not taken.
|
57 | if(!skippedaframe) |
| 25782 | { | ||
| 25783 | ✗ | FFCore.warpScriptCheck(); | |
| 25784 | ✗ | draw_screen(); | |
| 25785 | ✗ | advanceframe(true); | |
| 25786 | ✗ | } | |
| 25787 | |||
| 25788 | // "take any road you want" | ||
| 25789 |
2/2✓ Branch 0 taken 46 times.
✓ Branch 1 taken 11 times.
|
57 | int32_t dw = x<112 ? 1 : (x>136 ? 3 : 2); |
| 25790 | 57 | int32_t code = WARPCODE(cur_dmap,home_screen,dw); | |
| 25791 | |||
| 25792 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 57 times.
|
57 | if(code>-1) |
| 25793 | { | ||
| 25794 | 57 | bool changedlevel = false; | |
| 25795 | 57 | bool changeddmap = false; | |
| 25796 |
2/2✓ Branch 0 taken 42 times.
✓ Branch 1 taken 15 times.
|
57 | if(cur_dmap != code>>8) |
| 25797 | { | ||
| 25798 | 15 | timeExitAllGenscript(GENSCR_ST_CHANGE_DMAP); | |
| 25799 | 15 | changeddmap = true; | |
| 25800 | 15 | } | |
| 25801 |
1/2✓ Branch 0 taken 57 times.
✗ Branch 1 not taken.
|
57 | if(dlevel != DMaps[code>>8].level) |
| 25802 | { | ||
| 25803 | ✗ | timeExitAllGenscript(GENSCR_ST_CHANGE_LEVEL); | |
| 25804 | ✗ | changedlevel = true; | |
| 25805 | ✗ | } | |
| 25806 | 57 | cur_dmap = code>>8; | |
| 25807 | 57 | dlevel = DMaps[cur_dmap].level; | |
| 25808 |
2/2✓ Branch 0 taken 42 times.
✓ Branch 1 taken 15 times.
|
57 | if(changeddmap) |
| 25809 | { | ||
| 25810 | 15 | throwGenScriptEvent(GENSCR_EVENT_CHANGE_DMAP); | |
| 25811 | 15 | } | |
| 25812 |
1/2✓ Branch 0 taken 57 times.
✗ Branch 1 not taken.
|
57 | if(changedlevel) |
| 25813 | { | ||
| 25814 | ✗ | throwGenScriptEvent(GENSCR_EVENT_CHANGE_LEVEL); | |
| 25815 | ✗ | } | |
| 25816 | |||
| 25817 | 57 | cur_map = DMaps[cur_dmap].map; | |
| 25818 | 57 | home_screen = (code&0xFF) + DMaps[cur_dmap].xoff; | |
| 25819 | 57 | init_dmap(); | |
| 25820 | |||
| 25821 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 57 times.
|
57 | if(canPermSecret(cur_dmap, cur_screen)) |
| 25822 | 57 | setmapflag_homescr(mSECRET); | |
| 25823 | 57 | } | |
| 25824 | |||
| 25825 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 57 times.
|
57 | if(specialcave==STAIRCAVE) exitcave(); |
| 25826 | |||
| 25827 | 57 | return; | |
| 25828 | } | ||
| 25829 | |||
| 25830 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3992 times.
|
3992 | if(type==cRESET) |
| 25831 | { | ||
| 25832 | ✗ | if(!skippedaframe) | |
| 25833 | { | ||
| 25834 | ✗ | FFCore.warpScriptCheck(); | |
| 25835 | ✗ | draw_screen(); | |
| 25836 | ✗ | advanceframe(true); | |
| 25837 | ✗ | } | |
| 25838 | |||
| 25839 | ✗ | for(auto flag : {mSECRET,mITEM,mSPECIALITEM,mNEVERRET,mCHEST,mLOCKEDCHEST,mBOSSCHEST, | |
| 25840 | mLOCKBLOCK,mBOSSLOCKBLOCK,mTMPNORET,mVISITED,mLIGHTBEAM,mNO_ENEMIES_RETURN}) | ||
| 25841 | { | ||
| 25842 | ✗ | if(!(scr->noreset&flag)) | |
| 25843 | ✗ | unsetmapflag(scr, flag); | |
| 25844 | } | ||
| 25845 | |||
| 25846 | ✗ | if(isdungeon()) | |
| 25847 | { | ||
| 25848 | ✗ | for(auto flag : {mDOOR_LEFT,mDOOR_RIGHT,mDOOR_DOWN,mDOOR_UP}) | |
| 25849 | { | ||
| 25850 | ✗ | if(!(scr->noreset&flag)) | |
| 25851 | ✗ | unsetmapflag(scr, flag); | |
| 25852 | } | ||
| 25853 | ✗ | } | |
| 25854 | |||
| 25855 | ✗ | if(scr->exstate_reset) | |
| 25856 | { | ||
| 25857 | ✗ | for(uint q = 0; q < 32; ++q) | |
| 25858 | ✗ | if(scr->exstate_reset&(1<<q)) | |
| 25859 | ✗ | unsetxmapflag(scr->screen, (1<<q)); | |
| 25860 | ✗ | } | |
| 25861 | |||
| 25862 | ✗ | setpit(); | |
| 25863 | ✗ | sdir=dir; | |
| 25864 | ✗ | dowarp(scr, 4, 0, warpsfx2); | |
| 25865 | ✗ | } | |
| 25866 | else | ||
| 25867 | { | ||
| 25868 |
3/4✓ Branch 0 taken 987 times.
✓ Branch 1 taken 3005 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 987 times.
|
3992 | if(!skippedaframe && (base_scr->tilewarptype[index]!=wtNOWARP)) |
| 25869 | { | ||
| 25870 | 987 | FFCore.warpScriptCheck(); | |
| 25871 | 987 | draw_screen(); | |
| 25872 | 987 | advanceframe(true); | |
| 25873 | 987 | } | |
| 25874 | |||
| 25875 | 3992 | sdir = dir; | |
| 25876 | 3992 | dowarp(scr, 0, index, warpsfx2); | |
| 25877 | } | ||
| 25878 | 14759356 | } | |
| 25879 | |||
| 25880 | 126 | int32_t selectWlevel(int32_t d) | |
| 25881 | { | ||
| 25882 |
1/2✓ Branch 0 taken 126 times.
✗ Branch 1 not taken.
|
126 | if(TriforceCount()==0) |
| 25883 | ✗ | return 0; | |
| 25884 | |||
| 25885 | 126 | word l = game->get_wlevel(); | |
| 25886 | |||
| 25887 | 126 | do | |
| 25888 | { | ||
| 25889 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 199 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
199 | if(d==0 && (game->lvlitems[l+1] & (1 << li_mcguffin))) |
| 25890 | ✗ | break; | |
| 25891 |
2/2✓ Branch 0 taken 119 times.
✓ Branch 1 taken 80 times.
|
199 | else if(d<0) |
| 25892 |
2/2✓ Branch 0 taken 64 times.
✓ Branch 1 taken 16 times.
|
80 | l = (l==0) ? 7 : l-1; |
| 25893 | else | ||
| 25894 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 103 times.
|
119 | l = (l==7) ? 0 : l+1; |
| 25895 |
2/2✓ Branch 0 taken 73 times.
✓ Branch 1 taken 126 times.
|
199 | } |
| 25896 | 199 | while(!(game->lvlitems[l+1] & (1 << li_mcguffin))); | |
| 25897 | |||
| 25898 | 126 | game->set_wlevel(l); | |
| 25899 | 126 | return l; | |
| 25900 | 126 | } | |
| 25901 | |||
| 25902 | // Would someone tell the Dodongos to shut their yaps?! | ||
| 25903 | 29307 | void kill_enemy_sfx() | |
| 25904 | { | ||
| 25905 |
2/2✓ Branch 0 taken 29307 times.
✓ Branch 1 taken 57406 times.
|
86713 | for(int32_t i=0; i<guys.Count(); i++) |
| 25906 | { | ||
| 25907 |
2/2✓ Branch 0 taken 22640 times.
✓ Branch 1 taken 34766 times.
|
57406 | if(((enemy*)guys.spr(i))->bgsfx) |
| 25908 | 34766 | stop_sfx(((enemy*)guys.spr(i))->bgsfx); | |
| 25909 | 57406 | } | |
| 25910 |
2/2✓ Branch 0 taken 125 times.
✓ Branch 1 taken 29182 times.
|
29307 | if (Hero.action!=inwind) stop_sfx(WAV_ZN1WHIRLWIND); |
| 25911 |
2/2✓ Branch 0 taken 29291 times.
✓ Branch 1 taken 16 times.
|
29307 | if(hero_scr->room==rGANON) |
| 25912 | 16 | stop_sfx(WAV_ROAR); | |
| 25913 | 29307 | } | |
| 25914 | |||
| 25915 | 3271 | bool HeroClass::HasHeavyBoots() | |
| 25916 | { | ||
| 25917 |
2/2✓ Branch 0 taken 3271 times.
✓ Branch 1 taken 837376 times.
|
840647 | for ( int32_t q = 0; q < MAXITEMS; ++q ) |
| 25918 | { | ||
| 25919 |
3/6✓ Branch 0 taken 68711 times.
✓ Branch 1 taken 768665 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 68711 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
837376 | if ( game->item[q] && ( itemsbuf[q].type == itype_boots ) && /*iron*/ (itemsbuf[q].flags&item_flag2) ) return true; |
| 25920 | 837376 | } | |
| 25921 | 3271 | return false; | |
| 25922 | 3271 | } | |
| 25923 | |||
| 25924 | 8280 | bool HeroClass::dowarp(const mapscr* scr, int32_t type, int32_t index, int32_t warpsfx) | |
| 25925 | { | ||
| 25926 |
1/2✓ Branch 0 taken 8280 times.
✗ Branch 1 not taken.
|
8280 | if (!scr) scr = hero_scr; |
| 25927 | |||
| 25928 | 8280 | byte reposition_sword_postwarp = 0; | |
| 25929 |
1/2✓ Branch 0 taken 8280 times.
✗ Branch 1 not taken.
|
8280 | if (index < 0) |
| 25930 | { | ||
| 25931 | ✗ | return false; | |
| 25932 | } | ||
| 25933 | 8280 | finish_auto_walk(); | |
| 25934 | 8280 | is_warping = true; | |
| 25935 |
2/2✓ Branch 0 taken 1361 times.
✓ Branch 1 taken 8280 times.
|
9641 | for (int32_t q = 0; q < Lwpns.Count(); ++q) |
| 25936 | { | ||
| 25937 | 1361 | weapon* swd = NULL; | |
| 25938 | 1361 | swd = (weapon*)Lwpns.spr(q); | |
| 25939 |
2/2✓ Branch 0 taken 1290 times.
✓ Branch 1 taken 71 times.
|
1361 | if (swd->id == (attack == wSword ? wSword : wWand)) |
| 25940 | { | ||
| 25941 | 71 | Lwpns.del(q); | |
| 25942 | 71 | } | |
| 25943 | 1361 | } | |
| 25944 | |||
| 25945 | 8280 | attackclk = charging = spins = tapping = 0; | |
| 25946 | 8280 | attack = none; | |
| 25947 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8280 times.
|
8280 | if (warp_sound > 0) warpsfx = warp_sound; |
| 25948 | 8280 | warp_sound = 0; | |
| 25949 | 8280 | word wdmap = 0; | |
| 25950 | 8280 | byte wscr = 0, wtype = 0, t = 0; | |
| 25951 | 8280 | bool overlay = false; | |
| 25952 | 8280 | t = (cur_screen < 128) ? 0 : 1; | |
| 25953 | 8280 | int32_t wrindex = 0; | |
| 25954 | 8280 | bool wasSideview = isSideViewGravity(t); | |
| 25955 | |||
| 25956 | // Either the current screen, or if in a 0x80 room the screen player came from. | ||
| 25957 |
2/2✓ Branch 0 taken 982 times.
✓ Branch 1 taken 7298 times.
|
8280 | const mapscr* base_scr = cur_screen >= 128 ? special_warp_return_scr : scr; |
| 25958 | |||
| 25959 | // Drawing commands probably shouldn't carry over... | ||
| 25960 |
2/2✓ Branch 0 taken 1323 times.
✓ Branch 1 taken 6957 times.
|
8280 | if (!get_qr(qr_SCRIPTDRAWSINWARPS)) |
| 25961 | 6957 | script_drawing_commands.Clear(); | |
| 25962 | |||
| 25963 |
2/2✓ Branch 0 taken 7877 times.
✓ Branch 1 taken 403 times.
|
8280 | if (replay_version_check(35)) |
| 25964 | { | ||
| 25965 | // TODO: Would be better to remove a bit later, after fading out the current screen. For now, do this here. | ||
| 25966 | // https://github.com/ZQuestClassic/ZQuestClassic/pull/1017#discussion_r1828880117 | ||
| 25967 | 403 | reset_ladder(); | |
| 25968 | 403 | } | |
| 25969 |
4/6✓ Branch 0 taken 982 times.
✓ Branch 1 taken 4058 times.
✓ Branch 2 taken 3115 times.
✓ Branch 3 taken 125 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
8280 | switch(type) |
| 25970 | { | ||
| 25971 | case 0: // tile warp | ||
| 25972 | 4058 | wtype = base_scr->tilewarptype[index]; | |
| 25973 | 4058 | wdmap = base_scr->tilewarpdmap[index]; | |
| 25974 | 4058 | wscr = base_scr->tilewarpscr[index]; | |
| 25975 | 4058 | overlay = get_bit(&base_scr->tilewarpoverlayflags,index)?1:0; | |
| 25976 | 4058 | wrindex=(scr->warpreturnc>>(index*2))&3; | |
| 25977 | 4058 | break; | |
| 25978 | |||
| 25979 | case 1: // side warp | ||
| 25980 | 3115 | wtype = base_scr->sidewarptype[index]; | |
| 25981 | 3115 | wdmap = base_scr->sidewarpdmap[index]; | |
| 25982 | 3115 | wscr = base_scr->sidewarpscr[index]; | |
| 25983 | 3115 | overlay = get_bit(&base_scr->sidewarpoverlayflags,index)?1:0; | |
| 25984 | 3115 | wrindex=(scr->warpreturnc>>(8+(index*2)))&3; | |
| 25985 | 3115 | break; | |
| 25986 | |||
| 25987 | case 2: // whistle warp | ||
| 25988 | { | ||
| 25989 | 125 | wtype = wtWHISTLE; | |
| 25990 |
1/2✓ Branch 0 taken 125 times.
✗ Branch 1 not taken.
|
125 | int32_t wind = whistleitem>-1 ? itemsbuf[whistleitem].misc2 : 8; |
| 25991 | 125 | int32_t level=0; | |
| 25992 | |||
| 25993 |
1/2✓ Branch 0 taken 125 times.
✗ Branch 1 not taken.
|
125 | if(blowcnt==0) |
| 25994 | ✗ | level = selectWlevel(0); | |
| 25995 | else | ||
| 25996 | { | ||
| 25997 |
2/2✓ Branch 0 taken 126 times.
✓ Branch 1 taken 125 times.
|
251 | for(int32_t i=0; i<abs(blowcnt); i++) |
| 25998 | 126 | level = selectWlevel(blowcnt); | |
| 25999 | } | ||
| 26000 | |||
| 26001 |
3/4✓ Branch 0 taken 2 times.
✓ Branch 1 taken 123 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
|
125 | if(level > QMisc.warp[wind].size && QMisc.warp[wind].size>0) |
| 26002 | { | ||
| 26003 | 2 | level %= QMisc.warp[wind].size; | |
| 26004 | 2 | game->set_wlevel(level); | |
| 26005 | 2 | } | |
| 26006 | |||
| 26007 | 125 | wdmap = QMisc.warp[wind].dmap[level]; | |
| 26008 | 125 | wscr = QMisc.warp[wind].scr[level]; | |
| 26009 | } | ||
| 26010 | 125 | break; | |
| 26011 | |||
| 26012 | case 3: | ||
| 26013 | ✗ | wtype = wtIWARP; | |
| 26014 | ✗ | wdmap = cheat_goto_dmap; | |
| 26015 | ✗ | wscr = cheat_goto_screen; | |
| 26016 | ✗ | break; | |
| 26017 | |||
| 26018 | case 4: | ||
| 26019 | ✗ | wtype = wtIWARP; | |
| 26020 | ✗ | wdmap = cur_dmap; | |
| 26021 | ✗ | wscr = home_screen-DMaps[cur_dmap].xoff; | |
| 26022 | ✗ | break; | |
| 26023 | } | ||
| 26024 | |||
| 26025 | 8280 | bool intradmap = (wdmap == cur_dmap); | |
| 26026 | 8280 | int32_t olddmap = cur_dmap; | |
| 26027 | 8280 | rehydratelake(type!=wtSCROLL); | |
| 26028 | 8280 | bool updatemusic = FFCore.can_dmap_change_music(wdmap); | |
| 26029 | 8280 | bool musicnocut = FFCore.music_update_flags & MUSIC_UPDATE_FLAG_NOCUT; | |
| 26030 | 8280 | bool musicrevert = FFCore.music_update_flags & MUSIC_UPDATE_FLAG_REVERT; | |
| 26031 | |||
| 26032 |
7/8✓ Branch 0 taken 4507 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 585 times.
✓ Branch 3 taken 322 times.
✓ Branch 4 taken 1637 times.
✓ Branch 5 taken 952 times.
✓ Branch 6 taken 125 times.
✓ Branch 7 taken 152 times.
|
8280 | switch(wtype) |
| 26033 | { | ||
| 26034 | case wtCAVE: | ||
| 26035 | { | ||
| 26036 | // cave/item room | ||
| 26037 | 585 | ALLOFF(); | |
| 26038 | |||
| 26039 |
2/2✓ Branch 0 taken 431 times.
✓ Branch 1 taken 154 times.
|
585 | if(DMaps[cur_dmap].flags&dmfCAVES) // cave |
| 26040 | { | ||
| 26041 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 431 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
431 | if (updatemusic || !musicnocut || !get_qr(qr_SCREEN80_OWN_MUSIC)) |
| 26042 | 431 | music_stop(); | |
| 26043 | 431 | kill_sfx(); | |
| 26044 | |||
| 26045 | 431 | int destscr = 0x80; | |
| 26046 |
2/2✓ Branch 0 taken 62 times.
✓ Branch 1 taken 369 times.
|
431 | if(scr->room==rWARP) |
| 26047 | { | ||
| 26048 | 62 | destscr=0x81; | |
| 26049 | 62 | specialcave = STAIRCAVE; | |
| 26050 | 62 | } | |
| 26051 | 369 | else specialcave = GUYCAVE; | |
| 26052 | |||
| 26053 | //lighting(2,dir); | ||
| 26054 | 431 | lighting(false, true); | |
| 26055 | 431 | loadlvlpal(10); | |
| 26056 |
2/2✓ Branch 0 taken 65 times.
✓ Branch 1 taken 366 times.
|
797 | bool b2 = COOLSCROLL&& |
| 26057 |
3/4✓ Branch 0 taken 207 times.
✓ Branch 1 taken 159 times.
✓ Branch 2 taken 207 times.
✗ Branch 3 not taken.
|
366 | ((combobuf[MAPCOMBO(x,y-16)].type==cCAVE)||(combobuf[MAPCOMBO(x,y-16)].type==cCAVE2)|| |
| 26058 |
2/4✓ Branch 0 taken 207 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 207 times.
✗ Branch 3 not taken.
|
207 | (combobuf[MAPCOMBO(x,y-16)].type==cCAVEB)||(combobuf[MAPCOMBO(x,y-16)].type==cCAVE2B)|| |
| 26059 |
2/4✓ Branch 0 taken 207 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 207 times.
✗ Branch 3 not taken.
|
207 | (combobuf[MAPCOMBO(x,y-16)].type==cCAVEC)||(combobuf[MAPCOMBO(x,y-16)].type==cCAVE2C)|| |
| 26060 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 207 times.
|
207 | (combobuf[MAPCOMBO(x,y-16)].type==cCAVED)||(combobuf[MAPCOMBO(x,y-16)].type==cCAVE2D)); |
| 26061 | 431 | blackscr(30,b2?false:true); | |
| 26062 | 431 | loadscr(wdmap, destscr, up, false); | |
| 26063 | 431 | scr = hero_scr; | |
| 26064 | //preloaded freeform combos | ||
| 26065 | 431 | ffscript_engine(true); | |
| 26066 | 431 | dir=up; | |
| 26067 | 431 | x=112; | |
| 26068 | 431 | y=160; | |
| 26069 |
1/2✓ Branch 0 taken 431 times.
✗ Branch 1 not taken.
|
431 | if(didpit) |
| 26070 | { | ||
| 26071 | ✗ | didpit=false; | |
| 26072 | ✗ | x=pitx; | |
| 26073 | ✗ | y=pity; | |
| 26074 | ✗ | } | |
| 26075 | |||
| 26076 | 431 | reset_hookshot(); | |
| 26077 |
1/2✓ Branch 0 taken 431 times.
✗ Branch 1 not taken.
|
431 | if(reposition_sword_postwarp) |
| 26078 | { | ||
| 26079 | ✗ | weapon *swd=NULL; | |
| 26080 | ✗ | for(int32_t i=0; i<Lwpns.Count(); i++) | |
| 26081 | { | ||
| 26082 | ✗ | swd = (weapon*)Lwpns.spr(i); | |
| 26083 | |||
| 26084 | ✗ | if(swd->id == (attack==wSword ? wSword : wWand)) | |
| 26085 | { | ||
| 26086 | ✗ | int32_t itype = (attack==wFire ? itype_candle : attack==wCByrna ? itype_cbyrna : attack==wWand ? itype_wand : attack==wHammer ? itype_hammer : itype_sword); | |
| 26087 | ✗ | int32_t item_id = (directWpn>-1 && itemsbuf[directWpn].type==itype) ? directWpn : current_item_id(itype); | |
| 26088 | ✗ | positionSword(swd,item_id); | |
| 26089 | ✗ | break; | |
| 26090 | } | ||
| 26091 | ✗ | } | |
| 26092 | ✗ | } | |
| 26093 | 431 | stepforward(diagonalMovement?5:6, false); | |
| 26094 | 431 | } | |
| 26095 | else // item room | ||
| 26096 | { | ||
| 26097 | 154 | specialcave = ITEMCELLAR; | |
| 26098 | 154 | kill_sfx(); | |
| 26099 | 154 | draw_screen(false); | |
| 26100 | |||
| 26101 | //unless the room is already dark, fade to black | ||
| 26102 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 153 times.
|
154 | if (!get_qr(qr_NEW_DARKROOM)) |
| 26103 | { | ||
| 26104 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 152 times.
|
153 | if(!darkroom) |
| 26105 | { | ||
| 26106 | 152 | darkroom = true; | |
| 26107 | 152 | fade(DMaps[cur_dmap].color,true,false); | |
| 26108 | 152 | } | |
| 26109 | 153 | } | |
| 26110 | else | ||
| 26111 | 1 | fade(DMaps[cur_dmap].color, true, false); | |
| 26112 | |||
| 26113 | 154 | blackscr(30,true); | |
| 26114 | |||
| 26115 | 154 | bool no_x80_dir = true; // TODO: is this necessary? | |
| 26116 | 154 | loadscr(wdmap, 0x80, down, false, no_x80_dir); | |
| 26117 | 154 | scr = hero_scr; | |
| 26118 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 154 times.
|
154 | if ( dontdraw < 2 ) { dontdraw=1; } |
| 26119 | 154 | draw_screen(false); | |
| 26120 | 154 | fade(0xB,true,true); | |
| 26121 | 154 | darkroom = false; | |
| 26122 | 154 | dir=down; | |
| 26123 | 154 | x=48; | |
| 26124 | 154 | y=0; | |
| 26125 | |||
| 26126 | // is this didpit check necessary? | ||
| 26127 |
2/2✓ Branch 0 taken 153 times.
✓ Branch 1 taken 1 times.
|
154 | if(didpit) |
| 26128 | { | ||
| 26129 | 1 | didpit=false; | |
| 26130 | 1 | x=pitx; | |
| 26131 | 1 | y=pity; | |
| 26132 | 1 | } | |
| 26133 | |||
| 26134 | 154 | reset_hookshot(); | |
| 26135 |
1/2✓ Branch 0 taken 154 times.
✗ Branch 1 not taken.
|
154 | if(reposition_sword_postwarp) |
| 26136 | { | ||
| 26137 | ✗ | weapon *swd=NULL; | |
| 26138 | ✗ | for(int32_t i=0; i<Lwpns.Count(); i++) | |
| 26139 | { | ||
| 26140 | ✗ | swd = (weapon*)Lwpns.spr(i); | |
| 26141 | |||
| 26142 | ✗ | if(swd->id == (attack==wSword ? wSword : wWand)) | |
| 26143 | { | ||
| 26144 | ✗ | int32_t itype = (attack==wFire ? itype_candle : attack==wCByrna ? itype_cbyrna : attack==wWand ? itype_wand : attack==wHammer ? itype_hammer : itype_sword); | |
| 26145 | ✗ | int32_t item_id = (directWpn>-1 && itemsbuf[directWpn].type==itype) ? directWpn : current_item_id(itype); | |
| 26146 | ✗ | positionSword(swd,item_id); | |
| 26147 | ✗ | break; | |
| 26148 | } | ||
| 26149 | ✗ | } | |
| 26150 | ✗ | } | |
| 26151 | 154 | lighting(false, true); | |
| 26152 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 154 times.
|
154 | if ( dontdraw < 2 ) { dontdraw=0; } |
| 26153 | 154 | stepforward(diagonalMovement?16:18, false); | |
| 26154 | } | ||
| 26155 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 585 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
585 | if (get_qr(qr_SCREEN80_OWN_MUSIC) && (updatemusic || !musicnocut)) |
| 26156 | { | ||
| 26157 | ✗ | playLevelMusic(); | |
| 26158 | ✗ | if (musicrevert) | |
| 26159 | ✗ | FFCore.music_update_cond = MUSIC_UPDATE_SCREEN; | |
| 26160 | ✗ | } | |
| 26161 | 585 | break; | |
| 26162 | } | ||
| 26163 | |||
| 26164 | case wtPASS: // passageway | ||
| 26165 | { | ||
| 26166 | // some draw_screen code (the passive subscreen compass dot) depends | ||
| 26167 | // on cur_screen being set before initiating the screen wipes for a warp. | ||
| 26168 | // Without this the compass dot would remain drawn while warping. | ||
| 26169 | // This is better, but for now this code keeps the rendering equivalent to before | ||
| 26170 | // z3 refactor. | ||
| 26171 | // demosp253.zplay and first_quest_layered.zplay showcases this behavior. | ||
| 26172 | // TODO(replays): remove in future bulk replay update. | ||
| 26173 | 322 | currscr_for_passive_subscr = 0x81; | |
| 26174 | |||
| 26175 | 322 | kill_sfx(); | |
| 26176 | 322 | ALLOFF(); | |
| 26177 | //play sound | ||
| 26178 |
1/2✓ Branch 0 taken 322 times.
✗ Branch 1 not taken.
|
322 | if(warpsfx > 0) sfx(warpsfx,pan(x)); |
| 26179 | 322 | specialcave = PASSAGEWAY; | |
| 26180 | 322 | byte warp_screen_2 = wscr + DMaps[wdmap].xoff; | |
| 26181 | 322 | draw_screen(false); | |
| 26182 | |||
| 26183 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 322 times.
|
322 | if(!get_qr(qr_NEW_DARKROOM)) |
| 26184 | { | ||
| 26185 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 314 times.
|
322 | if(!darkroom) |
| 26186 | 314 | fade(DMaps[cur_dmap].color,true,false); | |
| 26187 | |||
| 26188 | 322 | darkroom=true; | |
| 26189 | 322 | } | |
| 26190 | else | ||
| 26191 | ✗ | fade(DMaps[cur_dmap].color,true,false); | |
| 26192 | 322 | blackscr(30,true); | |
| 26193 | 322 | bool no_x80_dir = true; | |
| 26194 | 322 | loadscr(wdmap, 0x81, down, false, no_x80_dir); | |
| 26195 | 322 | scr = hero_scr; | |
| 26196 | //preloaded freeform combos | ||
| 26197 | 322 | ffscript_engine(true); | |
| 26198 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 322 times.
|
322 | if ( dontdraw < 2 ) { dontdraw=1; } |
| 26199 | 322 | draw_screen(false); | |
| 26200 | 322 | lighting(false, true); | |
| 26201 |
1/2✓ Branch 0 taken 322 times.
✗ Branch 1 not taken.
|
322 | if (get_qr(qr_NEW_DARKROOM)) |
| 26202 | ✗ | fade(0xB, false, true); | |
| 26203 | 322 | dir=down; | |
| 26204 | 322 | x=48; | |
| 26205 | |||
| 26206 |
2/2✓ Branch 0 taken 148 times.
✓ Branch 1 taken 174 times.
|
322 | if((home_screen&15) > (warp_screen_2&15)) |
| 26207 | { | ||
| 26208 | 174 | x=192; | |
| 26209 | 174 | } | |
| 26210 | |||
| 26211 |
2/2✓ Branch 0 taken 310 times.
✓ Branch 1 taken 12 times.
|
322 | if((home_screen&15) == (warp_screen_2&15)) |
| 26212 | { | ||
| 26213 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
|
12 | if((cur_screen>>4) > (warp_screen_2>>4)) |
| 26214 | { | ||
| 26215 | 12 | x=192; | |
| 26216 | 12 | } | |
| 26217 | 12 | } | |
| 26218 | |||
| 26219 | // is this didpit check necessary? | ||
| 26220 |
1/2✓ Branch 0 taken 322 times.
✗ Branch 1 not taken.
|
322 | if(didpit) |
| 26221 | { | ||
| 26222 | ✗ | didpit=false; | |
| 26223 | ✗ | x=pitx; | |
| 26224 | ✗ | y=pity; | |
| 26225 | ✗ | } | |
| 26226 | |||
| 26227 | 322 | y=0; | |
| 26228 | 322 | set_respawn_point(); | |
| 26229 | 322 | trySideviewLadder(); | |
| 26230 | 322 | reset_hookshot(); | |
| 26231 |
1/2✓ Branch 0 taken 322 times.
✗ Branch 1 not taken.
|
322 | if(reposition_sword_postwarp) |
| 26232 | { | ||
| 26233 | ✗ | weapon *swd=NULL; | |
| 26234 | ✗ | for(int32_t i=0; i<Lwpns.Count(); i++) | |
| 26235 | { | ||
| 26236 | ✗ | swd = (weapon*)Lwpns.spr(i); | |
| 26237 | |||
| 26238 | ✗ | if(swd->id == (attack==wSword ? wSword : wWand)) | |
| 26239 | { | ||
| 26240 | ✗ | int32_t itype = (attack==wFire ? itype_candle : attack==wCByrna ? itype_cbyrna : attack==wWand ? itype_wand : attack==wHammer ? itype_hammer : itype_sword); | |
| 26241 | ✗ | int32_t item_id = (directWpn>-1 && itemsbuf[directWpn].type==itype) ? directWpn : current_item_id(itype); | |
| 26242 | ✗ | positionSword(swd,item_id); | |
| 26243 | ✗ | break; | |
| 26244 | } | ||
| 26245 | ✗ | } | |
| 26246 | ✗ | } | |
| 26247 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 322 times.
|
322 | if ( dontdraw < 2 ) { dontdraw=0; } |
| 26248 | 322 | stepforward(diagonalMovement?16:18, false); | |
| 26249 | 322 | newscr_clk=frame; | |
| 26250 | 322 | activated_timed_warp=false; | |
| 26251 | 322 | stepoutindex=index; | |
| 26252 | 322 | stepoutscreen = warp_screen_2; | |
| 26253 | 322 | stepoutdmap = wdmap; | |
| 26254 | 322 | stepoutwr=wrindex; | |
| 26255 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 322 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
322 | if (get_qr(qr_SCREEN80_OWN_MUSIC) && (updatemusic || !musicnocut)) |
| 26256 | { | ||
| 26257 | ✗ | playLevelMusic(); | |
| 26258 | ✗ | if (musicrevert) | |
| 26259 | ✗ | FFCore.music_update_cond = MUSIC_UPDATE_SCREEN; | |
| 26260 | ✗ | } | |
| 26261 | } | ||
| 26262 | 322 | break; | |
| 26263 | |||
| 26264 | case wtEXIT: // entrance/exit | ||
| 26265 | { | ||
| 26266 | 1637 | lighting(false,false,pal_litRESETONLY);//Reset permLit, and do nothing else; lighting was not otherwise called on a wtEXIT warp. | |
| 26267 | 1637 | ALLOFF(); | |
| 26268 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1637 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1637 | if(updatemusic||!musicnocut) |
| 26269 | 1637 | music_stop(); | |
| 26270 | 1637 | kill_sfx(); | |
| 26271 | 1637 | blackscr(30,false); | |
| 26272 | 1637 | bool changedlevel = false; | |
| 26273 | 1637 | bool changeddmap = false; | |
| 26274 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 1634 times.
|
1637 | if(cur_dmap != wdmap) |
| 26275 | { | ||
| 26276 | 1634 | timeExitAllGenscript(GENSCR_ST_CHANGE_DMAP); | |
| 26277 | 1634 | changeddmap = true; | |
| 26278 | 1634 | } | |
| 26279 |
2/2✓ Branch 0 taken 262 times.
✓ Branch 1 taken 1375 times.
|
1637 | if(dlevel != DMaps[wdmap].level) |
| 26280 | { | ||
| 26281 | 1375 | timeExitAllGenscript(GENSCR_ST_CHANGE_LEVEL); | |
| 26282 | 1375 | changedlevel = true; | |
| 26283 | 1375 | } | |
| 26284 | 1637 | dlevel = DMaps[wdmap].level; | |
| 26285 | 1637 | cur_dmap = wdmap; | |
| 26286 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 1634 times.
|
1637 | if(changeddmap) |
| 26287 | { | ||
| 26288 | 1634 | throwGenScriptEvent(GENSCR_EVENT_CHANGE_DMAP); | |
| 26289 | 1634 | } | |
| 26290 |
2/2✓ Branch 0 taken 262 times.
✓ Branch 1 taken 1375 times.
|
1637 | if(changedlevel) |
| 26291 | { | ||
| 26292 | 1375 | throwGenScriptEvent(GENSCR_EVENT_CHANGE_LEVEL); | |
| 26293 | 1375 | } | |
| 26294 | |||
| 26295 | 1637 | cur_map=DMaps[cur_dmap].map; | |
| 26296 | 1637 | init_dmap(); | |
| 26297 | 1637 | update_subscreens(wdmap); | |
| 26298 | 1637 | loadfullpal(); | |
| 26299 | 1637 | ringcolor(false); | |
| 26300 | 1637 | loadlvlpal(DMaps[cur_dmap].color); | |
| 26301 | 1637 | int destscr = wscr + DMaps[cur_dmap].xoff; | |
| 26302 | 1637 | loadscr(cur_dmap, destscr, -1, overlay); | |
| 26303 | 1637 | scr = hero_scr; | |
| 26304 | |||
| 26305 |
4/4✓ Branch 0 taken 56 times.
✓ Branch 1 taken 1581 times.
✓ Branch 2 taken 46 times.
✓ Branch 3 taken 10 times.
|
1637 | if (is_dark(scr) && !get_qr(qr_NEW_DARKROOM)) |
| 26306 | { | ||
| 26307 |
2/2✓ Branch 0 taken 7 times.
✓ Branch 1 taken 3 times.
|
10 | if(get_qr(qr_FADE)) |
| 26308 | { | ||
| 26309 | 7 | interpolatedfade(); | |
| 26310 | 7 | } | |
| 26311 | else | ||
| 26312 | { | ||
| 26313 | 3 | loadfadepal((DMaps[cur_dmap].color)*pdLEVEL+poFADE3); | |
| 26314 | } | ||
| 26315 | |||
| 26316 | 10 | darkroom=naturaldark=true; | |
| 26317 | 10 | } | |
| 26318 | else | ||
| 26319 | { | ||
| 26320 | 1627 | darkroom=naturaldark=false; | |
| 26321 | } | ||
| 26322 | |||
| 26323 | int32_t wrx,wry; | ||
| 26324 | |||
| 26325 |
2/2✓ Branch 0 taken 656 times.
✓ Branch 1 taken 981 times.
|
1637 | if(get_qr(qr_NOARRIVALPOINT)) |
| 26326 | { | ||
| 26327 | 656 | wrx=scr->warpreturnx[0]; | |
| 26328 | 656 | wry=scr->warpreturny[0]; | |
| 26329 | 656 | } | |
| 26330 | else | ||
| 26331 | { | ||
| 26332 | 981 | wrx=scr->warparrivalx; | |
| 26333 | 981 | wry=scr->warparrivaly; | |
| 26334 | } | ||
| 26335 | |||
| 26336 |
6/6✓ Branch 0 taken 91 times.
✓ Branch 1 taken 1546 times.
✓ Branch 2 taken 63 times.
✓ Branch 3 taken 28 times.
✓ Branch 4 taken 63 times.
✓ Branch 5 taken 1574 times.
|
1637 | if(((wrx>0||wry>0)||(get_qr(qr_WARPSIGNOREARRIVALPOINT)))&&(!(scr->flags6&fNOCONTINUEHERE))) |
| 26337 | { | ||
| 26338 |
2/2✓ Branch 0 taken 1113 times.
✓ Branch 1 taken 461 times.
|
1574 | if(dlevel) |
| 26339 | { | ||
| 26340 | 1113 | lastentrance = cur_screen; | |
| 26341 | 1113 | } | |
| 26342 | else | ||
| 26343 | { | ||
| 26344 | 461 | lastentrance = DMaps[cur_dmap].cont + DMaps[cur_dmap].xoff; | |
| 26345 | } | ||
| 26346 | |||
| 26347 | 1574 | lastentrance_dmap = wdmap; | |
| 26348 | 1574 | } | |
| 26349 | |||
| 26350 |
2/2✓ Branch 0 taken 1113 times.
✓ Branch 1 taken 524 times.
|
1637 | if(dlevel) |
| 26351 | { | ||
| 26352 |
2/2✓ Branch 0 taken 559 times.
✓ Branch 1 taken 554 times.
|
1113 | if(get_qr(qr_NOARRIVALPOINT)) |
| 26353 | { | ||
| 26354 | 559 | x=scr->warpreturnx[wrindex]; | |
| 26355 | 559 | y=scr->warpreturny[wrindex]; | |
| 26356 | 559 | } | |
| 26357 | else | ||
| 26358 | { | ||
| 26359 | 554 | x=scr->warparrivalx; | |
| 26360 | 554 | y=scr->warparrivaly; | |
| 26361 | } | ||
| 26362 | 1113 | } | |
| 26363 | else | ||
| 26364 | { | ||
| 26365 | 524 | x=scr->warpreturnx[wrindex]; | |
| 26366 | 524 | y=scr->warpreturny[wrindex]; | |
| 26367 | } | ||
| 26368 | |||
| 26369 |
2/2✓ Branch 0 taken 1628 times.
✓ Branch 1 taken 9 times.
|
1637 | if(didpit) |
| 26370 | { | ||
| 26371 | 9 | didpit=false; | |
| 26372 | 9 | x=pitx; | |
| 26373 | 9 | y=pity; | |
| 26374 | 9 | } | |
| 26375 | |||
| 26376 | 1637 | dir=down; | |
| 26377 |
2/2✓ Branch 0 taken 1609 times.
✓ Branch 1 taken 28 times.
|
1637 | if(x==0) dir=right; |
| 26378 |
2/2✓ Branch 0 taken 1614 times.
✓ Branch 1 taken 23 times.
|
1637 | if(x==240) dir=left; |
| 26379 |
2/2✓ Branch 0 taken 1599 times.
✓ Branch 1 taken 38 times.
|
1637 | if(y==0) dir=down; |
| 26380 |
2/2✓ Branch 0 taken 1009 times.
✓ Branch 1 taken 628 times.
|
1637 | if(y==160) dir=up; |
| 26381 | |||
| 26382 | 1637 | x += region_scr_dx * 256; | |
| 26383 | 1637 | y += region_scr_dy * 176; | |
| 26384 | 1637 | update_viewport(); | |
| 26385 | |||
| 26386 |
2/2✓ Branch 0 taken 524 times.
✓ Branch 1 taken 1113 times.
|
1637 | if(dlevel) |
| 26387 | { | ||
| 26388 | // reset enemy kill counts | ||
| 26389 |
2/2✓ Branch 0 taken 142464 times.
✓ Branch 1 taken 1113 times.
|
143577 | for(int32_t i=0; i<128; i++) |
| 26390 | { | ||
| 26391 | 142464 | int mi = mapind(cur_map, i); | |
| 26392 | 142464 | game->guys[mi] = 0; | |
| 26393 | 142464 | game->maps[mi] &= ~mTMPNORET; | |
| 26394 | 142464 | } | |
| 26395 | 1113 | } | |
| 26396 | |||
| 26397 | 1637 | markBmap(dir^1, current_screen); | |
| 26398 | //preloaded freeform combos | ||
| 26399 | 1637 | ffscript_engine(true); | |
| 26400 | |||
| 26401 | 1637 | reset_hookshot(); | |
| 26402 |
1/2✓ Branch 0 taken 1637 times.
✗ Branch 1 not taken.
|
1637 | if(reposition_sword_postwarp) |
| 26403 | { | ||
| 26404 | ✗ | weapon *swd=NULL; | |
| 26405 | ✗ | for(int32_t i=0; i<Lwpns.Count(); i++) | |
| 26406 | { | ||
| 26407 | ✗ | swd = (weapon*)Lwpns.spr(i); | |
| 26408 | |||
| 26409 | ✗ | if(swd->id == (attack==wSword ? wSword : wWand)) | |
| 26410 | { | ||
| 26411 | ✗ | int32_t itype = (attack==wFire ? itype_candle : attack==wCByrna ? itype_cbyrna : attack==wWand ? itype_wand : attack==wHammer ? itype_hammer : itype_sword); | |
| 26412 | ✗ | int32_t item_id = (directWpn>-1 && itemsbuf[directWpn].type==itype) ? directWpn : current_item_id(itype); | |
| 26413 | ✗ | positionSword(swd,item_id); | |
| 26414 | ✗ | break; | |
| 26415 | } | ||
| 26416 | ✗ | } | |
| 26417 | ✗ | } | |
| 26418 | |||
| 26419 |
2/2✓ Branch 0 taken 447 times.
✓ Branch 1 taken 1190 times.
|
1637 | if(isdungeon()) |
| 26420 | { | ||
| 26421 | 447 | openscreen(); | |
| 26422 |
4/4✓ Branch 0 taken 430 times.
✓ Branch 1 taken 17 times.
✓ Branch 2 taken 56 times.
✓ Branch 3 taken 374 times.
|
447 | if(get_er(er_SHORTDGNWALK)==0 && get_qr(qr_SHORTDGNWALK)==0) |
| 26423 | 374 | stepforward(diagonalMovement?11:12, false); | |
| 26424 | else | ||
| 26425 | // Didn't walk as far pre-1.93, and some quests depend on that | ||
| 26426 | 73 | stepforward(8, false); | |
| 26427 | 447 | } | |
| 26428 | else | ||
| 26429 | { | ||
| 26430 |
2/2✓ Branch 0 taken 1023 times.
✓ Branch 1 taken 167 times.
|
1190 | if(!COOLSCROLL) |
| 26431 | 167 | openscreen(); | |
| 26432 | |||
| 26433 | 1190 | int32_t type1 = combobuf[MAPCOMBO(x,y-16)].type; // Old-style blue square placement | |
| 26434 | 1190 | int32_t type2 = combobuf[MAPCOMBO(x,y)].type; | |
| 26435 | 1190 | int32_t type3 = combobuf[MAPCOMBO(x,y+16)].type; // More old-style blue square placement | |
| 26436 | |||
| 26437 |
10/10✓ Branch 0 taken 1056 times.
✓ Branch 1 taken 134 times.
✓ Branch 2 taken 31 times.
✓ Branch 3 taken 1025 times.
✓ Branch 4 taken 1005 times.
✓ Branch 5 taken 58 times.
✓ Branch 6 taken 27 times.
✓ Branch 7 taken 978 times.
✓ Branch 8 taken 3 times.
✓ Branch 9 taken 30 times.
|
1190 | if((type1==cCAVE)||(type1>=cCAVEB && type1<=cCAVED) || (type2==cCAVE)||(type2>=cCAVEB && type2<=cCAVED)) |
| 26438 | { | ||
| 26439 | 226 | reset_pal_cycling(); | |
| 26440 | 226 | walkup(COOLSCROLL); | |
| 26441 | 226 | } | |
| 26442 |
10/10✓ Branch 0 taken 1002 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 50 times.
✓ Branch 3 taken 952 times.
✓ Branch 4 taken 906 times.
✓ Branch 5 taken 50 times.
✓ Branch 6 taken 24 times.
✓ Branch 7 taken 882 times.
✓ Branch 8 taken 1 times.
✓ Branch 9 taken 23 times.
|
1008 | else if((type3==cCAVE2)||(type3>=cCAVE2B && type3<=cCAVE2D) || (type2==cCAVE2)||(type2>=cCAVE2B && type2<=cCAVE2D)) |
| 26443 | { | ||
| 26444 | 107 | reset_pal_cycling(); | |
| 26445 | 107 | walkdown2(COOLSCROLL); | |
| 26446 | 107 | } | |
| 26447 |
2/2✓ Branch 0 taken 52 times.
✓ Branch 1 taken 853 times.
|
905 | else if(COOLSCROLL) |
| 26448 | { | ||
| 26449 | 853 | openscreen(); | |
| 26450 | 853 | } | |
| 26451 | } | ||
| 26452 | |||
| 26453 | 1653 | show_subscreen_life=true; | |
| 26454 | 1653 | show_subscreen_numbers=true; | |
| 26455 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 1653 times.
✓ Branch 2 taken 17 times.
✓ Branch 3 taken 17 times.
|
1653 | if (updatemusic || !musicnocut) |
| 26456 | { | ||
| 26457 | 1670 | playLevelMusic(); | |
| 26458 |
1/2✓ Branch 0 taken 1636 times.
✗ Branch 1 not taken.
|
1670 | if (musicrevert) |
| 26459 | ✗ | FFCore.music_update_cond = MUSIC_UPDATE_SCREEN; | |
| 26460 | 1636 | } | |
| 26461 | 1653 | currcset=DMaps[cur_dmap].color; | |
| 26462 | 1653 | dointro(); | |
| 26463 | 1653 | set_respawn_point(); | |
| 26464 | 1653 | trySideviewLadder(); | |
| 26465 | |||
| 26466 |
2/2✓ Branch 0 taken 9816 times.
✓ Branch 1 taken 1653 times.
|
11469 | for(int32_t i=0; i<6; i++) |
| 26467 | 9816 | visited[i]=-1; | |
| 26468 | |||
| 26469 | 1653 | break; | |
| 26470 | } | ||
| 26471 | |||
| 26472 | case wtSCROLL: // scrolling warp | ||
| 26473 | { | ||
| 26474 | 952 | int32_t c = DMaps[cur_dmap].color; | |
| 26475 | 952 | scrolling_dmap = cur_dmap; | |
| 26476 | 952 | scrolling_map = cur_map; | |
| 26477 | 952 | cur_map = DMaps[wdmap].map; | |
| 26478 | 952 | update_subscreens(wdmap); | |
| 26479 | |||
| 26480 | 952 | dlevel = DMaps[wdmap].level; | |
| 26481 | //check if Hero has the map for the new location before updating the subscreen. ? -Z | ||
| 26482 | //This works only in one direction, if Hero had a map, to not having one. | ||
| 26483 | //If Hero does not have a map, and warps somewhere where he does, then the map still briefly shows. | ||
| 26484 | 952 | update_subscreens(wdmap); | |
| 26485 | |||
| 26486 | /*if ( has_item(itype_map, dlevel) ) | ||
| 26487 | { | ||
| 26488 | //Blank the map during an intra-dmap scrolling warp. | ||
| 26489 | dlevel = -1; //a hack for the minimap. This works!! -Z | ||
| 26490 | }*/ | ||
| 26491 | |||
| 26492 | // fix the scrolling direction, if it was a tile or instant warp | ||
| 26493 |
2/4✓ Branch 0 taken 952 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 952 times.
|
952 | if(type==0 || type>=3) |
| 26494 | { | ||
| 26495 | ✗ | sdir = dir; | |
| 26496 | ✗ | } | |
| 26497 | |||
| 26498 | 952 | scrollscr(sdir, wscr+DMaps[wdmap].xoff, wdmap); | |
| 26499 | 952 | scr = hero_scr; | |
| 26500 | |||
| 26501 | 952 | reset_hookshot(); | |
| 26502 |
1/2✓ Branch 0 taken 952 times.
✗ Branch 1 not taken.
|
952 | if(reposition_sword_postwarp) |
| 26503 | { | ||
| 26504 | ✗ | weapon *swd=NULL; | |
| 26505 | ✗ | for(int32_t i=0; i<Lwpns.Count(); i++) | |
| 26506 | { | ||
| 26507 | ✗ | swd = (weapon*)Lwpns.spr(i); | |
| 26508 | |||
| 26509 | ✗ | if(swd->id == (attack==wSword ? wSword : wWand)) | |
| 26510 | { | ||
| 26511 | ✗ | int32_t itype = (attack==wFire ? itype_candle : attack==wCByrna ? itype_cbyrna : attack==wWand ? itype_wand : attack==wHammer ? itype_hammer : itype_sword); | |
| 26512 | ✗ | int32_t item_id = (directWpn>-1 && itemsbuf[directWpn].type==itype) ? directWpn : current_item_id(itype); | |
| 26513 | ✗ | positionSword(swd,item_id); | |
| 26514 | ✗ | break; | |
| 26515 | } | ||
| 26516 | ✗ | } | |
| 26517 | ✗ | } | |
| 26518 |
2/2✓ Branch 0 taken 108 times.
✓ Branch 1 taken 844 times.
|
952 | if(!intradmap) |
| 26519 | { | ||
| 26520 | 844 | init_dmap(); | |
| 26521 | |||
| 26522 | int32_t wrx,wry; | ||
| 26523 | |||
| 26524 |
2/2✓ Branch 0 taken 506 times.
✓ Branch 1 taken 338 times.
|
844 | if(get_qr(qr_NOARRIVALPOINT)) |
| 26525 | { | ||
| 26526 | 506 | wrx=hero_scr->warpreturnx[0]; | |
| 26527 | 506 | wry=hero_scr->warpreturny[0]; | |
| 26528 | 506 | } | |
| 26529 | else | ||
| 26530 | { | ||
| 26531 | 338 | wrx=hero_scr->warparrivalx; | |
| 26532 | 338 | wry=hero_scr->warparrivaly; | |
| 26533 | } | ||
| 26534 | |||
| 26535 |
8/8✓ Branch 0 taken 367 times.
✓ Branch 1 taken 477 times.
✓ Branch 2 taken 341 times.
✓ Branch 3 taken 26 times.
✓ Branch 4 taken 282 times.
✓ Branch 5 taken 562 times.
✓ Branch 6 taken 12 times.
✓ Branch 7 taken 270 times.
|
844 | if(((wrx>0||wry>0)||(get_qr(qr_WARPSIGNOREARRIVALPOINT)))&&(!get_qr(qr_NOSCROLLCONTINUE))&&(!(scr->flags6&fNOCONTINUEHERE))) |
| 26536 | { | ||
| 26537 |
2/2✓ Branch 0 taken 75 times.
✓ Branch 1 taken 195 times.
|
270 | if(dlevel) |
| 26538 | { | ||
| 26539 | 75 | lastentrance = cur_screen; | |
| 26540 | 75 | } | |
| 26541 | else | ||
| 26542 | { | ||
| 26543 | 195 | lastentrance = DMaps[cur_dmap].cont + DMaps[cur_dmap].xoff; | |
| 26544 | } | ||
| 26545 | |||
| 26546 | 270 | lastentrance_dmap = wdmap; | |
| 26547 | 270 | } | |
| 26548 | 844 | } | |
| 26549 |
2/2✓ Branch 0 taken 407 times.
✓ Branch 1 taken 545 times.
|
952 | if(DMaps[cur_dmap].color != c) |
| 26550 | { | ||
| 26551 | 545 | lighting(false, true); | |
| 26552 | 545 | } | |
| 26553 | |||
| 26554 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 952 times.
|
952 | if (updatemusic) |
| 26555 | { | ||
| 26556 | 952 | playLevelMusic(); | |
| 26557 |
1/2✓ Branch 0 taken 952 times.
✗ Branch 1 not taken.
|
952 | if (musicrevert) |
| 26558 | ✗ | FFCore.music_update_cond = MUSIC_UPDATE_SCREEN; | |
| 26559 | 952 | } | |
| 26560 | 952 | currcset=DMaps[cur_dmap].color; | |
| 26561 | 952 | dointro(); | |
| 26562 | } | ||
| 26563 | 952 | break; | |
| 26564 | |||
| 26565 | case wtWHISTLE: // whistle warp | ||
| 26566 | { | ||
| 26567 | 125 | scrolling_dmap = cur_dmap; | |
| 26568 | 125 | scrolling_map = cur_map; | |
| 26569 | 125 | cur_map = DMaps[wdmap].map; | |
| 26570 | 125 | scrollscr(index, wscr+DMaps[wdmap].xoff, wdmap); | |
| 26571 | 125 | scr = hero_scr; | |
| 26572 | 125 | reset_hookshot(); | |
| 26573 | 125 | cur_dmap=wdmap; | |
| 26574 | 125 | dlevel=DMaps[cur_dmap].level; | |
| 26575 | 125 | lighting(false, true); | |
| 26576 | 125 | init_dmap(); | |
| 26577 | |||
| 26578 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 125 times.
|
125 | if (updatemusic) |
| 26579 | { | ||
| 26580 | 125 | playLevelMusic(); | |
| 26581 |
1/2✓ Branch 0 taken 125 times.
✗ Branch 1 not taken.
|
125 | if (musicrevert) |
| 26582 | ✗ | FFCore.music_update_cond = MUSIC_UPDATE_SCREEN; | |
| 26583 | 125 | } | |
| 26584 | 125 | currcset=DMaps[cur_dmap].color; | |
| 26585 | 125 | dointro(); | |
| 26586 | 125 | action=inwind; FFCore.setHeroAction(inwind); | |
| 26587 | int32_t wry; | ||
| 26588 | |||
| 26589 |
2/2✓ Branch 0 taken 42 times.
✓ Branch 1 taken 83 times.
|
125 | if(get_qr(qr_NOARRIVALPOINT)) |
| 26590 | 42 | wry=hero_scr->warpreturny[0]; | |
| 26591 | 83 | else wry=hero_scr->warparrivaly; | |
| 26592 | |||
| 26593 | int32_t wrx; | ||
| 26594 | |||
| 26595 |
2/2✓ Branch 0 taken 42 times.
✓ Branch 1 taken 83 times.
|
125 | if(get_qr(qr_NOARRIVALPOINT)) |
| 26596 | 42 | wrx=hero_scr->warpreturnx[0]; | |
| 26597 | 83 | else wrx=hero_scr->warparrivalx; | |
| 26598 | |||
| 26599 | 125 | wrx += region_scr_dx * 256; | |
| 26600 | 125 | wry += region_scr_dy * 176; | |
| 26601 | |||
| 26602 | 125 | calculate_viewport(viewport, cur_dmap, cur_screen, world_w, world_h, wrx + Hero.txsz*16/2, wry + Hero.tysz*16/2); | |
| 26603 | |||
| 26604 |
4/4✓ Branch 0 taken 2 times.
✓ Branch 1 taken 123 times.
✓ Branch 2 taken 113 times.
✓ Branch 3 taken 10 times.
|
125 | zfix whistle_x = index==left?viewport.right()-16:index==right?viewport.left():wrx; |
| 26605 |
4/4✓ Branch 0 taken 4 times.
✓ Branch 1 taken 121 times.
✓ Branch 2 taken 115 times.
✓ Branch 3 taken 6 times.
|
125 | zfix whistle_y = index==down?viewport.top():index==up?viewport.bottom()-16:wry; |
| 26606 | |||
| 26607 |
3/6✓ Branch 0 taken 125 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 125 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 125 times.
✗ Branch 5 not taken.
|
250 | auto wind = new weapon(whistle_x,whistle_y, |
| 26608 |
2/4✓ Branch 0 taken 125 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 125 times.
✗ Branch 3 not taken.
|
125 | (zfix)0,wWind,1,0,index,whistleitem,getUID(),false,false,true,1); |
| 26609 | 125 | wind->screen_spawned = hero_scr->screen; | |
| 26610 | 125 | Lwpns.add(wind); | |
| 26611 | 125 | whirlwind=255; | |
| 26612 | 125 | whistleitem=-1; | |
| 26613 | } | ||
| 26614 | 125 | break; | |
| 26615 | |||
| 26616 | case wtIWARP: | ||
| 26617 | case wtIWARPBLK: | ||
| 26618 | case wtIWARPOPEN: | ||
| 26619 | case wtIWARPZAP: | ||
| 26620 | case wtIWARPWAVE: // insta-warps | ||
| 26621 | { | ||
| 26622 | 4507 | bool old_192 = false; | |
| 26623 |
2/2✓ Branch 0 taken 4463 times.
✓ Branch 1 taken 44 times.
|
4507 | if (get_qr(qr_192b163_WARP)) |
| 26624 | { | ||
| 26625 |
1/2✓ Branch 0 taken 44 times.
✗ Branch 1 not taken.
|
44 | if ( wtype == wtIWARPWAVE ) |
| 26626 | { | ||
| 26627 | ✗ | wtype = wtIWARPWAVE; | |
| 26628 | ✗ | old_192 = true; | |
| 26629 | ✗ | } | |
| 26630 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 44 times.
|
44 | if ( old_192 ) |
| 26631 | { | ||
| 26632 | ✗ | al_trace("Encountered a warp in a 1.92b163 style quest, that was set as a Wave Warp.\n %s\n", "Trying to redirect it into a Cancel Effect"); | |
| 26633 | ✗ | didpit=false; | |
| 26634 | ✗ | update_subscreens(); | |
| 26635 | ✗ | warp_sound = 0; | |
| 26636 | ✗ | is_warping = false; | |
| 26637 | ✗ | return false; | |
| 26638 | } | ||
| 26639 | 44 | } | |
| 26640 | //for determining whether to exit cave | ||
| 26641 | 4507 | int32_t type1 = combobuf[MAPCOMBO(x,y-16)].type; | |
| 26642 | 4507 | int32_t type2 = combobuf[MAPCOMBO(x,y)].type; | |
| 26643 | 4507 | int32_t type3 = combobuf[MAPCOMBO(x,y+16)].type; | |
| 26644 | |||
| 26645 |
8/8✓ Branch 0 taken 3512 times.
✓ Branch 1 taken 995 times.
✓ Branch 2 taken 168 times.
✓ Branch 3 taken 3344 times.
✓ Branch 4 taken 3512 times.
✓ Branch 5 taken 168 times.
✓ Branch 6 taken 200 times.
✓ Branch 7 taken 3312 times.
|
8491 | bool cavewarp = ((type1==cCAVE)||(type1>=cCAVEB && type1<=cCAVED) || (type2==cCAVE)||(type2>=cCAVEB && type2<=cCAVED) |
| 26646 |
8/8✓ Branch 0 taken 3490 times.
✓ Branch 1 taken 178 times.
✓ Branch 2 taken 159 times.
✓ Branch 3 taken 3331 times.
✓ Branch 4 taken 158 times.
✓ Branch 5 taken 3489 times.
✓ Branch 6 taken 3348 times.
✓ Branch 7 taken 141 times.
|
3512 | ||(type3==cCAVE2)||(type3>=cCAVE2B && type3<=cCAVE2D) || (type2==cCAVE2)||(type2>=cCAVE2B && type2<=cCAVE2D)); |
| 26647 | |||
| 26648 | 5515 | bool kill_action = !(scr->flags3&fIWARP_SPRITE_CARRYOVER); | |
| 26649 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 3522 times.
|
5515 | if(kill_action) |
| 26650 | { | ||
| 26651 | //ALLOFF kills the action, but we want to preserve Hero's action if he's swimming or diving -DD | ||
| 26652 | 3522 | bool wasswimming = (action == swimming); | |
| 26653 | 3522 | int32_t olddiveclk = diveclk; | |
| 26654 | 3522 | ALLOFF(); | |
| 26655 | |||
| 26656 |
2/2✓ Branch 0 taken 3486 times.
✓ Branch 1 taken 36 times.
|
3522 | if(wasswimming) |
| 26657 | { | ||
| 26658 | 36 | Hero.SetSwim(); | |
| 26659 | 36 | set_dive(olddiveclk); | |
| 26660 | 36 | } | |
| 26661 | |||
| 26662 | 3522 | kill_sfx(); | |
| 26663 | 3522 | } | |
| 26664 | //play sound | ||
| 26665 |
2/2✓ Branch 0 taken 3430 times.
✓ Branch 1 taken 95 times.
|
3525 | if(warpsfx > 0) sfx(warpsfx,pan(x)); |
| 26666 |
2/2✓ Branch 0 taken 590 times.
✓ Branch 1 taken 2935 times.
|
3525 | if(wtype==wtIWARPZAP) |
| 26667 | { | ||
| 26668 | 590 | zapout(); | |
| 26669 | 590 | } | |
| 26670 |
2/2✓ Branch 0 taken 223 times.
✓ Branch 1 taken 2712 times.
|
2935 | else if(wtype==wtIWARPWAVE) |
| 26671 | { | ||
| 26672 | //only draw Hero if he's not in a cave -DD | ||
| 26673 | 223 | wavyout(!cavewarp); | |
| 26674 | 223 | } | |
| 26675 |
2/2✓ Branch 0 taken 1531 times.
✓ Branch 1 taken 1181 times.
|
2712 | else if(wtype!=wtIWARP) |
| 26676 | { | ||
| 26677 |
2/2✓ Branch 0 taken 295 times.
✓ Branch 1 taken 886 times.
|
1181 | bool b2 = COOLSCROLL&&cavewarp; |
| 26678 | 1181 | blackscr(30,b2?false:true); | |
| 26679 | 1181 | } | |
| 26680 | |||
| 26681 | 3525 | int32_t c = DMaps[cur_dmap].color; | |
| 26682 | 3525 | bool changedlevel = false; | |
| 26683 | 3525 | bool changeddmap = false; | |
| 26684 |
2/2✓ Branch 0 taken 1540 times.
✓ Branch 1 taken 1985 times.
|
3525 | if(cur_dmap != wdmap) |
| 26685 | { | ||
| 26686 | 1985 | timeExitAllGenscript(GENSCR_ST_CHANGE_DMAP); | |
| 26687 | 1985 | changeddmap = true; | |
| 26688 | 1985 | } | |
| 26689 |
2/2✓ Branch 0 taken 2918 times.
✓ Branch 1 taken 607 times.
|
3525 | if(dlevel != DMaps[wdmap].level) |
| 26690 | { | ||
| 26691 | 607 | timeExitAllGenscript(GENSCR_ST_CHANGE_LEVEL); | |
| 26692 | 607 | changedlevel = true; | |
| 26693 | 607 | } | |
| 26694 | 3525 | dlevel = DMaps[wdmap].level; | |
| 26695 | 3525 | cur_dmap = wdmap; | |
| 26696 |
2/2✓ Branch 0 taken 1540 times.
✓ Branch 1 taken 1985 times.
|
3525 | if(changeddmap) |
| 26697 | { | ||
| 26698 | 1985 | throwGenScriptEvent(GENSCR_EVENT_CHANGE_DMAP); | |
| 26699 | 1985 | } | |
| 26700 |
2/2✓ Branch 0 taken 2918 times.
✓ Branch 1 taken 607 times.
|
3525 | if(changedlevel) |
| 26701 | { | ||
| 26702 | 607 | throwGenScriptEvent(GENSCR_EVENT_CHANGE_LEVEL); | |
| 26703 | 607 | } | |
| 26704 | |||
| 26705 | 3525 | cur_map = DMaps[cur_dmap].map; | |
| 26706 | 3525 | init_dmap(); | |
| 26707 | 3525 | update_subscreens(wdmap); | |
| 26708 | |||
| 26709 | 3525 | ringcolor(false); | |
| 26710 | |||
| 26711 |
2/2✓ Branch 0 taken 2641 times.
✓ Branch 1 taken 884 times.
|
3525 | if(DMaps[cur_dmap].color != c) |
| 26712 | 884 | loadlvlpal(DMaps[cur_dmap].color); | |
| 26713 | |||
| 26714 | 3525 | auto prev_region = cur_region; | |
| 26715 | 3525 | int prev_origin_screen = cur_screen; | |
| 26716 | 3525 | loadscr(cur_dmap, wscr + DMaps[cur_dmap].xoff, -1, overlay); | |
| 26717 | 3525 | scr = hero_scr; | |
| 26718 | 3525 | lightingInstant(); // Also sets naturaldark | |
| 26719 | |||
| 26720 | // In the case where we did not call ALLOFF, preserve the "enemies have spawned" | ||
| 26721 | // state for the new screen. | ||
| 26722 |
2/2✓ Branch 0 taken 3522 times.
✓ Branch 1 taken 3 times.
|
3525 | if (!kill_action) |
| 26723 | { | ||
| 26724 | // Mark the "loaded_enemies" state true if the previous screen had it as true. | ||
| 26725 | // The new screen is attempted to be matched 1:1 with screens in the old region, but if | ||
| 26726 | // the regions are different sizes then the nearest screen is used (it's clamped). | ||
| 26727 | 6 | for_every_base_screen_in_region([&](mapscr* scr, unsigned int region_scr_x, unsigned int region_scr_y) { | |
| 26728 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | int previous_screen_x = zc_min(prev_region.screen_width, region_scr_x); |
| 26729 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | int previous_screen_y = zc_min(prev_region.screen_height, region_scr_y); |
| 26730 | 3 | int previous_screen = prev_origin_screen + previous_screen_x + previous_screen_y*16; | |
| 26731 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | if (get_screen_state(previous_screen).loaded_enemies) |
| 26732 | 3 | get_screen_state(scr->screen).loaded_enemies = true; | |
| 26733 | 3 | }); | |
| 26734 | |||
| 26735 | // Update "screen_spawned" for every sprite to keep it valid. | ||
| 26736 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
8 | for_every_sprite([&](sprite& spr) { |
| 26737 | 5 | int x = get_region_relative_dx(spr.screen_spawned, prev_origin_screen); | |
| 26738 | 5 | int y = get_region_relative_dy(spr.screen_spawned, prev_origin_screen); | |
| 26739 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | x = zc_min(x, cur_region.screen_width); |
| 26740 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | y = zc_min(y, cur_region.screen_height); |
| 26741 | 5 | spr.screen_spawned = cur_screen + x + y*16; | |
| 26742 | 5 | }); | |
| 26743 | 3 | } | |
| 26744 | |||
| 26745 | 3525 | x = hero_scr->warpreturnx[wrindex]; | |
| 26746 | 3525 | y = hero_scr->warpreturny[wrindex]; | |
| 26747 | |||
| 26748 |
2/2✓ Branch 0 taken 2246 times.
✓ Branch 1 taken 1279 times.
|
3525 | if(didpit) |
| 26749 | { | ||
| 26750 | 1279 | didpit=false; | |
| 26751 | 1279 | x=pitx; | |
| 26752 | 1279 | y=pity; | |
| 26753 | 1279 | } | |
| 26754 | |||
| 26755 | 3525 | type1 = combobuf[MAPCOMBO(x,y-16)].type; | |
| 26756 | 3525 | type2 = combobuf[MAPCOMBO(x,y)].type; | |
| 26757 | 3525 | type3 = combobuf[MAPCOMBO(x,y+16)].type; | |
| 26758 | |||
| 26759 |
2/2✓ Branch 0 taken 3421 times.
✓ Branch 1 taken 104 times.
|
3525 | if(x==0) dir=right; |
| 26760 | |||
| 26761 |
2/2✓ Branch 0 taken 3521 times.
✓ Branch 1 taken 4 times.
|
3525 | if(x==240) dir=left; |
| 26762 | |||
| 26763 |
2/2✓ Branch 0 taken 3454 times.
✓ Branch 1 taken 71 times.
|
3525 | if(y==0) dir=down; |
| 26764 | |||
| 26765 |
2/2✓ Branch 0 taken 3422 times.
✓ Branch 1 taken 103 times.
|
3525 | if(y==160) dir=up; |
| 26766 | |||
| 26767 | 3525 | x += region_scr_dx * 256; | |
| 26768 | 3525 | y += region_scr_dy * 176; | |
| 26769 | 3525 | update_viewport(); | |
| 26770 | |||
| 26771 | 3525 | markBmap(dir^1, current_screen); | |
| 26772 | |||
| 26773 | 3525 | int32_t checkwater = iswaterex_z3(MAPCOMBO(x,y+8), -1, x,y+(bigHitbox?8:12)); //iswaterex can be intensive, so let's avoid as many calls as we can. | |
| 26774 | |||
| 26775 |
8/12✓ Branch 0 taken 29 times.
✓ Branch 1 taken 3496 times.
✓ Branch 2 taken 29 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 29 times.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✓ Branch 7 taken 29 times.
✓ Branch 8 taken 29 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 29 times.
✓ Branch 11 taken 3496 times.
|
3554 | if(checkwater && _walkflag(x,y+(bigHitbox?8:12),0,get_standing_z_state()) && current_item(itype_flippers) > 0 && current_item(itype_flippers) >= combobuf[checkwater].attribytes[0] && (!(combobuf[checkwater].usrflags&cflag1) || (itemsbuf[current_item_id(itype_flippers)].flags & item_flag3))) |
| 26776 | { | ||
| 26777 | 29 | hopclk=0xFF; | |
| 26778 | 29 | SetSwim(); | |
| 26779 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 29 times.
|
29 | if (!IsSideSwim()) attackclk = charging = spins = 0; |
| 26780 | 29 | } | |
| 26781 | else | ||
| 26782 | { | ||
| 26783 | 3496 | action = none; FFCore.setHeroAction(none); | |
| 26784 | } | ||
| 26785 | //preloaded freeform combos | ||
| 26786 | 3525 | ffscript_engine(true); | |
| 26787 | |||
| 26788 | 3525 | putscr(hero_scr, scrollbuf, 0, 0); | |
| 26789 | 3525 | putscrdoors(hero_scr, scrollbuf, 0, 0); | |
| 26790 | |||
| 26791 |
10/10✓ Branch 0 taken 3513 times.
✓ Branch 1 taken 12 times.
✓ Branch 2 taken 146 times.
✓ Branch 3 taken 3367 times.
✓ Branch 4 taken 3513 times.
✓ Branch 5 taken 146 times.
✓ Branch 6 taken 183 times.
✓ Branch 7 taken 3330 times.
✓ Branch 8 taken 338 times.
✓ Branch 9 taken 521 times.
|
3525 | if((type1==cCAVE)||(type1>=cCAVEB && type1<=cCAVED) || (type2==cCAVE)||(type2>=cCAVEB && type2<=cCAVED)) |
| 26792 | { | ||
| 26793 | 642 | reset_pal_cycling(); | |
| 26794 | 642 | putscr(hero_scr, scrollbuf, 0, 0); | |
| 26795 | 642 | putscrdoors(hero_scr, scrollbuf, 0, 0); | |
| 26796 | 642 | walkup(COOLSCROLL); | |
| 26797 | 642 | } | |
| 26798 |
9/10✓ Branch 0 taken 3513 times.
✓ Branch 1 taken 338 times.
✓ Branch 2 taken 172 times.
✓ Branch 3 taken 3341 times.
✓ Branch 4 taken 3510 times.
✓ Branch 5 taken 169 times.
✓ Branch 6 taken 179 times.
✓ Branch 7 taken 3331 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 179 times.
|
3851 | else if((type3==cCAVE2)||(type3>=cCAVE2B && type3<=cCAVE2D) || (type2==cCAVE2)||(type2>=cCAVE2B && type2<=cCAVE2D)) |
| 26799 | { | ||
| 26800 | 679 | reset_pal_cycling(); | |
| 26801 | 679 | putscr(hero_scr, scrollbuf, 0, 0); | |
| 26802 | 679 | putscrdoors(hero_scr, scrollbuf, 0, 0); | |
| 26803 | 679 | walkdown2(COOLSCROLL); | |
| 26804 | 679 | } | |
| 26805 |
2/2✓ Branch 0 taken 588 times.
✓ Branch 1 taken 2922 times.
|
3510 | else if(wtype==wtIWARPZAP) |
| 26806 | { | ||
| 26807 | 588 | zapin(); | |
| 26808 | 588 | } | |
| 26809 |
2/2✓ Branch 0 taken 220 times.
✓ Branch 1 taken 2702 times.
|
2922 | else if(wtype==wtIWARPWAVE) |
| 26810 | { | ||
| 26811 | 220 | wavyin(); | |
| 26812 | 220 | } | |
| 26813 |
2/2✓ Branch 0 taken 2460 times.
✓ Branch 1 taken 242 times.
|
2702 | else if(wtype==wtIWARPOPEN) |
| 26814 | { | ||
| 26815 | 242 | openscreen(); | |
| 26816 | 242 | } | |
| 26817 |
1/2✓ Branch 0 taken 4155 times.
✗ Branch 1 not taken.
|
4155 | if(reposition_sword_postwarp) |
| 26818 | { | ||
| 26819 | ✗ | weapon *swd=NULL; | |
| 26820 | ✗ | for(int32_t i=0; i<Lwpns.Count(); i++) | |
| 26821 | { | ||
| 26822 | ✗ | swd = (weapon*)Lwpns.spr(i); | |
| 26823 | |||
| 26824 | ✗ | if(swd->id == (attack==wSword ? wSword : wWand)) | |
| 26825 | { | ||
| 26826 | ✗ | int32_t itype = (attack==wFire ? itype_candle : attack==wCByrna ? itype_cbyrna : attack==wWand ? itype_wand : attack==wHammer ? itype_hammer : itype_sword); | |
| 26827 | ✗ | int32_t item_id = (directWpn>-1 && itemsbuf[directWpn].type==itype) ? directWpn : current_item_id(itype); | |
| 26828 | ✗ | positionSword(swd,item_id); | |
| 26829 | ✗ | break; | |
| 26830 | } | ||
| 26831 | ✗ | } | |
| 26832 | ✗ | } | |
| 26833 | 4155 | show_subscreen_life=true; | |
| 26834 | 4155 | show_subscreen_numbers=true; | |
| 26835 |
2/2✓ Branch 0 taken 630 times.
✓ Branch 1 taken 3525 times.
|
4155 | if (updatemusic) |
| 26836 | { | ||
| 26837 | 3525 | playLevelMusic(); | |
| 26838 |
1/2✓ Branch 0 taken 3525 times.
✗ Branch 1 not taken.
|
3525 | if (musicrevert) |
| 26839 | ✗ | FFCore.music_update_cond = MUSIC_UPDATE_SCREEN; | |
| 26840 | 3525 | } | |
| 26841 | 4155 | currcset=DMaps[cur_dmap].color; | |
| 26842 | 4155 | dointro(); | |
| 26843 | 4155 | set_respawn_point(); | |
| 26844 | 4155 | trySideviewLadder(); | |
| 26845 | } | ||
| 26846 | 4155 | break; | |
| 26847 | |||
| 26848 | |||
| 26849 | case wtNOWARP: | ||
| 26850 | { | ||
| 26851 | 152 | bool old_192 = false; | |
| 26852 |
1/2✓ Branch 0 taken 152 times.
✗ Branch 1 not taken.
|
152 | if (get_qr(qr_192b163_WARP)) |
| 26853 | { | ||
| 26854 | ✗ | wtype = wtIWARPWAVE; | |
| 26855 | ✗ | old_192 = true; | |
| 26856 | ✗ | } | |
| 26857 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 152 times.
|
152 | if ( old_192 ) |
| 26858 | { | ||
| 26859 | ✗ | al_trace("Encountered a warp in a 1.92b163 style quest, that was set as a Cancel Warp.\n %s\n", "Trying to redirect it into a Wave Effect"); | |
| 26860 | //for determining whether to exit cave | ||
| 26861 | ✗ | int32_t type1 = combobuf[MAPCOMBO(x,y-16)].type; | |
| 26862 | ✗ | int32_t type2 = combobuf[MAPCOMBO(x,y)].type; | |
| 26863 | ✗ | int32_t type3 = combobuf[MAPCOMBO(x,y+16)].type; | |
| 26864 | |||
| 26865 | ✗ | bool cavewarp = ((type1==cCAVE)||(type1>=cCAVEB && type1<=cCAVED) || (type2==cCAVE)||(type2>=cCAVEB && type2<=cCAVED) | |
| 26866 | ✗ | ||(type3==cCAVE2)||(type3>=cCAVE2B && type3<=cCAVE2D) || (type2==cCAVE2)||(type2>=cCAVE2B && type2<=cCAVE2D)); | |
| 26867 | |||
| 26868 | ✗ | if(!(scr->flags3&fIWARP_SPRITE_CARRYOVER)) | |
| 26869 | { | ||
| 26870 | //ALLOFF kills the action, but we want to preserve Hero's action if he's swimming or diving -DD | ||
| 26871 | ✗ | bool wasswimming = (action == swimming); | |
| 26872 | ✗ | int32_t olddiveclk = diveclk; | |
| 26873 | ✗ | ALLOFF(); | |
| 26874 | |||
| 26875 | ✗ | if(wasswimming) | |
| 26876 | { | ||
| 26877 | ✗ | Hero.SetSwim(); | |
| 26878 | ✗ | set_dive(olddiveclk); | |
| 26879 | ✗ | } | |
| 26880 | |||
| 26881 | ✗ | kill_sfx(); | |
| 26882 | ✗ | } | |
| 26883 | //play sound | ||
| 26884 | ✗ | if(warpsfx > 0) sfx(warpsfx,pan(x)); | |
| 26885 | ✗ | if(wtype==wtIWARPZAP) | |
| 26886 | { | ||
| 26887 | ✗ | zapout(); | |
| 26888 | ✗ | } | |
| 26889 | ✗ | else if(wtype==wtIWARPWAVE) | |
| 26890 | { | ||
| 26891 | //only draw Hero if he's not in a cave -DD | ||
| 26892 | ✗ | wavyout(!cavewarp); | |
| 26893 | ✗ | } | |
| 26894 | ✗ | else if(wtype!=wtIWARP) | |
| 26895 | { | ||
| 26896 | ✗ | bool b2 = COOLSCROLL&&cavewarp; | |
| 26897 | ✗ | blackscr(30,b2?false:true); | |
| 26898 | ✗ | } | |
| 26899 | |||
| 26900 | ✗ | int32_t c = DMaps[cur_dmap].color; | |
| 26901 | ✗ | bool changedlevel = false; | |
| 26902 | ✗ | bool changeddmap = false; | |
| 26903 | ✗ | if(cur_dmap != wdmap) | |
| 26904 | { | ||
| 26905 | ✗ | timeExitAllGenscript(GENSCR_ST_CHANGE_DMAP); | |
| 26906 | ✗ | changeddmap = true; | |
| 26907 | ✗ | } | |
| 26908 | ✗ | if(dlevel != DMaps[wdmap].level) | |
| 26909 | { | ||
| 26910 | ✗ | timeExitAllGenscript(GENSCR_ST_CHANGE_LEVEL); | |
| 26911 | ✗ | changedlevel = true; | |
| 26912 | ✗ | } | |
| 26913 | ✗ | dlevel = DMaps[wdmap].level; | |
| 26914 | ✗ | cur_dmap = wdmap; | |
| 26915 | ✗ | if(changeddmap) | |
| 26916 | { | ||
| 26917 | ✗ | throwGenScriptEvent(GENSCR_EVENT_CHANGE_DMAP); | |
| 26918 | ✗ | } | |
| 26919 | ✗ | if(changedlevel) | |
| 26920 | { | ||
| 26921 | ✗ | throwGenScriptEvent(GENSCR_EVENT_CHANGE_LEVEL); | |
| 26922 | ✗ | } | |
| 26923 | ✗ | cur_map = DMaps[cur_dmap].map; | |
| 26924 | ✗ | init_dmap(); | |
| 26925 | ✗ | update_subscreens(wdmap); | |
| 26926 | |||
| 26927 | ✗ | ringcolor(false); | |
| 26928 | |||
| 26929 | ✗ | if(DMaps[cur_dmap].color != c) | |
| 26930 | ✗ | loadlvlpal(DMaps[cur_dmap].color); | |
| 26931 | |||
| 26932 | ✗ | loadscr(cur_dmap, wscr + DMaps[cur_dmap].xoff, -1, overlay); | |
| 26933 | ✗ | scr = hero_scr; | |
| 26934 | ✗ | lightingInstant(); // Also sets naturaldark | |
| 26935 | |||
| 26936 | ✗ | x = hero_scr->warpreturnx[wrindex]; | |
| 26937 | ✗ | y = hero_scr->warpreturny[wrindex]; | |
| 26938 | |||
| 26939 | ✗ | if(didpit) | |
| 26940 | { | ||
| 26941 | ✗ | didpit=false; | |
| 26942 | ✗ | x=pitx; | |
| 26943 | ✗ | y=pity; | |
| 26944 | ✗ | } | |
| 26945 | |||
| 26946 | ✗ | type1 = combobuf[MAPCOMBO(x,y-16)].type; | |
| 26947 | ✗ | type2 = combobuf[MAPCOMBO(x,y)].type; | |
| 26948 | ✗ | type3 = combobuf[MAPCOMBO(x,y+16)].type; | |
| 26949 | |||
| 26950 | ✗ | if(x==0) dir=right; | |
| 26951 | |||
| 26952 | ✗ | if(x==240) dir=left; | |
| 26953 | |||
| 26954 | ✗ | if(y==0) dir=down; | |
| 26955 | |||
| 26956 | ✗ | if(y==160) dir=up; | |
| 26957 | |||
| 26958 | ✗ | x += region_scr_dx * 256; | |
| 26959 | ✗ | y += region_scr_dy * 176; | |
| 26960 | ✗ | update_viewport(); | |
| 26961 | |||
| 26962 | ✗ | markBmap(dir^1, current_screen); | |
| 26963 | |||
| 26964 | ✗ | if(iswaterex_z3(MAPCOMBO(x,y+8), -1, x,y+8) && _walkflag(x,y+8,0,get_standing_z_state()) && current_item(itype_flippers)) | |
| 26965 | { | ||
| 26966 | ✗ | hopclk=0xFF; | |
| 26967 | ✗ | SetSwim(); | |
| 26968 | ✗ | if (!IsSideSwim()) attackclk = charging = spins = 0; | |
| 26969 | ✗ | } | |
| 26970 | else | ||
| 26971 | { | ||
| 26972 | ✗ | action = none; | |
| 26973 | ✗ | FFCore.setHeroAction(none); | |
| 26974 | } | ||
| 26975 | //preloaded freeform combos | ||
| 26976 | ✗ | ffscript_engine(true); | |
| 26977 | |||
| 26978 | ✗ | putscr(hero_scr, scrollbuf, 0, 0); | |
| 26979 | ✗ | putscrdoors(hero_scr, scrollbuf, 0, 0); | |
| 26980 | |||
| 26981 | ✗ | if((type1==cCAVE)||(type1>=cCAVEB && type1<=cCAVED) || (type2==cCAVE)||(type2>=cCAVEB && type2<=cCAVED)) | |
| 26982 | { | ||
| 26983 | ✗ | reset_pal_cycling(); | |
| 26984 | ✗ | putscr(hero_scr, scrollbuf, 0, 0); | |
| 26985 | ✗ | putscrdoors(hero_scr, scrollbuf, 0, 0); | |
| 26986 | ✗ | walkup(COOLSCROLL); | |
| 26987 | ✗ | } | |
| 26988 | ✗ | else if((type3==cCAVE2)||(type3>=cCAVE2B && type3<=cCAVE2D) || (type2==cCAVE2)||(type2>=cCAVE2B && type2<=cCAVE2D)) | |
| 26989 | { | ||
| 26990 | ✗ | reset_pal_cycling(); | |
| 26991 | ✗ | putscr(hero_scr, scrollbuf, 0, 0); | |
| 26992 | ✗ | putscrdoors(hero_scr, scrollbuf, 0, 0); | |
| 26993 | ✗ | walkdown2(COOLSCROLL); | |
| 26994 | ✗ | } | |
| 26995 | ✗ | else if(wtype==wtIWARPZAP) | |
| 26996 | { | ||
| 26997 | ✗ | zapin(); | |
| 26998 | ✗ | } | |
| 26999 | ✗ | else if(wtype==wtIWARPWAVE) | |
| 27000 | { | ||
| 27001 | ✗ | wavyin(); | |
| 27002 | ✗ | } | |
| 27003 | ✗ | else if(wtype==wtIWARPOPEN) | |
| 27004 | { | ||
| 27005 | ✗ | openscreen(); | |
| 27006 | ✗ | } | |
| 27007 | ✗ | if(reposition_sword_postwarp) | |
| 27008 | { | ||
| 27009 | ✗ | weapon *swd=NULL; | |
| 27010 | ✗ | for(int32_t i=0; i<Lwpns.Count(); i++) | |
| 27011 | { | ||
| 27012 | ✗ | swd = (weapon*)Lwpns.spr(i); | |
| 27013 | |||
| 27014 | ✗ | if(swd->id == (attack==wSword ? wSword : wWand)) | |
| 27015 | { | ||
| 27016 | ✗ | int32_t itype = (attack==wFire ? itype_candle : attack==wCByrna ? itype_cbyrna : attack==wWand ? itype_wand : attack==wHammer ? itype_hammer : itype_sword); | |
| 27017 | ✗ | int32_t item_id = (directWpn>-1 && itemsbuf[directWpn].type==itype) ? directWpn : current_item_id(itype); | |
| 27018 | ✗ | positionSword(swd,item_id); | |
| 27019 | ✗ | break; | |
| 27020 | } | ||
| 27021 | ✗ | } | |
| 27022 | ✗ | } | |
| 27023 | ✗ | show_subscreen_life=true; | |
| 27024 | ✗ | show_subscreen_numbers=true; | |
| 27025 | ✗ | playLevelMusic(); | |
| 27026 | ✗ | currcset=DMaps[cur_dmap].color; | |
| 27027 | ✗ | dointro(); | |
| 27028 | ✗ | set_respawn_point(); | |
| 27029 | ✗ | trySideviewLadder(); | |
| 27030 | ✗ | break; | |
| 27031 | } | ||
| 27032 | else | ||
| 27033 | { | ||
| 27034 |
1/2✓ Branch 0 taken 152 times.
✗ Branch 1 not taken.
|
152 | if(reposition_sword_postwarp) |
| 27035 | { | ||
| 27036 | ✗ | weapon *swd=NULL; | |
| 27037 | ✗ | for(int32_t i=0; i<Lwpns.Count(); i++) | |
| 27038 | { | ||
| 27039 | ✗ | swd = (weapon*)Lwpns.spr(i); | |
| 27040 | |||
| 27041 | ✗ | if(swd->id == (attack==wSword ? wSword : wWand)) | |
| 27042 | { | ||
| 27043 | ✗ | int32_t itype = (attack==wFire ? itype_candle : attack==wCByrna ? itype_cbyrna : attack==wWand ? itype_wand : attack==wHammer ? itype_hammer : itype_sword); | |
| 27044 | ✗ | int32_t item_id = (directWpn>-1 && itemsbuf[directWpn].type==itype) ? directWpn : current_item_id(itype); | |
| 27045 | ✗ | positionSword(swd,item_id); | |
| 27046 | ✗ | break; | |
| 27047 | } | ||
| 27048 | ✗ | } | |
| 27049 | ✗ | } | |
| 27050 | 152 | didpit=false; | |
| 27051 | 152 | update_subscreens(); | |
| 27052 | 152 | warp_sound = 0; | |
| 27053 | 152 | is_warping = false; | |
| 27054 | 152 | return false; | |
| 27055 | } | ||
| 27056 | } | ||
| 27057 | default: | ||
| 27058 | ✗ | didpit=false; | |
| 27059 | ✗ | update_subscreens(); | |
| 27060 | ✗ | warp_sound = 0; | |
| 27061 | ✗ | is_warping = false; | |
| 27062 | ✗ | if(reposition_sword_postwarp) | |
| 27063 | { | ||
| 27064 | ✗ | weapon *swd=NULL; | |
| 27065 | ✗ | for(int32_t i=0; i<Lwpns.Count(); i++) | |
| 27066 | { | ||
| 27067 | ✗ | swd = (weapon*)Lwpns.spr(i); | |
| 27068 | |||
| 27069 | ✗ | if(swd->id == (attack==wSword ? wSword : wWand)) | |
| 27070 | { | ||
| 27071 | ✗ | int32_t itype = (attack==wFire ? itype_candle : attack==wCByrna ? itype_cbyrna : attack==wWand ? itype_wand : attack==wHammer ? itype_hammer : itype_sword); | |
| 27072 | ✗ | int32_t item_id = (directWpn>-1 && itemsbuf[directWpn].type==itype) ? directWpn : current_item_id(itype); | |
| 27073 | ✗ | positionSword(swd,item_id); | |
| 27074 | ✗ | break; | |
| 27075 | } | ||
| 27076 | ✗ | } | |
| 27077 | ✗ | } | |
| 27078 | ✗ | return false; | |
| 27079 | } | ||
| 27080 | |||
| 27081 | 7792 | currscr_for_passive_subscr = -1; | |
| 27082 | |||
| 27083 | // Stop Hero from drowning! | ||
| 27084 |
5/6✓ Branch 0 taken 7145 times.
✓ Branch 1 taken 647 times.
✓ Branch 2 taken 7145 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 647 times.
✓ Branch 5 taken 6498 times.
|
7792 | if(action==drowning || action==lavadrowning || action==sidedrowning) |
| 27085 | { | ||
| 27086 | 1294 | drownclk=0; | |
| 27087 | 1294 | drownclk=0; | |
| 27088 | 1294 | action=none; FFCore.setHeroAction(none); | |
| 27089 | 1294 | } | |
| 27090 | |||
| 27091 | 6498 | int32_t checkwater = iswaterex_z3(MAPCOMBO(x,y+(bigHitbox?8:12)), -1, x,y+(bigHitbox?8:12)); | |
| 27092 | // But keep him swimming if he ought to be! | ||
| 27093 | // Unless the water is too high levelled, in which case... well, he'll drown on transition probably anyways. -Dimi | ||
| 27094 |
8/8✓ Branch 0 taken 7131 times.
✓ Branch 1 taken 633 times.
✓ Branch 2 taken 52 times.
✓ Branch 3 taken 7079 times.
✓ Branch 4 taken 3 times.
✓ Branch 5 taken 49 times.
✓ Branch 6 taken 7725 times.
✓ Branch 7 taken 39 times.
|
6548 | if(action!=rafting && checkwater && (_walkflag(x,y+(bigHitbox?8:12),0,get_standing_z_state()) || get_qr(qr_DROWN)) |
| 27095 | //&& (current_item(itype_flippers) >= combobuf[checkwater].attribytes[0]) | ||
| 27096 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 2 times.
|
52 | && (action!=inwind)) |
| 27097 | { | ||
| 27098 | 39 | hopclk=0xFF; | |
| 27099 | 39 | SetSwim(); | |
| 27100 | 39 | } | |
| 27101 | |||
| 27102 | 7764 | newscr_clk=frame; | |
| 27103 | 7764 | activated_timed_warp=false; | |
| 27104 | 7764 | eat_buttons(); | |
| 27105 | |||
| 27106 |
2/2✓ Branch 0 taken 2150 times.
✓ Branch 1 taken 5614 times.
|
7764 | if(wtype!=wtIWARP) |
| 27107 | 5614 | attackclk=0; | |
| 27108 | |||
| 27109 | 7764 | didstuff=0; | |
| 27110 | 7764 | usecounts.clear(); | |
| 27111 | 7764 | map_bkgsfx(true); | |
| 27112 | 7764 | loadside=dir^1; | |
| 27113 | 7764 | whistleclk=-1; | |
| 27114 | |||
| 27115 |
3/4✓ Branch 0 taken 7139 times.
✓ Branch 1 taken 625 times.
✓ Branch 2 taken 7764 times.
✗ Branch 3 not taken.
|
7764 | if((z>0 || fakez>0) && isSideViewHero()) |
| 27116 | { | ||
| 27117 | ✗ | y-=z; | |
| 27118 | ✗ | y-=fakez; | |
| 27119 | ✗ | fakez=0; | |
| 27120 | ✗ | z=0; | |
| 27121 | ✗ | } | |
| 27122 |
2/2✓ Branch 0 taken 783 times.
✓ Branch 1 taken 6981 times.
|
7764 | else if(!isSideViewHero()) |
| 27123 | { | ||
| 27124 | 6981 | fall=0; | |
| 27125 | 6981 | fakefall=0; | |
| 27126 | 6981 | } | |
| 27127 | |||
| 27128 | // If warping between top-down and sideview screens, | ||
| 27129 | // fix enemies that are carried over by Full Screen Warp | ||
| 27130 | 7764 | const bool tmpscr_is_sideview = isSideViewHero(); | |
| 27131 | |||
| 27132 |
4/4✓ Branch 0 taken 6983 times.
✓ Branch 1 taken 781 times.
✓ Branch 2 taken 6947 times.
✓ Branch 3 taken 36 times.
|
7764 | if(!wasSideview && tmpscr_is_sideview) |
| 27133 | { | ||
| 27134 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 36 times.
|
36 | for(int32_t i=0; i<guys.Count(); i++) |
| 27135 | { | ||
| 27136 | ✗ | if(guys.spr(i)->z > 0 || guys.spr(i)->fakez > 0) | |
| 27137 | { | ||
| 27138 | ✗ | guys.spr(i)->y -= guys.spr(i)->z; | |
| 27139 | ✗ | guys.spr(i)->y -= guys.spr(i)->fakez; | |
| 27140 | ✗ | guys.spr(i)->z = 0; | |
| 27141 | ✗ | guys.spr(i)->fakez = 0; | |
| 27142 | ✗ | } | |
| 27143 | |||
| 27144 | ✗ | if(((enemy*)guys.spr(i))->type!=eeTRAP && ((enemy*)guys.spr(i))->type!=eeSPINTILE) | |
| 27145 | ✗ | guys.spr(i)->yofs += 2; | |
| 27146 | ✗ | } | |
| 27147 | 36 | } | |
| 27148 |
4/4✓ Branch 0 taken 162 times.
✓ Branch 1 taken 7566 times.
✓ Branch 2 taken 128 times.
✓ Branch 3 taken 34 times.
|
7728 | else if(wasSideview && !tmpscr_is_sideview) |
| 27149 | { | ||
| 27150 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 34 times.
|
34 | for(int32_t i=0; i<guys.Count(); i++) |
| 27151 | { | ||
| 27152 | ✗ | if(((enemy*)guys.spr(i))->type!=eeTRAP && ((enemy*)guys.spr(i))->type!=eeSPINTILE) | |
| 27153 | ✗ | guys.spr(i)->yofs -= 2; | |
| 27154 | ✗ | } | |
| 27155 | 34 | } | |
| 27156 | |||
| 27157 |
6/6✓ Branch 0 taken 4705 times.
✓ Branch 1 taken 3059 times.
✓ Branch 2 taken 430 times.
✓ Branch 3 taken 4275 times.
✓ Branch 4 taken 433 times.
✓ Branch 5 taken 169 times.
|
7764 | if((DMaps[cur_dmap].type&dmfCONTINUE) || (cur_dmap==0&&get_qr(qr_DMAP_0_CONTINUE_BUG))) |
| 27158 | { | ||
| 27159 |
2/2✓ Branch 0 taken 1480 times.
✓ Branch 1 taken 1380 times.
|
3492 | if(dlevel) |
| 27160 | { | ||
| 27161 | int32_t wrx,wry; | ||
| 27162 | |||
| 27163 |
2/2✓ Branch 0 taken 560 times.
✓ Branch 1 taken 820 times.
|
1380 | if(get_qr(qr_NOARRIVALPOINT)) |
| 27164 | { | ||
| 27165 | 560 | wrx=origin_scr->warpreturnx[0]; | |
| 27166 | 560 | wry=origin_scr->warpreturny[0]; | |
| 27167 | 560 | } | |
| 27168 | else | ||
| 27169 | { | ||
| 27170 | 820 | wrx=origin_scr->warparrivalx; | |
| 27171 | 820 | wry=origin_scr->warparrivaly; | |
| 27172 | } | ||
| 27173 | |||
| 27174 |
2/2✓ Branch 0 taken 9 times.
✓ Branch 1 taken 1 times.
|
1390 | if((wtype == wtEXIT) |
| 27175 |
10/10✓ Branch 0 taken 988 times.
✓ Branch 1 taken 392 times.
✓ Branch 2 taken 69 times.
✓ Branch 3 taken 919 times.
✓ Branch 4 taken 50 times.
✓ Branch 5 taken 19 times.
✓ Branch 6 taken 15 times.
✓ Branch 7 taken 35 times.
✓ Branch 8 taken 10 times.
✓ Branch 9 taken 5 times.
|
1380 | || (((wtype == wtSCROLL) && !intradmap) && ((wrx>0 || wry>0)||(get_qr(qr_WARPSIGNOREARRIVALPOINT))))) |
| 27176 | { | ||
| 27177 |
4/4✓ Branch 0 taken 49 times.
✓ Branch 1 taken 392 times.
✓ Branch 2 taken 20 times.
✓ Branch 3 taken 29 times.
|
441 | if(!(wtype==wtSCROLL)||!(get_qr(qr_NOSCROLLCONTINUE))) |
| 27178 | { | ||
| 27179 | 412 | game->set_continue_scrn(home_screen); | |
| 27180 | 412 | } | |
| 27181 |
2/2✓ Branch 0 taken 14 times.
✓ Branch 1 taken 15 times.
|
29 | else if(cur_dmap != game->get_continue_dmap()) |
| 27182 | { | ||
| 27183 | 15 | game->set_continue_scrn(DMaps[cur_dmap].cont + DMaps[cur_dmap].xoff); | |
| 27184 | 15 | } | |
| 27185 | 441 | } | |
| 27186 | else | ||
| 27187 | { | ||
| 27188 |
2/2✓ Branch 0 taken 848 times.
✓ Branch 1 taken 91 times.
|
939 | if(cur_dmap != game->get_continue_dmap()) |
| 27189 | { | ||
| 27190 | 91 | game->set_continue_scrn(DMaps[cur_dmap].cont + DMaps[cur_dmap].xoff); | |
| 27191 | 91 | } | |
| 27192 | } | ||
| 27193 | 1380 | } | |
| 27194 | else | ||
| 27195 | { | ||
| 27196 | 1480 | game->set_continue_scrn(DMaps[cur_dmap].cont + DMaps[cur_dmap].xoff); | |
| 27197 | } | ||
| 27198 | |||
| 27199 | 2860 | game->set_continue_dmap(cur_dmap); | |
| 27200 | 2860 | lastentrance_dmap = cur_dmap; | |
| 27201 | 2860 | lastentrance = game->get_continue_scrn(); | |
| 27202 | 2860 | } | |
| 27203 | |||
| 27204 |
1/2✓ Branch 0 taken 7304 times.
✗ Branch 1 not taken.
|
7304 | if(origin_scr->flags4&fAUTOSAVE) |
| 27205 | { | ||
| 27206 | ✗ | save_game(true,0); | |
| 27207 | ✗ | } | |
| 27208 | |||
| 27209 |
2/2✓ Branch 0 taken 7159 times.
✓ Branch 1 taken 145 times.
|
7304 | if(origin_scr->flags6&fCONTINUEHERE) |
| 27210 | { | ||
| 27211 | 145 | lastentrance_dmap = cur_dmap; | |
| 27212 | 145 | lastentrance = home_screen; | |
| 27213 | 145 | } | |
| 27214 | |||
| 27215 | 7304 | update_subscreens(); | |
| 27216 | 7304 | verifyBothWeapons(); | |
| 27217 | |||
| 27218 | static const char roomtype_names[rMAX][255] = | ||
| 27219 | { | ||
| 27220 | "(None)","Special Item","Pay for Info","Secret Money","Gamble", | ||
| 27221 | "Door Repair","Red Potion or Heart Container","Feed the Goriya","Level 9 Entrance", | ||
| 27222 | "Potion Shop","Shop","More Bombs","Leave Money or Life","10 Rupees", | ||
| 27223 | "3-Stair Warp","Ganon","Zelda", "-<item pond>", "1/2 Magic Upgrade", "Learn Slash", | ||
| 27224 | "More Arrows","Take One Item","Bottle Shop" | ||
| 27225 | }; | ||
| 27226 | |||
| 27227 |
2/2✓ Branch 0 taken 6719 times.
✓ Branch 1 taken 585 times.
|
7304 | if(wtype==wtCAVE) |
| 27228 | { | ||
| 27229 |
2/2✓ Branch 0 taken 431 times.
✓ Branch 1 taken 154 times.
|
585 | if(DMaps[cur_dmap].flags&dmfGUYCAVES) |
| 27230 | 862 | Z_eventlog("Entered %s containing %s.\n",DMaps[cur_dmap].flags&dmfCAVES ? "Cave" : "Item Cellar", | |
| 27231 | 431 | (char *)roomtype_names[special_warp_return_scr->room]); | |
| 27232 | else | ||
| 27233 | 154 | Z_eventlog("Entered %s.",DMaps[cur_dmap].flags&dmfCAVES ? "Cave" : "Item Cellar"); | |
| 27234 | 585 | } | |
| 27235 | 13438 | else Z_eventlog("Warped to DMap %d: %s, screen %d, via %s.\n", cur_dmap, DMaps[cur_dmap].name,cur_screen, | |
| 27236 |
2/2✓ Branch 0 taken 481 times.
✓ Branch 1 taken 6238 times.
|
12957 | wtype==wtPASS ? "Passageway" : |
| 27237 |
2/2✓ Branch 0 taken 1636 times.
✓ Branch 1 taken 4602 times.
|
10840 | wtype==wtEXIT ? "Entrance/Exit" : |
| 27238 |
2/2✓ Branch 0 taken 952 times.
✓ Branch 1 taken 3650 times.
|
4602 | wtype==wtSCROLL ? "Scrolling Warp" : |
| 27239 | 3650 | wtype==wtWHISTLE ? "Whistle Warp" : | |
| 27240 | "Insta-Warp"); | ||
| 27241 | |||
| 27242 | 7304 | eventlog_mapflags(); | |
| 27243 |
1/2✓ Branch 0 taken 7304 times.
✗ Branch 1 not taken.
|
7304 | if(reposition_sword_postwarp) |
| 27244 | { | ||
| 27245 | ✗ | weapon *swd=NULL; | |
| 27246 | ✗ | for(int32_t i=0; i<Lwpns.Count(); i++) | |
| 27247 | { | ||
| 27248 | ✗ | swd = (weapon*)Lwpns.spr(i); | |
| 27249 | |||
| 27250 | ✗ | if(swd->id == (attack==wSword ? wSword : wWand)) | |
| 27251 | { | ||
| 27252 | ✗ | int32_t itype = (attack==wFire ? itype_candle : attack==wCByrna ? itype_cbyrna : attack==wWand ? itype_wand : attack==wHammer ? itype_hammer : itype_sword); | |
| 27253 | ✗ | int32_t item_id = (directWpn>-1 && itemsbuf[directWpn].type==itype) ? directWpn : current_item_id(itype); | |
| 27254 | ✗ | positionSword(swd,item_id); | |
| 27255 | ✗ | break; | |
| 27256 | } | ||
| 27257 | ✗ | } | |
| 27258 | ✗ | } | |
| 27259 | 7304 | FFCore.clear_combo_scripts(); | |
| 27260 |
4/4✓ Branch 0 taken 2447 times.
✓ Branch 1 taken 4857 times.
✓ Branch 2 taken 2180 times.
✓ Branch 3 taken 267 times.
|
7304 | if (!intradmap || get_qr(qr_WARPS_RESTART_DMAPSCRIPT)) |
| 27261 | { | ||
| 27262 | 7037 | FFScript::deallocateAllScriptOwned(ScriptType::DMap, olddmap); | |
| 27263 | 7037 | FFCore.initZScriptDMapScripts(); | |
| 27264 | 7037 | FFCore.initZScriptScriptedActiveSubscreen(); | |
| 27265 | 7037 | } | |
| 27266 | 7304 | is_warping = false; | |
| 27267 |
2/2✓ Branch 0 taken 7040 times.
✓ Branch 1 taken 264 times.
|
7304 | if(!get_qr(qr_SCROLLWARP_NO_RESET_FRAME)) |
| 27268 | 264 | GameFlags |= GAMEFLAG_RESET_GAME_LOOP; | |
| 27269 | 7304 | return true; | |
| 27270 | 7456 | } | |
| 27271 | |||
| 27272 | 373 | void HeroClass::exitcave() | |
| 27273 | { | ||
| 27274 | 373 | bool updatemusic = FFCore.can_dmap_change_music(cur_dmap); | |
| 27275 | 373 | bool musicnocut = FFCore.music_update_flags & MUSIC_UPDATE_FLAG_NOCUT; | |
| 27276 | |||
| 27277 | 373 | stop_sfx(QMisc.miscsfx[sfxLOWHEART]); | |
| 27278 | 373 | loadscr(cur_dmap, home_screen, 255, false); // bogus direction | |
| 27279 | 373 | x = hero_scr->warpreturnx[0]; | |
| 27280 | 373 | y = hero_scr->warpreturny[0]; | |
| 27281 | |||
| 27282 |
1/2✓ Branch 0 taken 373 times.
✗ Branch 1 not taken.
|
373 | if(didpit) |
| 27283 | { | ||
| 27284 | ✗ | didpit=false; | |
| 27285 | ✗ | x=pitx; | |
| 27286 | ✗ | y=pity; | |
| 27287 | ✗ | } | |
| 27288 | |||
| 27289 |
2/2✓ Branch 0 taken 355 times.
✓ Branch 1 taken 18 times.
|
373 | if(x+y == 0) |
| 27290 | 18 | x = y = 80; | |
| 27291 | |||
| 27292 | 373 | x += region_scr_dx*256; | |
| 27293 | 373 | y += region_scr_dy*176; | |
| 27294 | 373 | update_viewport(); | |
| 27295 | |||
| 27296 | 373 | int32_t type1 = combobuf[MAPCOMBO(x,y-16)].type; | |
| 27297 | 373 | int32_t type2 = combobuf[MAPCOMBO(x,y)].type; | |
| 27298 | 373 | int32_t type3 = combobuf[MAPCOMBO(x,y+16)].type; | |
| 27299 |
2/2✓ Branch 0 taken 42 times.
✓ Branch 1 taken 331 times.
|
724 | bool b = COOLSCROLL && |
| 27300 |
4/4✓ Branch 0 taken 216 times.
✓ Branch 1 taken 115 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 211 times.
|
331 | ((type1==cCAVE) || (type1>=cCAVEB && type1<=cCAVED) || |
| 27301 |
4/4✓ Branch 0 taken 213 times.
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 208 times.
|
211 | (type2==cCAVE) || (type2>=cCAVEB && type2<=cCAVED) || |
| 27302 |
4/4✓ Branch 0 taken 195 times.
✓ Branch 1 taken 17 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 190 times.
|
208 | (type3==cCAVE2) || (type3>=cCAVE2B && type3<=cCAVE2D) || |
| 27303 |
4/4✓ Branch 0 taken 5 times.
✓ Branch 1 taken 195 times.
✓ Branch 2 taken 190 times.
✓ Branch 3 taken 5 times.
|
190 | (type2==cCAVE2) || (type2>=cCAVE2B && type2<=cCAVE2D)); |
| 27304 | 393 | ALLOFF(); | |
| 27305 | 393 | blackscr(30,b?false:true); | |
| 27306 | 393 | ringcolor(false); | |
| 27307 | 393 | loadlvlpal(DMaps[cur_dmap].color); | |
| 27308 | 393 | lighting(false, true); | |
| 27309 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 393 times.
✓ Branch 2 taken 10 times.
✓ Branch 3 taken 10 times.
|
393 | if (updatemusic || !musicnocut) |
| 27310 | 403 | music_stop(); | |
| 27311 | 413 | kill_sfx(); | |
| 27312 | 413 | putscr(hero_scr, scrollbuf, 0, 0); | |
| 27313 | 413 | putscrdoors(hero_scr, scrollbuf, 0, 0); | |
| 27314 | |||
| 27315 |
10/10✓ Branch 0 taken 240 times.
✓ Branch 1 taken 153 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 235 times.
✓ Branch 4 taken 237 times.
✓ Branch 5 taken 4 times.
✓ Branch 6 taken 5 times.
✓ Branch 7 taken 232 times.
✓ Branch 8 taken 4 times.
✓ Branch 9 taken 9 times.
|
413 | if((type1==cCAVE)||(type1>=cCAVEB && type1<=cCAVED) || (type2==cCAVE)||(type2>=cCAVEB && type2<=cCAVED)) |
| 27316 | { | ||
| 27317 | 166 | walkup(COOLSCROLL); | |
| 27318 | 166 | } | |
| 27319 |
9/10✓ Branch 0 taken 219 times.
✓ Branch 1 taken 16 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 214 times.
✓ Branch 4 taken 219 times.
✓ Branch 5 taken 5 times.
✓ Branch 6 taken 5 times.
✓ Branch 7 taken 214 times.
✗ Branch 8 not taken.
✓ Branch 9 taken 5 times.
|
241 | else if((type3==cCAVE2)||(type3>=cCAVE2B && type3<=cCAVE2D) || (type2==cCAVE2)||(type2>=cCAVE2B && type2<=cCAVE2D)) |
| 27320 | { | ||
| 27321 | 26 | walkdown2(COOLSCROLL); | |
| 27322 | 26 | } | |
| 27323 | |||
| 27324 | 403 | show_subscreen_life=true; | |
| 27325 | 403 | show_subscreen_numbers=true; | |
| 27326 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 403 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
403 | if (updatemusic || !musicnocut) |
| 27327 | 403 | playLevelMusic(); | |
| 27328 | 403 | currcset=DMaps[cur_dmap].color; | |
| 27329 | 403 | dointro(); | |
| 27330 | 403 | newscr_clk=frame; | |
| 27331 | 403 | activated_timed_warp=false; | |
| 27332 | 403 | dir=down; | |
| 27333 | 403 | set_respawn_point(); | |
| 27334 | 403 | eat_buttons(); | |
| 27335 | 403 | didstuff=0; | |
| 27336 | 403 | usecounts.clear(); | |
| 27337 | 403 | map_bkgsfx(true); | |
| 27338 | 403 | loadside=dir^1; | |
| 27339 | 403 | } | |
| 27340 | |||
| 27341 | |||
| 27342 | 11096 | void HeroClass::stepforward(int32_t steps, bool adjust) | |
| 27343 | { | ||
| 27344 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11096 times.
|
11096 | if ( FFCore.nostepforward ) return; |
| 27345 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11096 times.
|
11096 | if ( FFCore.temp_no_stepforward ) { FFCore.temp_no_stepforward = 0; return; } |
| 27346 | 11096 | zfix tx=x; //temp x | |
| 27347 | 11096 | zfix ty=y; //temp y | |
| 27348 | 11096 | zfix tstep(0); //temp single step distance | |
| 27349 | 11096 | zfix s(0); //calculated step distance for all steps | |
| 27350 | 11096 | z3step=2; | |
| 27351 | 11096 | int32_t sh=shiftdir; | |
| 27352 | 11096 | shiftdir=-1; | |
| 27353 | |||
| 27354 |
2/2✓ Branch 0 taken 189538 times.
✓ Branch 1 taken 11096 times.
|
200634 | for(int32_t i=steps; i>0; --i) |
| 27355 | { | ||
| 27356 |
2/2✓ Branch 0 taken 499 times.
✓ Branch 1 taken 189039 times.
|
189538 | if(diagonalMovement) |
| 27357 | { | ||
| 27358 |
3/4✓ Branch 0 taken 263 times.
✓ Branch 1 taken 236 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 263 times.
|
499 | if(get_qr(qr_NEW_HERO_MOVEMENT) || IsSideSwim()) |
| 27359 | { | ||
| 27360 | 236 | tstep = 1.5; | |
| 27361 | 236 | } | |
| 27362 | else | ||
| 27363 | { | ||
| 27364 | 263 | tstep=z3step; | |
| 27365 | 263 | z3step=(z3step%2)+1; | |
| 27366 | } | ||
| 27367 | 499 | } | |
| 27368 | else | ||
| 27369 | { | ||
| 27370 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 189039 times.
|
189039 | if(get_qr(qr_NEW_HERO_MOVEMENT)) |
| 27371 | { | ||
| 27372 | ✗ | tstep = 1.5; | |
| 27373 | ✗ | } | |
| 27374 | else | ||
| 27375 | { | ||
| 27376 |
2/2✓ Branch 0 taken 105445 times.
✓ Branch 1 taken 83594 times.
|
189039 | tstep=lsteps[int32_t((dir<left)?ty:tx)&7]; |
| 27377 | |||
| 27378 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 60103 times.
✓ Branch 2 taken 45342 times.
✓ Branch 3 taken 38591 times.
✓ Branch 4 taken 45003 times.
|
189039 | switch(dir) |
| 27379 | { | ||
| 27380 | case up: | ||
| 27381 | 60103 | ty-=tstep; | |
| 27382 | 60103 | break; | |
| 27383 | |||
| 27384 | case down: | ||
| 27385 | 45342 | ty+=tstep; | |
| 27386 | 45342 | break; | |
| 27387 | |||
| 27388 | case left: | ||
| 27389 | 38591 | tx-=tstep; | |
| 27390 | 38591 | break; | |
| 27391 | |||
| 27392 | case right: | ||
| 27393 | 45003 | tx+=tstep; | |
| 27394 | 45003 | break; | |
| 27395 | } | ||
| 27396 | } | ||
| 27397 | } | ||
| 27398 | |||
| 27399 | 189538 | s+=tstep; | |
| 27400 | 189538 | } | |
| 27401 | |||
| 27402 | 11096 | z3step=2; | |
| 27403 | |||
| 27404 | 11096 | x = x.getInt(); | |
| 27405 | 11096 | y = y.getInt(); | |
| 27406 |
2/2✓ Branch 0 taken 200401 times.
✓ Branch 1 taken 11093 times.
|
211494 | while(s>=0) |
| 27407 | { | ||
| 27408 |
2/2✓ Branch 0 taken 501 times.
✓ Branch 1 taken 199900 times.
|
200401 | if(diagonalMovement) |
| 27409 | { | ||
| 27410 |
5/6✓ Branch 0 taken 467 times.
✓ Branch 1 taken 34 times.
✓ Branch 2 taken 56 times.
✓ Branch 3 taken 445 times.
✓ Branch 4 taken 56 times.
✗ Branch 5 not taken.
|
501 | if((dir<left?x.getInt()&7:y.getInt()&7)&&adjust==true) |
| 27411 | { | ||
| 27412 | ✗ | if(get_qr(qr_NEW_HERO_MOVEMENT) || IsSideSwim()) | |
| 27413 | { | ||
| 27414 | ✗ | walkable = false; | |
| 27415 | ✗ | shiftdir = -1; | |
| 27416 | ✗ | int32_t tdir=dir<left?(x.getInt()&8?left:right):(y.getInt()&8?down:up); | |
| 27417 | ✗ | switch(tdir) | |
| 27418 | { | ||
| 27419 | case left: | ||
| 27420 | ✗ | --x; | |
| 27421 | ✗ | break; | |
| 27422 | case right: | ||
| 27423 | ✗ | ++x; | |
| 27424 | ✗ | break; | |
| 27425 | case up: | ||
| 27426 | ✗ | --y; | |
| 27427 | ✗ | break; | |
| 27428 | case down: | ||
| 27429 | ✗ | ++y; | |
| 27430 | ✗ | break; | |
| 27431 | } | ||
| 27432 | ✗ | } | |
| 27433 | else | ||
| 27434 | { | ||
| 27435 | ✗ | walkable=false; | |
| 27436 | ✗ | shiftdir=dir<left?(x.getInt()&8?left:right):(y.getInt()&8?down:up); | |
| 27437 | ✗ | moveOld2(dir, 150); | |
| 27438 | } | ||
| 27439 | ✗ | } | |
| 27440 | else | ||
| 27441 | { | ||
| 27442 |
3/4✓ Branch 0 taken 244 times.
✓ Branch 1 taken 257 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 244 times.
|
501 | if(get_qr(qr_NEW_HERO_MOVEMENT) || IsSideSwim()) |
| 27443 | { | ||
| 27444 | 257 | s-=1.5; | |
| 27445 | 257 | } | |
| 27446 | else | ||
| 27447 | { | ||
| 27448 | 244 | s-=z3step; | |
| 27449 | } | ||
| 27450 | 501 | walkable=true; | |
| 27451 | 501 | moveOld2(dir, 150); | |
| 27452 | } | ||
| 27453 | |||
| 27454 | 501 | shiftdir=-1; | |
| 27455 | 501 | } | |
| 27456 | else | ||
| 27457 | { | ||
| 27458 |
3/6✓ Branch 0 taken 111689 times.
✓ Branch 1 taken 88211 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 199900 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
199900 | if((dir<left?x.getInt()&7:y.getInt()&7)&&adjust==true) |
| 27459 | { | ||
| 27460 | ✗ | walkable=false; | |
| 27461 | ✗ | int32_t tdir=dir<left?(x.getInt()&8?left:right):(y.getInt()&8?down:up); | |
| 27462 | ✗ | switch(tdir) | |
| 27463 | { | ||
| 27464 | case left: | ||
| 27465 | ✗ | --x; | |
| 27466 | ✗ | break; | |
| 27467 | case right: | ||
| 27468 | ✗ | ++x; | |
| 27469 | ✗ | break; | |
| 27470 | case up: | ||
| 27471 | ✗ | --y; | |
| 27472 | ✗ | break; | |
| 27473 | case down: | ||
| 27474 | ✗ | ++y; | |
| 27475 | ✗ | break; | |
| 27476 | } | ||
| 27477 | ✗ | } | |
| 27478 | else | ||
| 27479 | { | ||
| 27480 |
2/4✓ Branch 0 taken 199900 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 199900 times.
|
199900 | if(get_qr(qr_NEW_HERO_MOVEMENT) || IsSideSwim()) |
| 27481 | { | ||
| 27482 | ✗ | s-=1.5; | |
| 27483 | ✗ | } | |
| 27484 |
2/2✓ Branch 0 taken 111689 times.
✓ Branch 1 taken 88211 times.
|
199900 | else if(dir<left) |
| 27485 | { | ||
| 27486 | 111689 | s-=lsteps[y.getInt()&7]; | |
| 27487 | 111689 | } | |
| 27488 | else | ||
| 27489 | { | ||
| 27490 | 88211 | s-=lsteps[x.getInt()&7]; | |
| 27491 | } | ||
| 27492 | |||
| 27493 | 199900 | moveOld2(dir, 150); | |
| 27494 | } | ||
| 27495 | } | ||
| 27496 | |||
| 27497 |
2/2✓ Branch 0 taken 189308 times.
✓ Branch 1 taken 11093 times.
|
200401 | if(s<0) |
| 27498 | { | ||
| 27499 | // Not quite sure how this is actually supposed to work. | ||
| 27500 | // There have to be two cases for each direction or Hero | ||
| 27501 | // either walks too far onto the screen or may get stuck | ||
| 27502 | // going through walk-through walls. | ||
| 27503 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 4002 times.
✓ Branch 2 taken 2455 times.
✓ Branch 3 taken 2115 times.
✓ Branch 4 taken 2521 times.
|
11093 | switch(dir) |
| 27504 | { | ||
| 27505 | case up: | ||
| 27506 |
2/2✓ Branch 0 taken 225 times.
✓ Branch 1 taken 3777 times.
|
4002 | if(y<8) // Leaving the screen |
| 27507 | 225 | y+=s; | |
| 27508 | else // Entering the screen | ||
| 27509 | 3777 | y-=s; | |
| 27510 | |||
| 27511 | 4002 | break; | |
| 27512 | |||
| 27513 | case down: | ||
| 27514 |
2/2✓ Branch 0 taken 216 times.
✓ Branch 1 taken 2239 times.
|
2455 | if(y>152) |
| 27515 | 216 | y-=s; | |
| 27516 | else | ||
| 27517 | 2239 | y+=s; | |
| 27518 | |||
| 27519 | 2455 | break; | |
| 27520 | |||
| 27521 | case left: | ||
| 27522 |
2/2✓ Branch 0 taken 175 times.
✓ Branch 1 taken 1940 times.
|
2115 | if(x<8) |
| 27523 | 175 | x+=s; | |
| 27524 | else | ||
| 27525 | 1940 | x-=s; | |
| 27526 | |||
| 27527 | 2115 | break; | |
| 27528 | |||
| 27529 | case right: | ||
| 27530 |
2/2✓ Branch 0 taken 195 times.
✓ Branch 1 taken 2326 times.
|
2521 | if(x>=232) |
| 27531 | 195 | x-=s; | |
| 27532 | else | ||
| 27533 | 2326 | x+=s; | |
| 27534 | |||
| 27535 | 2521 | break; | |
| 27536 | } | ||
| 27537 | 11093 | } | |
| 27538 | |||
| 27539 | 200401 | clear_darkroom_bitmaps(); | |
| 27540 | 200401 | update_viewport(); | |
| 27541 | 200401 | draw_screen(); | |
| 27542 |
1/2✓ Branch 0 taken 200401 times.
✗ Branch 1 not taken.
|
200401 | if (canSideviewLadder()) setOnSideviewLadder(true); |
| 27543 | 200401 | advanceframe(true); | |
| 27544 | |||
| 27545 |
2/2✓ Branch 0 taken 200398 times.
✓ Branch 1 taken 3 times.
|
200401 | if(Quit) |
| 27546 | 3 | return; | |
| 27547 | } | ||
| 27548 |
4/4✓ Branch 0 taken 8572 times.
✓ Branch 1 taken 2521 times.
✓ Branch 2 taken 2455 times.
✓ Branch 3 taken 6117 times.
|
11093 | if(dir==right||dir==down) |
| 27549 | { | ||
| 27550 | 4976 | x=int32_t(x); | |
| 27551 | 4976 | y=int32_t(y); | |
| 27552 | 4976 | } | |
| 27553 | else | ||
| 27554 | { | ||
| 27555 | 6117 | x = x.getInt(); | |
| 27556 | 6117 | y = y.getInt(); | |
| 27557 | } | ||
| 27558 | 11093 | set_respawn_point(); | |
| 27559 | 11093 | draw_screen(); | |
| 27560 | 11093 | eat_buttons(); | |
| 27561 | 11093 | shiftdir=sh; | |
| 27562 | 11096 | } | |
| 27563 | |||
| 27564 | 1289 | void HeroClass::setpit() | |
| 27565 | { | ||
| 27566 | 1289 | didpit = true; | |
| 27567 | 1289 | pitx = x.getInt() % 256; | |
| 27568 | 1289 | pity = y.getInt() % 176; | |
| 27569 | 1289 | } | |
| 27570 | |||
| 27571 | 458 | void HeroClass::walkdown(bool opening) //entering cave | |
| 27572 | { | ||
| 27573 |
2/2✓ Branch 0 taken 60 times.
✓ Branch 1 taken 398 times.
|
458 | if(opening) |
| 27574 | { | ||
| 27575 | 398 | close_black_opening(x+8, y+8+playing_field_offset, false); | |
| 27576 | 398 | } | |
| 27577 | |||
| 27578 | 458 | hclk=0; | |
| 27579 | 458 | stop_item_sfx(itype_brang); | |
| 27580 | 458 | sfx(WAV_STAIRS,pan(x)); | |
| 27581 | 458 | clk=0; | |
| 27582 | // Fix Hero's position to the grid | ||
| 27583 | 458 | y=TRUNCATE_TILE(y.getInt()); | |
| 27584 | 458 | action=climbcoverbottom; FFCore.setHeroAction(climbcoverbottom); | |
| 27585 | 458 | attack=wNone; | |
| 27586 | 458 | attackid=-1; | |
| 27587 | 458 | reset_swordcharge(); | |
| 27588 | 458 | climb_cover_x=TRUNCATE_TILE(x.getInt()); | |
| 27589 | 458 | climb_cover_y=TRUNCATE_TILE(y.getInt()) + 16; | |
| 27590 | |||
| 27591 | 458 | guys.clear(); | |
| 27592 | 458 | chainlinks.clear(); | |
| 27593 | 458 | Lwpns.clear(); | |
| 27594 | 458 | Ewpns.clear(); | |
| 27595 | 458 | items.clear(); | |
| 27596 | |||
| 27597 |
2/2✓ Branch 0 taken 458 times.
✓ Branch 1 taken 29312 times.
|
29770 | for(int32_t i=0; i<64; i++) |
| 27598 | { | ||
| 27599 | 29312 | herostep(); | |
| 27600 | |||
| 27601 |
2/4✓ Branch 0 taken 29312 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 29312 times.
|
29312 | if(zinit.heroAnimationStyle==las_zelda3 || zinit.heroAnimationStyle==las_zelda3slow) |
| 27602 | ✗ | hero_count=(hero_count+1)%16; | |
| 27603 | |||
| 27604 |
2/2✓ Branch 0 taken 21984 times.
✓ Branch 1 taken 7328 times.
|
29312 | if((i&3)==3) |
| 27605 | { | ||
| 27606 | 7328 | ++y; | |
| 27607 | 7328 | update_viewport(); | |
| 27608 | 7328 | } | |
| 27609 | |||
| 27610 | 29312 | draw_screen(); | |
| 27611 | 29312 | advanceframe(true); | |
| 27612 | |||
| 27613 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 29312 times.
|
29312 | if(Quit) |
| 27614 | ✗ | break; | |
| 27615 | 29312 | } | |
| 27616 | |||
| 27617 | 458 | action=none; FFCore.setHeroAction(none); | |
| 27618 | 458 | } | |
| 27619 | |||
| 27620 | 120 | void HeroClass::walkdown2(bool opening) //exiting cave 2 | |
| 27621 | { | ||
| 27622 | 120 | int32_t type = combobuf[MAPCOMBO(x,y)].type; | |
| 27623 | |||
| 27624 | |||
| 27625 | // Fix Hero's position to the grid | ||
| 27626 | 120 | y=TRUNCATE_TILE(y.getInt()); | |
| 27627 | |||
| 27628 |
3/6✓ Branch 0 taken 21 times.
✓ Branch 1 taken 99 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 21 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
120 | if((type==cCAVE2)||(type>=cCAVE2B && type<=cCAVE2D)) |
| 27629 | 99 | y -= 16; | |
| 27630 | |||
| 27631 | 120 | climb_cover_x=TRUNCATE_TILE(x.getInt()); | |
| 27632 | 120 | climb_cover_y=TRUNCATE_TILE(y.getInt()); | |
| 27633 | |||
| 27634 | 120 | dir=down; | |
| 27635 | 120 | z=fakez=fall=fakefall=0; | |
| 27636 | |||
| 27637 |
2/2✓ Branch 0 taken 95 times.
✓ Branch 1 taken 25 times.
|
120 | if(opening) |
| 27638 | { | ||
| 27639 | 25 | open_black_opening(x+8, y+8+playing_field_offset+16, false); | |
| 27640 | 25 | } | |
| 27641 | |||
| 27642 | 120 | hclk=0; | |
| 27643 | 120 | stop_item_sfx(itype_brang); | |
| 27644 | 120 | sfx(WAV_STAIRS,pan(x)); | |
| 27645 | 120 | clk=0; | |
| 27646 | 120 | action=climbcovertop; FFCore.setHeroAction(climbcovertop); | |
| 27647 | 120 | attack=wNone; | |
| 27648 | 120 | attackid=-1; | |
| 27649 | 120 | reset_swordcharge(); | |
| 27650 | |||
| 27651 | 120 | guys.clear(); | |
| 27652 | 120 | chainlinks.clear(); | |
| 27653 | 120 | Lwpns.clear(); | |
| 27654 | 120 | Ewpns.clear(); | |
| 27655 | 120 | items.clear(); | |
| 27656 | |||
| 27657 |
2/2✓ Branch 0 taken 120 times.
✓ Branch 1 taken 7680 times.
|
7800 | for(int32_t i=0; i<64; i++) |
| 27658 | { | ||
| 27659 | 7680 | herostep(); | |
| 27660 | |||
| 27661 |
2/4✓ Branch 0 taken 7680 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 7680 times.
|
7680 | if(zinit.heroAnimationStyle==las_zelda3 || zinit.heroAnimationStyle==las_zelda3slow) |
| 27662 | ✗ | hero_count=(hero_count+1)%16; | |
| 27663 | |||
| 27664 |
2/2✓ Branch 0 taken 5760 times.
✓ Branch 1 taken 1920 times.
|
7680 | if((i&3)==3) |
| 27665 | { | ||
| 27666 | 1920 | ++y; | |
| 27667 | 1920 | update_viewport(); | |
| 27668 | 1920 | } | |
| 27669 | |||
| 27670 | 7680 | draw_screen(); | |
| 27671 | 7680 | advanceframe(true); | |
| 27672 | |||
| 27673 |
1/2✓ Branch 0 taken 7680 times.
✗ Branch 1 not taken.
|
7680 | if(Quit) |
| 27674 | ✗ | break; | |
| 27675 | 7680 | } | |
| 27676 | |||
| 27677 | |||
| 27678 | 120 | action=none; FFCore.setHeroAction(none); | |
| 27679 | 120 | } | |
| 27680 | |||
| 27681 | 380 | void HeroClass::walkup(bool opening) //exiting cave | |
| 27682 | { | ||
| 27683 | 380 | int32_t type = combobuf[MAPCOMBO(x,y)].type; | |
| 27684 | |||
| 27685 |
5/6✓ Branch 0 taken 325 times.
✓ Branch 1 taken 55 times.
✓ Branch 2 taken 26 times.
✓ Branch 3 taken 299 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 26 times.
|
380 | if((type==cCAVE)||(type>=cCAVEB && type<=cCAVED)) |
| 27686 | 55 | y+=16; | |
| 27687 | |||
| 27688 | // Fix Hero's position to the grid | ||
| 27689 | 380 | y=TRUNCATE_TILE(y.getInt()); | |
| 27690 | 380 | z=fakez=fall=fakefall=0; | |
| 27691 | |||
| 27692 |
2/2✓ Branch 0 taken 49 times.
✓ Branch 1 taken 331 times.
|
380 | if(opening) |
| 27693 | { | ||
| 27694 | 331 | open_black_opening(x+8, y+8+playing_field_offset-16, false); | |
| 27695 | 331 | } | |
| 27696 | |||
| 27697 | 380 | hclk=0; | |
| 27698 | 380 | stop_item_sfx(itype_brang); | |
| 27699 | 380 | sfx(WAV_STAIRS,pan(x)); | |
| 27700 | 380 | dir=down; | |
| 27701 | 380 | clk=0; | |
| 27702 | 380 | action=climbcoverbottom; FFCore.setHeroAction(climbcoverbottom); | |
| 27703 | 380 | attack=wNone; | |
| 27704 | 380 | attackid=-1; | |
| 27705 | 380 | reset_swordcharge(); | |
| 27706 | 380 | climb_cover_x=TRUNCATE_TILE(x.getInt()); | |
| 27707 | 380 | climb_cover_y=TRUNCATE_TILE(y.getInt()); | |
| 27708 | |||
| 27709 | 380 | guys.clear(); | |
| 27710 | 380 | chainlinks.clear(); | |
| 27711 | 380 | Lwpns.clear(); | |
| 27712 | 380 | Ewpns.clear(); | |
| 27713 | 380 | items.clear(); | |
| 27714 | |||
| 27715 |
2/2✓ Branch 0 taken 380 times.
✓ Branch 1 taken 24320 times.
|
24700 | for(int32_t i=0; i<64; i++) |
| 27716 | { | ||
| 27717 | 24320 | herostep(); | |
| 27718 | |||
| 27719 |
2/4✓ Branch 0 taken 24320 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 24320 times.
|
24320 | if(zinit.heroAnimationStyle==las_zelda3 || zinit.heroAnimationStyle==las_zelda3slow) |
| 27720 | ✗ | hero_count=(hero_count+1)%16; | |
| 27721 | |||
| 27722 |
2/2✓ Branch 0 taken 18240 times.
✓ Branch 1 taken 6080 times.
|
24320 | if((i&3)==0) |
| 27723 | { | ||
| 27724 | 6080 | --y; | |
| 27725 | 6080 | update_viewport(); | |
| 27726 | 6080 | } | |
| 27727 | |||
| 27728 | 24320 | draw_screen(); | |
| 27729 | 24320 | advanceframe(true); | |
| 27730 | |||
| 27731 |
1/2✓ Branch 0 taken 24320 times.
✗ Branch 1 not taken.
|
24320 | if(Quit) |
| 27732 | ✗ | break; | |
| 27733 | 24320 | } | |
| 27734 | |||
| 27735 | 380 | map_bkgsfx(true); | |
| 27736 | 380 | loadside=dir^1; | |
| 27737 | 380 | action=none; FFCore.setHeroAction(none); | |
| 27738 | 380 | } | |
| 27739 | |||
| 27740 | 423 | void HeroClass::walkup2(bool opening) //entering cave2 | |
| 27741 | { | ||
| 27742 |
2/2✓ Branch 0 taken 96 times.
✓ Branch 1 taken 327 times.
|
423 | if(opening) |
| 27743 | { | ||
| 27744 | 327 | close_black_opening(x+8, y+8+playing_field_offset, false); | |
| 27745 | 327 | } | |
| 27746 | |||
| 27747 | 423 | hclk=0; | |
| 27748 | 423 | stop_item_sfx(itype_brang); | |
| 27749 | 423 | sfx(WAV_STAIRS,pan(x)); | |
| 27750 | 423 | dir=up; | |
| 27751 | 423 | clk=0; | |
| 27752 | 423 | action=climbcovertop; FFCore.setHeroAction(climbcovertop); | |
| 27753 | 423 | attack=wNone; | |
| 27754 | 423 | attackid=-1; | |
| 27755 | 423 | reset_swordcharge(); | |
| 27756 | 423 | TRUNCATE_TILE(x.getInt()); | |
| 27757 | 423 | climb_cover_x=TRUNCATE_TILE(x.getInt()); | |
| 27758 | 423 | climb_cover_y=TRUNCATE_TILE(y.getInt()) - 16; | |
| 27759 | |||
| 27760 | 423 | guys.clear(); | |
| 27761 | 423 | chainlinks.clear(); | |
| 27762 | 423 | Lwpns.clear(); | |
| 27763 | 423 | Ewpns.clear(); | |
| 27764 | 423 | items.clear(); | |
| 27765 | |||
| 27766 |
2/2✓ Branch 0 taken 423 times.
✓ Branch 1 taken 27072 times.
|
27495 | for(int32_t i=0; i<64; i++) |
| 27767 | { | ||
| 27768 | 27072 | herostep(); | |
| 27769 | |||
| 27770 |
2/4✓ Branch 0 taken 27072 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 27072 times.
|
27072 | if(zinit.heroAnimationStyle==las_zelda3 || zinit.heroAnimationStyle==las_zelda3slow) |
| 27771 | ✗ | hero_count=(hero_count+1)%16; | |
| 27772 | |||
| 27773 |
2/2✓ Branch 0 taken 20304 times.
✓ Branch 1 taken 6768 times.
|
27072 | if((i&3)==0) |
| 27774 | { | ||
| 27775 | 6768 | --y; | |
| 27776 | 6768 | update_viewport(); | |
| 27777 | 6768 | } | |
| 27778 | |||
| 27779 | 27072 | draw_screen(); | |
| 27780 | 27072 | advanceframe(true); | |
| 27781 | |||
| 27782 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 27072 times.
|
27072 | if(Quit) |
| 27783 | ✗ | break; | |
| 27784 | 27072 | } | |
| 27785 | 423 | map_bkgsfx(true); | |
| 27786 | 423 | loadside=dir^1; | |
| 27787 | 423 | action=none; FFCore.setHeroAction(none); | |
| 27788 | 423 | } | |
| 27789 | |||
| 27790 | 455 | void HeroClass::stepout() // Step out of item cellars and passageways | |
| 27791 | { | ||
| 27792 | 455 | bool updatemusic = FFCore.can_dmap_change_music(cur_dmap); | |
| 27793 | 455 | bool musicnocut = FFCore.music_update_flags & MUSIC_UPDATE_FLAG_NOCUT; | |
| 27794 | |||
| 27795 | 455 | int32_t sc = specialcave; // This gets erased by ALLOFF() | |
| 27796 | 455 | ALLOFF(); | |
| 27797 | 455 | stop_sfx(QMisc.miscsfx[sfxLOWHEART]); | |
| 27798 | 455 | kill_sfx(); | |
| 27799 | 455 | draw_screen(false); | |
| 27800 | 455 | fade(sc>=GUYCAVE?10:11,true,false); | |
| 27801 | 455 | blackscr(30,true); | |
| 27802 | 455 | ringcolor(false); | |
| 27803 | |||
| 27804 |
4/4✓ Branch 0 taken 135 times.
✓ Branch 1 taken 320 times.
✓ Branch 2 taken 184 times.
✓ Branch 3 taken 271 times.
|
455 | if(sc==PASSAGEWAY && abs(x-warpx)>16) // How did Hero leave the passageway? |
| 27805 | { | ||
| 27806 | 271 | cur_dmap=stepoutdmap; | |
| 27807 | 271 | cur_map=DMaps[cur_dmap].map; | |
| 27808 | 271 | dlevel=DMaps[cur_dmap].level; | |
| 27809 | |||
| 27810 | //we might have just left a passage, so be sure to update the CSet record -DD | ||
| 27811 | 271 | currcset=DMaps[cur_dmap].color; | |
| 27812 | |||
| 27813 | 271 | init_dmap(); | |
| 27814 | 271 | home_screen=stepoutscreen; | |
| 27815 | 271 | } | |
| 27816 | |||
| 27817 | 455 | loadscr(cur_dmap, home_screen, 255, false); // bogus direction | |
| 27818 | 455 | draw_screen(false); | |
| 27819 | |||
| 27820 |
4/4✓ Branch 0 taken 454 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 444 times.
✓ Branch 3 taken 10 times.
|
455 | if(get_qr(qr_NEW_DARKROOM) || !is_dark(hero_scr)) |
| 27821 | { | ||
| 27822 | 445 | darkroom = naturaldark = false; | |
| 27823 | 445 | fade(DMaps[cur_dmap].color,true,true); | |
| 27824 | 445 | } | |
| 27825 | else | ||
| 27826 | { | ||
| 27827 | 10 | darkroom = naturaldark = true; | |
| 27828 | |||
| 27829 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 2 times.
|
10 | if(get_qr(qr_FADE)) |
| 27830 | { | ||
| 27831 | 8 | interpolatedfade(); | |
| 27832 | 8 | } | |
| 27833 | else | ||
| 27834 | { | ||
| 27835 | 2 | loadfadepal((DMaps[cur_dmap].color)*pdLEVEL+poFADE3); | |
| 27836 | } | ||
| 27837 | 10 | byte *si = colordata + CSET(DMaps[cur_dmap].color*pdLEVEL+poLEVEL)*3; | |
| 27838 | 10 | si+=3*48; | |
| 27839 | |||
| 27840 |
2/2✓ Branch 0 taken 160 times.
✓ Branch 1 taken 10 times.
|
170 | for(int32_t i=0; i<16; i++) |
| 27841 | { | ||
| 27842 | 160 | RAMpal[CSET(9)+i] = _RGB(si); | |
| 27843 | 160 | tempgreypal[CSET(9)+i] = _RGB(si); //preserve monochrome | |
| 27844 | 160 | si+=3; | |
| 27845 | 160 | } | |
| 27846 | } | ||
| 27847 | |||
| 27848 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 455 times.
|
455 | if(didpit) |
| 27849 | { | ||
| 27850 | ✗ | didpit=false; | |
| 27851 | ✗ | x=pitx; | |
| 27852 | ✗ | y=pity; | |
| 27853 | ✗ | } | |
| 27854 | else | ||
| 27855 | { | ||
| 27856 | 455 | x = hero_scr->warpreturnx[stepoutwr]; | |
| 27857 | 455 | y = hero_scr->warpreturny[stepoutwr]; | |
| 27858 | } | ||
| 27859 | |||
| 27860 | 455 | x += region_scr_dx * 256; | |
| 27861 | 455 | y += region_scr_dy * 176; | |
| 27862 | 455 | update_viewport(); | |
| 27863 | |||
| 27864 |
2/2✓ Branch 0 taken 435 times.
✓ Branch 1 taken 20 times.
|
455 | if(x+y == 0) |
| 27865 | 20 | x = y = 80; | |
| 27866 | |||
| 27867 | 455 | dir=down; | |
| 27868 | |||
| 27869 | 455 | set_respawn_point(); | |
| 27870 | |||
| 27871 | // Let's use the 'exit cave' animation if we entered this cellar via a cave combo. | ||
| 27872 | 455 | int32_t type = combobuf[MAPCOMBO(x,y)].type; | |
| 27873 | |||
| 27874 |
4/6✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 449 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 6 times.
|
455 | if((type==cCAVE)||(type>=cCAVEB && type<=cCAVED)) |
| 27875 | { | ||
| 27876 | ✗ | walkup(false); | |
| 27877 | ✗ | } | |
| 27878 |
4/6✓ Branch 0 taken 455 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 449 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 6 times.
|
455 | else if((type==cCAVE2)||(type>=cCAVE2B && type<=cCAVE2D)) |
| 27879 | { | ||
| 27880 | ✗ | walkdown2(false); | |
| 27881 | ✗ | } | |
| 27882 | |||
| 27883 | 455 | newscr_clk=frame; | |
| 27884 | 455 | activated_timed_warp=false; | |
| 27885 | 455 | didstuff=0; | |
| 27886 | 455 | usecounts.clear(); | |
| 27887 | 455 | eat_buttons(); | |
| 27888 | 455 | markBmap(); | |
| 27889 | 455 | map_bkgsfx(true); | |
| 27890 | |||
| 27891 |
2/2✓ Branch 0 taken 401 times.
✓ Branch 1 taken 54 times.
|
455 | if(!get_qr(qr_CAVEEXITNOSTOPMUSIC)) |
| 27892 | { | ||
| 27893 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 54 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
54 | if (updatemusic || !musicnocut) |
| 27894 | { | ||
| 27895 | 54 | music_stop(); | |
| 27896 | 54 | playLevelMusic(); | |
| 27897 | 54 | } | |
| 27898 | 54 | } | |
| 27899 |
1/2✓ Branch 0 taken 401 times.
✗ Branch 1 not taken.
|
401 | else if(get_qr(qr_SCREEN80_OWN_MUSIC)) |
| 27900 | { | ||
| 27901 | ✗ | if (updatemusic || !musicnocut) | |
| 27902 | ✗ | playLevelMusic(); | |
| 27903 | ✗ | } | |
| 27904 | |||
| 27905 | 455 | loadside=dir^1; | |
| 27906 | 455 | } | |
| 27907 | |||
| 27908 | 32951 | bool HeroClass::nextcombo_wf(int32_t d2) | |
| 27909 | { | ||
| 27910 |
6/8✓ Branch 0 taken 32889 times.
✓ Branch 1 taken 62 times.
✓ Branch 2 taken 32450 times.
✓ Branch 3 taken 439 times.
✓ Branch 4 taken 32450 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 439 times.
✗ Branch 7 not taken.
|
32951 | if(walk_through_walls || (action!=swimming && !IsSideSwim() && action != swimhit) || hopclk==0) //!DIMITODO: ...does swimming just let you ignore smart scrolling entirely!? |
| 27911 | 32951 | return false; | |
| 27912 | |||
| 27913 | // assumes Hero is about to scroll screens | ||
| 27914 | ✗ | auto [map, screen] = nextscr2(d2); | |
| 27915 | ✗ | if (map == -1) | |
| 27916 | ✗ | return false; | |
| 27917 | |||
| 27918 | ✗ | const mapscr* scr = get_canonical_scr(map, screen); | |
| 27919 | |||
| 27920 | ✗ | int32_t cx = x; | |
| 27921 | ✗ | int32_t cy = y; | |
| 27922 | |||
| 27923 | ✗ | switch(d2) | |
| 27924 | { | ||
| 27925 | case up: | ||
| 27926 | ✗ | cy=160; | |
| 27927 | ✗ | break; | |
| 27928 | |||
| 27929 | case down: | ||
| 27930 | ✗ | cy=0; | |
| 27931 | ✗ | break; | |
| 27932 | |||
| 27933 | case left: | ||
| 27934 | ✗ | cx=240; | |
| 27935 | ✗ | break; | |
| 27936 | |||
| 27937 | case right: | ||
| 27938 | ✗ | cx=0; | |
| 27939 | ✗ | break; | |
| 27940 | } | ||
| 27941 | |||
| 27942 | // check lower half of combo | ||
| 27943 | ✗ | cy += 8; | |
| 27944 | |||
| 27945 | ✗ | int32_t cmb = COMBOPOS(cx%256, cy%176); | |
| 27946 | ✗ | const newcombo* c = &combobuf[scr->data[cmb]]; | |
| 27947 | ✗ | bool dried = iswater_type(c->type) && DRIEDLAKE; | |
| 27948 | ✗ | bool swim = iswater_type(c->type) && (current_item(itype_flippers)) && !dried; | |
| 27949 | ✗ | int32_t b=1; | |
| 27950 | |||
| 27951 | ✗ | if(cx&8) b<<=2; | |
| 27952 | |||
| 27953 | ✗ | if(cy&8) b<<=1; | |
| 27954 | |||
| 27955 | ✗ | if((c->walk&b) && !dried && !swim) | |
| 27956 | ✗ | return true; | |
| 27957 | |||
| 27958 | // next block (i.e. cnt==2) | ||
| 27959 | ✗ | if(!(cx&8)) | |
| 27960 | { | ||
| 27961 | ✗ | b<<=2; | |
| 27962 | ✗ | } | |
| 27963 | else | ||
| 27964 | { | ||
| 27965 | ✗ | c = &combobuf[scr->data[++cmb]]; | |
| 27966 | ✗ | dried = iswater_type(c->type) && DRIEDLAKE; | |
| 27967 | ✗ | swim = iswater_type(c->type) && (current_item(itype_flippers)) && !dried; | |
| 27968 | ✗ | b=1; | |
| 27969 | |||
| 27970 | ✗ | if(cy&8) | |
| 27971 | { | ||
| 27972 | ✗ | b<<=1; | |
| 27973 | ✗ | } | |
| 27974 | } | ||
| 27975 | |||
| 27976 | ✗ | return (c->walk&b) ? !dried && !swim : false; | |
| 27977 | 32951 | } | |
| 27978 | |||
| 27979 | 446 | bool HeroClass::nextcombo_solid(int32_t d2) | |
| 27980 | { | ||
| 27981 |
2/4✓ Branch 0 taken 446 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 446 times.
|
446 | if(walk_through_walls || cur_screen>=128) |
| 27982 | ✗ | return false; | |
| 27983 | |||
| 27984 | // assumes Hero is about to scroll screens | ||
| 27985 | 12406 | auto [map, screen] = nextscr2(d2); | |
| 27986 |
1/2✓ Branch 0 taken 446 times.
✗ Branch 1 not taken.
|
446 | if (map == -1) |
| 27987 | ✗ | return false; | |
| 27988 | |||
| 27989 | 446 | int32_t cx = x; | |
| 27990 | 446 | int32_t cy = y; | |
| 27991 | 446 | cx %= 256; | |
| 27992 | 446 | cy %= 176; | |
| 27993 | |||
| 27994 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 20 times.
✓ Branch 2 taken 70 times.
✓ Branch 3 taken 104 times.
✓ Branch 4 taken 252 times.
|
446 | switch(d2) |
| 27995 | { | ||
| 27996 | case up: | ||
| 27997 | 20 | cy=160; | |
| 27998 | 20 | break; | |
| 27999 | |||
| 28000 | case down: | ||
| 28001 | 70 | cy=0; | |
| 28002 | 70 | break; | |
| 28003 | |||
| 28004 | case left: | ||
| 28005 | 104 | cx=240; | |
| 28006 | 104 | break; | |
| 28007 | |||
| 28008 | case right: | ||
| 28009 | 252 | cx=0; | |
| 28010 | 252 | break; | |
| 28011 | } | ||
| 28012 | |||
| 28013 |
2/2✓ Branch 0 taken 20 times.
✓ Branch 1 taken 426 times.
|
446 | if(d2==up) cy += 8; |
| 28014 | |||
| 28015 |
4/4✓ Branch 0 taken 342 times.
✓ Branch 1 taken 104 times.
✓ Branch 2 taken 252 times.
✓ Branch 3 taken 90 times.
|
446 | if(d2==left||d2==right) cy+=bigHitbox?0:8; |
| 28016 | |||
| 28017 | 446 | int32_t initcx = cx; | |
| 28018 | 446 | int32_t initcy = cy; | |
| 28019 | 446 | bool smarter_scroll = get_qr(qr_SMARTER_SMART_SCROLL); | |
| 28020 | // from MAPCOMBO() | ||
| 28021 | |||
| 28022 |
10/10✓ Branch 0 taken 406 times.
✓ Branch 1 taken 528 times.
✓ Branch 2 taken 382 times.
✓ Branch 3 taken 24 times.
✓ Branch 4 taken 32 times.
✓ Branch 5 taken 350 times.
✓ Branch 6 taken 232 times.
✓ Branch 7 taken 702 times.
✓ Branch 8 taken 674 times.
✓ Branch 9 taken 260 times.
|
934 | for(int32_t i=0; i<=((bigHitbox&&!(d2==up||d2==down))?((initcy&7)?2:1):((initcy&7)?1:0)) && cy < 176; cy+=(cy%2)?7:8,i++) |
| 28023 | { | ||
| 28024 | 674 | cx = initcx; | |
| 28025 |
5/6✓ Branch 0 taken 1684 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 488 times.
✓ Branch 3 taken 1196 times.
✓ Branch 4 taken 1196 times.
✓ Branch 5 taken 488 times.
|
1684 | for(int32_t k=0; k<=(smarter_scroll?((initcx&7)?2:1):0) && cx < 256; cx+=(cx%2)?7:8,k++) |
| 28026 | { | ||
| 28027 | 2392 | newcombo const& c = combobuf[MAPCOMBO3(map, screen, -1,cx,cy, smarter_scroll)]; | |
| 28028 | |||
| 28029 | 1196 | int32_t b=1; | |
| 28030 | |||
| 28031 |
2/2✓ Branch 0 taken 644 times.
✓ Branch 1 taken 552 times.
|
1196 | if(cx&8) b<<=2; |
| 28032 | |||
| 28033 |
2/2✓ Branch 0 taken 616 times.
✓ Branch 1 taken 580 times.
|
1196 | if(cy&8) b<<=1; |
| 28034 | |||
| 28035 | //bool bridgedetected = false; | ||
| 28036 | |||
| 28037 | 1196 | int32_t walk = c.walk; | |
| 28038 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1196 times.
|
1196 | if (smarter_scroll) |
| 28039 | { | ||
| 28040 |
2/2✓ Branch 0 taken 2392 times.
✓ Branch 1 taken 1196 times.
|
3588 | for (int32_t m = 0; m <= 1; m++) |
| 28041 | { | ||
| 28042 | 4784 | newcombo const& cmb = combobuf[MAPCOMBO3(map, screen, m,cx,cy, true)]; | |
| 28043 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2392 times.
|
2392 | if (cmb.type == cBRIDGE) |
| 28044 | { | ||
| 28045 | ✗ | if (!get_qr(qr_OLD_BRIDGE_COMBOS)) | |
| 28046 | { | ||
| 28047 | ✗ | int efflag = (cmb.walk & 0xF0)>>4; | |
| 28048 | ✗ | int newsolid = (cmb.walk & 0xF); | |
| 28049 | ✗ | walk = ((newsolid | walk) & (~efflag)) | (newsolid & efflag); | |
| 28050 | ✗ | } | |
| 28051 | ✗ | else walk &= cmb.walk; | |
| 28052 | ✗ | } | |
| 28053 | 2392 | else walk |= cmb.walk; | |
| 28054 | 2392 | } | |
| 28055 | 1196 | } | |
| 28056 | |||
| 28057 |
4/10✓ Branch 0 taken 1196 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1196 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1196 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 1196 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
4784 | bool swim = iswaterex(MAPCOMBO3(map, screen, -1,cx,cy, smarter_scroll), map, screen, -1, cx, cy, true, false, true) && (current_item(itype_flippers) || action==rafting); |
| 28058 | |||
| 28059 |
3/4✓ Branch 0 taken 186 times.
✓ Branch 1 taken 1010 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 186 times.
|
1196 | if((walk&b) && !swim) |
| 28060 | { | ||
| 28061 | 186 | return true; | |
| 28062 | } | ||
| 28063 | 1010 | } | |
| 28064 | 488 | } | |
| 28065 | |||
| 28066 | 260 | return false; | |
| 28067 | 446 | } | |
| 28068 | |||
| 28069 | 31828 | void HeroClass::do_scroll_direction(direction dir) | |
| 28070 | { | ||
| 28071 | 31828 | bool should_scroll = true; | |
| 28072 | |||
| 28073 |
5/6✓ Branch 0 taken 31673 times.
✓ Branch 1 taken 155 times.
✓ Branch 2 taken 31673 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 31683 times.
✓ Branch 5 taken 145 times.
|
31828 | if((z > 0 || fakez > 0 || stomping) && get_qr(qr_NO_SCROLL_WHILE_IN_AIR)) |
| 28074 | 145 | should_scroll = false; | |
| 28075 | |||
| 28076 |
3/4✓ Branch 0 taken 81 times.
✓ Branch 1 taken 31747 times.
✓ Branch 2 taken 81 times.
✗ Branch 3 not taken.
|
31828 | if(lift_wpn && get_qr(qr_NO_SCROLL_WHILE_CARRYING)) |
| 28077 | ✗ | should_scroll = false; | |
| 28078 | |||
| 28079 |
1/2✓ Branch 0 taken 31828 times.
✗ Branch 1 not taken.
|
31828 | if(nextcombo_wf(dir)) |
| 28080 | ✗ | should_scroll = false; | |
| 28081 | |||
| 28082 | 31828 | int dir_flag = 0; | |
| 28083 |
2/2✓ Branch 0 taken 22641 times.
✓ Branch 1 taken 9187 times.
|
31828 | if (dir == up) dir_flag = wfUP; |
| 28084 |
2/2✓ Branch 0 taken 7508 times.
✓ Branch 1 taken 15133 times.
|
22641 | else if (dir == down) dir_flag = wfDOWN; |
| 28085 |
2/2✓ Branch 0 taken 7068 times.
✓ Branch 1 taken 8065 times.
|
15133 | else if (dir == left) dir_flag = wfLEFT; |
| 28086 |
1/2✓ Branch 0 taken 8065 times.
✗ Branch 1 not taken.
|
8065 | else if (dir == right) dir_flag = wfRIGHT; |
| 28087 | ✗ | else assert(false); | |
| 28088 | |||
| 28089 | 31828 | mapscr* scr = hero_scr; | |
| 28090 | |||
| 28091 |
9/10✓ Branch 0 taken 490 times.
✓ Branch 1 taken 31338 times.
✓ Branch 2 taken 488 times.
✓ Branch 3 taken 2 times.
✓ Branch 4 taken 474 times.
✓ Branch 5 taken 14 times.
✓ Branch 6 taken 474 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 446 times.
✓ Branch 9 taken 28 times.
|
31828 | if(get_qr(qr_SMARTSCREENSCROLL)&&(!(scr->flags&fMAZE))&&action!=inwind &&action!=scrolling && !(scr->flags2&dir_flag)) |
| 28092 | { | ||
| 28093 |
2/2✓ Branch 0 taken 260 times.
✓ Branch 1 taken 186 times.
|
446 | if(nextcombo_solid(dir)) |
| 28094 | 186 | should_scroll = false; | |
| 28095 | 446 | } | |
| 28096 | |||
| 28097 |
4/4✓ Branch 0 taken 285 times.
✓ Branch 1 taken 31543 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 284 times.
|
31828 | if (should_scroll || action == inwind) |
| 28098 | { | ||
| 28099 | 31544 | finish_auto_walk(); | |
| 28100 |
2/2✓ Branch 0 taken 801 times.
✓ Branch 1 taken 30741 times.
|
31544 | if(cur_screen>=128) |
| 28101 | { | ||
| 28102 |
2/2✓ Branch 0 taken 346 times.
✓ Branch 1 taken 455 times.
|
801 | if(specialcave >= GUYCAVE) |
| 28103 | 346 | exitcave(); | |
| 28104 | 455 | else stepout(); | |
| 28105 | 801 | } | |
| 28106 |
2/2✓ Branch 0 taken 126 times.
✓ Branch 1 taken 30615 times.
|
30741 | else if(action==inwind) |
| 28107 | { | ||
| 28108 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 125 times.
|
126 | if(DMaps[cur_dmap].flags&dmfWHIRLWINDRET) |
| 28109 | { | ||
| 28110 | 1 | action=none; FFCore.setHeroAction(none); | |
| 28111 | 1 | restart_level(); | |
| 28112 | 1 | } | |
| 28113 | else | ||
| 28114 | { | ||
| 28115 | 125 | dowarp(scr, 2, dir); | |
| 28116 | } | ||
| 28117 | 126 | } | |
| 28118 |
3/6✓ Branch 0 taken 2041 times.
✓ Branch 1 taken 28574 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2041 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
30615 | else if(scr->flags2&dir_flag && (!(scr->flags8&fMAZEvSIDEWARP) || checkmaze(scr,false))) |
| 28119 | { | ||
| 28120 | 2041 | sdir=dir; | |
| 28121 | 2041 | dowarp(scr, 1, (scr->sidewarpindex >> (sdir*2))&3); | |
| 28122 | 2041 | } | |
| 28123 |
4/4✓ Branch 0 taken 28218 times.
✓ Branch 1 taken 356 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 28217 times.
|
28574 | else if(!edge_of_dmap(dir) && edge_of_region(dir)) |
| 28124 | { | ||
| 28125 | 28217 | scrolling_dmap = cur_dmap; | |
| 28126 | 28217 | scrolling_map = cur_map; | |
| 28127 | 28217 | scrollscr(dir); | |
| 28128 | |||
| 28129 |
1/2✓ Branch 0 taken 28217 times.
✗ Branch 1 not taken.
|
28217 | if(hero_scr->flags4&fAUTOSAVE) |
| 28130 | { | ||
| 28131 | ✗ | save_game(true,0); | |
| 28132 | ✗ | } | |
| 28133 | |||
| 28134 |
2/2✓ Branch 0 taken 27687 times.
✓ Branch 1 taken 530 times.
|
28217 | if(hero_scr->flags6&fCONTINUEHERE) |
| 28135 | { | ||
| 28136 | 530 | lastentrance_dmap = cur_dmap; | |
| 28137 | 530 | lastentrance = home_screen; | |
| 28138 | 530 | } | |
| 28139 | 28217 | } | |
| 28140 | 31542 | } | |
| 28141 | 31826 | } | |
| 28142 | |||
| 28143 | 146027 | static bool has_advanced_maze(mapscr* scr) | |
| 28144 | { | ||
| 28145 | 146027 | bool loopy = scr->flags10&fMAZE_LOOPY; | |
| 28146 | 146027 | bool can_get_lost = scr->flags10&fMAZE_CAN_GET_LOST; | |
| 28147 | 146027 | int maze_transition_wipe = scr->maze_transition_wipe; | |
| 28148 |
5/6✓ Branch 0 taken 146021 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 146003 times.
✓ Branch 3 taken 18 times.
✓ Branch 4 taken 146003 times.
✗ Branch 5 not taken.
|
146027 | return loopy || can_get_lost || maze_transition_wipe || is_in_scrolling_region(); |
| 28149 | } | ||
| 28150 | |||
| 28151 | 14852256 | void HeroClass::maybe_begin_advanced_maze() | |
| 28152 | { | ||
| 28153 |
6/6✓ Branch 0 taken 60486 times.
✓ Branch 1 taken 14791770 times.
✓ Branch 2 taken 60108 times.
✓ Branch 3 taken 378 times.
✓ Branch 4 taken 22 times.
✓ Branch 5 taken 60086 times.
|
14852256 | if (!(hero_scr->flags&fMAZE) || current_screen == scrolling_maze_last_solved_screen || maze_state.active) |
| 28154 | 14792170 | return; | |
| 28155 | |||
| 28156 | // Basic mazes are handled in scrollscr. | ||
| 28157 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 60070 times.
|
60086 | if (!has_advanced_maze(hero_scr)) |
| 28158 | 60070 | return; | |
| 28159 | |||
| 28160 | 16 | maze_state = {}; | |
| 28161 | maze_state.active = true; | ||
| 28162 | maze_state.loopy = hero_scr->flags10&fMAZE_LOOPY; | ||
| 28163 | maze_state.transition_wipe = hero_scr->maze_transition_wipe; | ||
| 28164 | maze_state.can_get_lost = hero_scr->flags10&fMAZE_CAN_GET_LOST; | ||
| 28165 | maze_state.scr = hero_scr; | ||
| 28166 | maze_state.exit_screen = screen_index_direction(current_screen, (direction)hero_scr->exitdir); | ||
| 28167 | maze_state.last_check_herox = x; | ||
| 28168 | maze_state.last_check_heroy = y; | ||
| 28169 | |||
| 28170 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 10 times.
|
16 | if (maze_state.loopy) |
| 28171 | { | ||
| 28172 | 6 | int dx = get_region_relative_dx(prev_hero_scr->screen) - get_region_relative_dx(current_screen); | |
| 28173 | 6 | int dy = get_region_relative_dy(prev_hero_scr->screen) - get_region_relative_dy(current_screen); | |
| 28174 | 6 | maze_state.enter_dir = XY_DELTA_TO_DIR(sign2(dx), sign2(dy)); | |
| 28175 | 6 | } | |
| 28176 | } | ||
| 28177 | |||
| 28178 | // Checks if hero is beyond the bounds of the screen, and if so begins scrolling. | ||
| 28179 | // Returns after scrolling is finished. | ||
| 28180 | 14835456 | void HeroClass::checkscroll() | |
| 28181 | { | ||
| 28182 | //DO NOT scroll if Hero is vibrating due to Farore's Wind effect -DD | ||
| 28183 |
3/4✓ Branch 0 taken 14831558 times.
✓ Branch 1 taken 3898 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 14831558 times.
|
14835456 | if(action == casting||action==sideswimcasting) |
| 28184 | 3898 | return; | |
| 28185 | |||
| 28186 |
1/2✓ Branch 0 taken 14831558 times.
✗ Branch 1 not taken.
|
14831558 | if(!check_prescroll()) // prevent scrolling when you should drown/fall/etc before the screen edge |
| 28187 | ✗ | return; | |
| 28188 | |||
| 28189 |
4/4✓ Branch 0 taken 18355 times.
✓ Branch 1 taken 14813203 times.
✓ Branch 2 taken 9285 times.
✓ Branch 3 taken 9070 times.
|
14831558 | if (action == inwind && whirlwind == 0) |
| 28190 | { | ||
| 28191 |
2/2✓ Branch 0 taken 114 times.
✓ Branch 1 taken 8956 times.
|
9070 | if (x > viewport.right()-16) |
| 28192 | { | ||
| 28193 | 114 | x = viewport.right()-16; | |
| 28194 | 114 | do_scroll_direction(right); | |
| 28195 | 114 | } | |
| 28196 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 8954 times.
|
8956 | else if (x < viewport.left()) |
| 28197 | { | ||
| 28198 | 2 | x = viewport.left(); | |
| 28199 | 2 | do_scroll_direction(left); | |
| 28200 | 2 | } | |
| 28201 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 8950 times.
|
8954 | else if (y > viewport.bottom()-16) |
| 28202 | { | ||
| 28203 | 4 | y = viewport.bottom()-16; | |
| 28204 | 4 | do_scroll_direction(down); | |
| 28205 | 4 | } | |
| 28206 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 8944 times.
|
8950 | else if (y < viewport.top()) |
| 28207 | { | ||
| 28208 | 6 | y = viewport.top(); | |
| 28209 | 6 | do_scroll_direction(up); | |
| 28210 | 6 | } | |
| 28211 | |||
| 28212 | 9070 | return; | |
| 28213 | } | ||
| 28214 | |||
| 28215 |
2/2✓ Branch 0 taken 7762 times.
✓ Branch 1 taken 14814726 times.
|
14822488 | if (!maze_state.active) |
| 28216 | 14814726 | maybe_begin_advanced_maze(); | |
| 28217 | |||
| 28218 |
2/2✓ Branch 0 taken 14814718 times.
✓ Branch 1 taken 7770 times.
|
14822488 | if (maze_state.active) |
| 28219 | { | ||
| 28220 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7770 times.
|
7770 | if (action == inwind) |
| 28221 | { | ||
| 28222 | ✗ | maze_state.active = false; | |
| 28223 | ✗ | return; | |
| 28224 | } | ||
| 28225 | |||
| 28226 |
2/2✓ Branch 0 taken 3602 times.
✓ Branch 1 taken 4168 times.
|
7770 | if (!maze_state.lost) |
| 28227 | { | ||
| 28228 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 4162 times.
|
4168 | if (determine_hero_screen_from_coords()->screen == maze_state.exit_screen) |
| 28229 | { | ||
| 28230 | 6 | maze_state.active = false; | |
| 28231 | 6 | update_current_screen(); | |
| 28232 | 6 | return; | |
| 28233 | } | ||
| 28234 | |||
| 28235 |
3/4✓ Branch 0 taken 554 times.
✓ Branch 1 taken 3608 times.
✓ Branch 2 taken 554 times.
✗ Branch 3 not taken.
|
4162 | if (maze_state.enter_dir != dir_invalid && determine_hero_screen_from_coords() == prev_hero_scr) |
| 28236 | { | ||
| 28237 | ✗ | maze_state.active = false; | |
| 28238 | ✗ | update_current_screen(); | |
| 28239 | ✗ | return; | |
| 28240 | } | ||
| 28241 | 4162 | } | |
| 28242 | |||
| 28243 | 7764 | int maze_screen = maze_state.scr->screen; | |
| 28244 | 38820 | auto [sx, sy] = translate_screen_coordinates_to_world(maze_screen); | |
| 28245 | |||
| 28246 | 7764 | int x0 = x.getInt(); | |
| 28247 | 7764 | int y0 = y.getInt(); | |
| 28248 | 7764 | direction advance_dir = dir_invalid; | |
| 28249 |
5/6✓ Branch 0 taken 7642 times.
✓ Branch 1 taken 122 times.
✓ Branch 2 taken 7642 times.
✓ Branch 3 taken 122 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 7642 times.
|
15528 | if (x0 > (sx+256)-16 || x0 > world_w - 16) advance_dir = right; |
| 28250 |
5/6✓ Branch 0 taken 7732 times.
✓ Branch 1 taken 32 times.
✓ Branch 2 taken 7732 times.
✓ Branch 3 taken 32 times.
✓ Branch 4 taken 7732 times.
✗ Branch 5 not taken.
|
15528 | if (x0 < sx || x0 < 0) advance_dir = left; |
| 28251 |
5/6✓ Branch 0 taken 7718 times.
✓ Branch 1 taken 46 times.
✓ Branch 2 taken 7718 times.
✓ Branch 3 taken 46 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 7718 times.
|
15528 | if (y0 > (sy+176)-16 || y0 > world_h - 16) advance_dir = down; |
| 28252 |
5/6✓ Branch 0 taken 7720 times.
✓ Branch 1 taken 44 times.
✓ Branch 2 taken 7720 times.
✓ Branch 3 taken 44 times.
✓ Branch 4 taken 7720 times.
✗ Branch 5 not taken.
|
15528 | if (y0 < sy || y0 < 0) advance_dir = up; |
| 28253 | |||
| 28254 |
2/2✓ Branch 0 taken 244 times.
✓ Branch 1 taken 7520 times.
|
7764 | if (advance_dir == dir_invalid) |
| 28255 | { | ||
| 28256 | 7520 | maze_state.last_check_herox = -10000; | |
| 28257 | 7520 | maze_state.last_check_heroy = -10000; | |
| 28258 | 7520 | } | |
| 28259 | else | ||
| 28260 | { | ||
| 28261 |
2/2✓ Branch 0 taken 46 times.
✓ Branch 1 taken 198 times.
|
244 | bool can_check_again = std::abs(maze_state.last_check_herox - x0) >= 16 || std::abs(maze_state.last_check_heroy - y0) >= 16; |
| 28262 | |||
| 28263 |
3/4✓ Branch 0 taken 46 times.
✓ Branch 1 taken 198 times.
✓ Branch 2 taken 46 times.
✗ Branch 3 not taken.
|
244 | if (can_check_again && maze_enabled_sizewarp(maze_state.scr, advance_dir)) |
| 28264 | { | ||
| 28265 | ✗ | maze_state.active = false; | |
| 28266 | ✗ | return; | |
| 28267 | } | ||
| 28268 | |||
| 28269 |
4/4✓ Branch 0 taken 98 times.
✓ Branch 1 taken 146 times.
✓ Branch 2 taken 134 times.
✓ Branch 3 taken 12 times.
|
390 | bool found_exit = !maze_state.lost && (lastdir[3] == maze_state.scr->exitdir || lastdir[3] == maze_state.enter_dir); |
| 28270 |
2/2✓ Branch 0 taken 134 times.
✓ Branch 1 taken 110 times.
|
244 | if (found_exit) |
| 28271 | { | ||
| 28272 | // Do nothing. | ||
| 28273 | 134 | } | |
| 28274 |
4/4✓ Branch 0 taken 38 times.
✓ Branch 1 taken 72 times.
✓ Branch 2 taken 32 times.
✓ Branch 3 taken 6 times.
|
110 | else if (can_check_again && checkmaze_ignore_exit(maze_state.scr, true)) |
| 28275 | { | ||
| 28276 | 6 | maze_state.last_check_herox = x; | |
| 28277 | 6 | maze_state.last_check_heroy = y; | |
| 28278 | 6 | maze_state.enter_dir = dir_invalid; | |
| 28279 | |||
| 28280 | 6 | int dest_screen = screen_index_direction(maze_screen, advance_dir); | |
| 28281 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 2 times.
|
6 | if (is_in_current_region(dest_screen)) |
| 28282 | 4 | scrolling_maze_last_solved_screen = maze_screen; | |
| 28283 | else | ||
| 28284 | 2 | scrollscr(advance_dir, dest_screen); | |
| 28285 | |||
| 28286 | 6 | maze_state.active = false; | |
| 28287 | 6 | } | |
| 28288 |
4/4✓ Branch 0 taken 32 times.
✓ Branch 1 taken 72 times.
✓ Branch 2 taken 22 times.
✓ Branch 3 taken 10 times.
|
104 | else if (can_check_again && maze_state.loopy) |
| 28289 | { | ||
| 28290 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
|
10 | if (maze_state.transition_wipe) |
| 28291 | 10 | closescreen(maze_state.transition_wipe - 1); | |
| 28292 | |||
| 28293 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 2 times.
|
10 | if (advance_dir == left) x += 256; |
| 28294 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 2 times.
|
10 | if (advance_dir == right) x -= 256; |
| 28295 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 2 times.
|
10 | if (advance_dir == up) y += 176; |
| 28296 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 4 times.
|
10 | if (advance_dir == down) y -= 176; |
| 28297 |
4/4✓ Branch 0 taken 8 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 6 times.
|
10 | if (advance_dir == left || advance_dir == right) |
| 28298 | 4 | x.doClamp(0, world_w - 16); | |
| 28299 |
4/4✓ Branch 0 taken 8 times.
✓ Branch 1 taken 2 times.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 4 times.
|
10 | if (advance_dir == up || advance_dir == down) |
| 28300 | 6 | y.doClamp(0, world_h - 16); | |
| 28301 | |||
| 28302 | 10 | maze_state.last_check_herox = x; | |
| 28303 | 10 | maze_state.last_check_heroy = y; | |
| 28304 | 10 | maze_state.enter_dir = dir_invalid; | |
| 28305 | |||
| 28306 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
|
10 | if (maze_state.can_get_lost) |
| 28307 | { | ||
| 28308 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 8 times.
|
10 | if (advance_dir == maze_state.scr->exitdir) |
| 28309 | 2 | maze_state.lost = false; | |
| 28310 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 8 times.
|
8 | else if (advance_dir != maze_state.enter_dir) |
| 28311 | 8 | maze_state.lost = true; | |
| 28312 | 10 | } | |
| 28313 | |||
| 28314 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10 times.
|
10 | if (maze_state.transition_wipe) |
| 28315 | 10 | openscreen(maze_state.transition_wipe - 1); | |
| 28316 | 10 | } | |
| 28317 |
2/2✓ Branch 0 taken 72 times.
✓ Branch 1 taken 22 times.
|
94 | else if (!maze_state.loopy) |
| 28318 | { | ||
| 28319 |
1/2✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
|
22 | if (maze_state.transition_wipe) |
| 28320 | ✗ | closescreen(maze_state.transition_wipe - 1); | |
| 28321 | |||
| 28322 | 22 | loadscr(cur_dmap, current_screen, -1, false); | |
| 28323 | 22 | maze_state.scr = get_scr(maze_screen); | |
| 28324 | |||
| 28325 | // A bit janky, but works: clear all state (as usual during a screen change), but keep | ||
| 28326 | // the maze state. | ||
| 28327 | 22 | auto prev_maze_state = maze_state; | |
| 28328 | 22 | ALLOFF(); | |
| 28329 | 22 | maze_state = prev_maze_state; | |
| 28330 | |||
| 28331 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 6 times.
|
22 | if (advance_dir == left) x = (get_region_relative_dx(maze_screen) + 1) * 256 - 16; |
| 28332 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 4 times.
|
22 | if (advance_dir == right) x = (get_region_relative_dx(maze_screen)) * 256; |
| 28333 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 6 times.
|
22 | if (advance_dir == up) y = (get_region_relative_dy(maze_screen) + 1) * 176 - 16; |
| 28334 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 6 times.
|
22 | if (advance_dir == down) y = (get_region_relative_dy(maze_screen)) * 176; |
| 28335 | |||
| 28336 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 22 times.
|
22 | if (maze_state.can_get_lost) |
| 28337 | { | ||
| 28338 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 18 times.
|
22 | if (advance_dir == maze_state.scr->exitdir) |
| 28339 | 4 | maze_state.lost = false; | |
| 28340 | else | ||
| 28341 | 18 | maze_state.lost = true; | |
| 28342 | 22 | } | |
| 28343 | |||
| 28344 |
1/2✓ Branch 0 taken 22 times.
✗ Branch 1 not taken.
|
22 | if (maze_state.transition_wipe) |
| 28345 | ✗ | openscreen(maze_state.transition_wipe - 1); | |
| 28346 | 22 | } | |
| 28347 | } | ||
| 28348 | |||
| 28349 |
6/6✓ Branch 0 taken 7758 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 4156 times.
✓ Branch 3 taken 3602 times.
✓ Branch 4 taken 4052 times.
✓ Branch 5 taken 104 times.
|
7764 | if (maze_state.active && (maze_state.lost || advance_dir != maze_state.scr->exitdir)) |
| 28350 | 7654 | return; | |
| 28351 | 110 | } | |
| 28352 | |||
| 28353 |
2/2✓ Branch 0 taken 14806877 times.
✓ Branch 1 taken 7951 times.
|
14814828 | if (x > world_w-16) |
| 28354 | { | ||
| 28355 | 7951 | x = world_w-16; | |
| 28356 | 7951 | do_scroll_direction(right); | |
| 28357 | 7951 | } | |
| 28358 |
2/2✓ Branch 0 taken 14807762 times.
✓ Branch 1 taken 7066 times.
|
14814828 | if (x < 0) |
| 28359 | { | ||
| 28360 | 7066 | x = 0; | |
| 28361 | 7066 | do_scroll_direction(left); | |
| 28362 | 7066 | } | |
| 28363 |
2/2✓ Branch 0 taken 14807324 times.
✓ Branch 1 taken 7504 times.
|
14814828 | if (y > world_h-16) |
| 28364 | { | ||
| 28365 | 7504 | y = world_h-16; | |
| 28366 | 7504 | do_scroll_direction(down); | |
| 28367 | 7504 | } | |
| 28368 |
2/2✓ Branch 0 taken 14805647 times.
✓ Branch 1 taken 9181 times.
|
14814828 | if (y < 0) |
| 28369 | { | ||
| 28370 | 9181 | y = 0; | |
| 28371 | 9181 | do_scroll_direction(up); | |
| 28372 | 9181 | } | |
| 28373 | 14835456 | } | |
| 28374 | |||
| 28375 | 14831558 | bool HeroClass::check_prescroll() | |
| 28376 | { | ||
| 28377 |
2/2✓ Branch 0 taken 14993 times.
✓ Branch 1 taken 14816565 times.
|
14831558 | if (walk_through_walls) |
| 28378 | 14993 | return true; | |
| 28379 |
2/2✓ Branch 0 taken 14802507 times.
✓ Branch 1 taken 14058 times.
|
14816565 | if(get_qr(qr_BROKEN_SCROLL_INSTEAD_OF_DROWN_FALL)) |
| 28380 | 14802507 | return true; // skip checks | |
| 28381 |
8/8✓ Branch 0 taken 14052 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 14049 times.
✓ Branch 3 taken 3 times.
✓ Branch 4 taken 14046 times.
✓ Branch 5 taken 3 times.
✓ Branch 6 taken 2 times.
✓ Branch 7 taken 14044 times.
|
14058 | if (x <= world_w-16 && x >= 0 && y <= world_h-16 && y >= 0) |
| 28382 | 14044 | return true; // in bounds, no need for checks | |
| 28383 | 14 | zfix tx = x, ty = y, tz = z; | |
| 28384 | 14 | x = vbound(x, 0, world_w-16); | |
| 28385 | 14 | y = vbound(y, 0, world_h-16); | |
| 28386 |
2/4✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 14 times.
|
14 | if(onWater(true) || drownclk) |
| 28387 | ✗ | return false; // would drown before scrolling | |
| 28388 |
2/4✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 14 times.
|
14 | if(pitslide() || fallclk) |
| 28389 | ✗ | return false; // would fall before scrolling | |
| 28390 | 14 | x = tx; y = ty; z = tz; | |
| 28391 | 14 | return true; | |
| 28392 | 14831558 | } | |
| 28393 | |||
| 28394 | // assumes current direction is in lastdir[3] | ||
| 28395 | // compares directions with scr->path and scr->exitdir | ||
| 28396 | 112886 | bool HeroClass::checkmaze(const mapscr *scr, bool sound) | |
| 28397 | { | ||
| 28398 |
2/2✓ Branch 0 taken 112165 times.
✓ Branch 1 taken 721 times.
|
112886 | if(!(scr->flags&fMAZE)) |
| 28399 | 112165 | return true; | |
| 28400 | |||
| 28401 |
2/2✓ Branch 0 taken 85 times.
✓ Branch 1 taken 636 times.
|
721 | if(lastdir[3]==scr->exitdir) |
| 28402 | 85 | return true; | |
| 28403 | |||
| 28404 |
2/2✓ Branch 0 taken 1014 times.
✓ Branch 1 taken 99 times.
|
1113 | for(int32_t i=0; i<4; i++) |
| 28405 |
2/2✓ Branch 0 taken 477 times.
✓ Branch 1 taken 537 times.
|
1014 | if(lastdir[i]!=scr->path[i]) |
| 28406 | 537 | return false; | |
| 28407 | |||
| 28408 |
2/2✓ Branch 0 taken 66 times.
✓ Branch 1 taken 33 times.
|
99 | if(sound) |
| 28409 | 33 | sfx(scr->secretsfx); | |
| 28410 | |||
| 28411 | 99 | return true; | |
| 28412 | 112886 | } | |
| 28413 | |||
| 28414 | // assumes current direction is in lastdir[3] | ||
| 28415 | // compares directions with scr->path and scr->exitdir | ||
| 28416 | 38 | bool HeroClass::checkmaze_ignore_exit(const mapscr *scr, bool sound) | |
| 28417 | { | ||
| 28418 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 38 times.
|
38 | if(!(scr->flags&fMAZE)) |
| 28419 | ✗ | return true; | |
| 28420 | |||
| 28421 |
2/2✓ Branch 0 taken 58 times.
✓ Branch 1 taken 6 times.
|
64 | for(int32_t i=0; i<4; i++) |
| 28422 |
2/2✓ Branch 0 taken 26 times.
✓ Branch 1 taken 32 times.
|
58 | if(lastdir[i]!=scr->path[i]) |
| 28423 | 32 | return false; | |
| 28424 | |||
| 28425 |
1/2✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
|
6 | if(sound) |
| 28426 | 6 | sfx(scr->secretsfx); | |
| 28427 | |||
| 28428 | 6 | return true; | |
| 28429 | 38 | } | |
| 28430 | |||
| 28431 | 56634 | bool HeroClass::edge_of_dmap(int32_t side) | |
| 28432 | { | ||
| 28433 |
4/4✓ Branch 0 taken 56450 times.
✓ Branch 1 taken 184 times.
✓ Branch 2 taken 56231 times.
✓ Branch 3 taken 219 times.
|
56634 | if (!has_advanced_maze(origin_scr) && checkmaze(origin_scr, false) == false) |
| 28434 | 219 | return false; | |
| 28435 | |||
| 28436 | // needs fixin' | ||
| 28437 | // should check dmap style | ||
| 28438 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 16348 times.
✓ Branch 2 taken 12062 times.
✓ Branch 3 taken 13302 times.
✓ Branch 4 taken 14703 times.
|
56415 | switch(side) |
| 28439 | { | ||
| 28440 | case up: | ||
| 28441 | 16348 | return current_screen<16; | |
| 28442 | |||
| 28443 | case down: | ||
| 28444 | 12062 | return current_screen>=112; | |
| 28445 | |||
| 28446 | case left: | ||
| 28447 |
2/2✓ Branch 0 taken 13167 times.
✓ Branch 1 taken 135 times.
|
13302 | if((current_screen&15)==0) |
| 28448 | 135 | return true; | |
| 28449 | |||
| 28450 |
2/2✓ Branch 0 taken 7435 times.
✓ Branch 1 taken 5732 times.
|
13167 | if((DMaps[cur_dmap].type&dmfTYPE)!=dmOVERW) |
| 28451 | // if(dlevel) | ||
| 28452 | 7435 | return (((current_screen&15)-DMaps[cur_dmap].xoff)<=0); | |
| 28453 | |||
| 28454 | 5732 | break; | |
| 28455 | |||
| 28456 | case right: | ||
| 28457 |
2/2✓ Branch 0 taken 112 times.
✓ Branch 1 taken 14591 times.
|
14703 | if((current_screen&15)==15) |
| 28458 | 112 | return true; | |
| 28459 | |||
| 28460 |
2/2✓ Branch 0 taken 8175 times.
✓ Branch 1 taken 6416 times.
|
14591 | if((DMaps[cur_dmap].type&dmfTYPE)!=dmOVERW) |
| 28461 | // if(dlevel) | ||
| 28462 | 8175 | return (((current_screen&15)-DMaps[cur_dmap].xoff)>=7); | |
| 28463 | |||
| 28464 | 6416 | break; | |
| 28465 | } | ||
| 28466 | |||
| 28467 | 12148 | return false; | |
| 28468 | 56634 | } | |
| 28469 | |||
| 28470 | 117228 | static std::pair<int, int> lookahead_coords(int scrolldir, int x, int y) | |
| 28471 | { | ||
| 28472 | 117228 | x = vbound(x, 0, world_w - 16); | |
| 28473 | 117228 | y = vbound(y, 0, world_h - 16); | |
| 28474 | 117228 | return {x, y}; | |
| 28475 | } | ||
| 28476 | |||
| 28477 | // Helper for scrollscr that gets next combo on next screen. | ||
| 28478 | 29307 | static int32_t lookahead(int32_t scrolldir, int x, int y) | |
| 28479 | { | ||
| 28480 | 58614 | auto [cx, cy] = lookahead_coords(scrolldir, x, y); | |
| 28481 | 58614 | return MAPCOMBO(cx, cy); | |
| 28482 | } | ||
| 28483 | |||
| 28484 | 456 | static bool lookaheadraftflag(int scroll_dir, int x, int y) | |
| 28485 | { | ||
| 28486 | 456 | int cx = x; | |
| 28487 | 456 | int cy = y + 8; | |
| 28488 | 456 | bound(cx, 0, world_w - 16); | |
| 28489 | 456 | bound(cy, 0, world_h - 8); | |
| 28490 | |||
| 28491 | 456 | auto rpos_handle = get_rpos_handle_for_world_xy(cx, cy, 0); | |
| 28492 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 456 times.
|
456 | return (isRaftFlag(rpos_handle.cflag()) || isRaftFlag(rpos_handle.sflag())); |
| 28493 | } | ||
| 28494 | |||
| 28495 | 3427485 | void HeroClass::run_scrolling_script_int(bool waitdraw) | |
| 28496 | { | ||
| 28497 |
2/2✓ Branch 0 taken 1712173 times.
✓ Branch 1 taken 1715312 times.
|
3427485 | if(waitdraw) |
| 28498 | { | ||
| 28499 |
3/4✓ Branch 0 taken 1712173 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1143144 times.
✓ Branch 3 taken 569029 times.
|
1712173 | if ((!( FFCore.system_suspend[susptGLOBALGAME] )) && FFCore.waitdraw(ScriptType::Global, GLOBAL_SCRIPT_GAME)) |
| 28500 | { | ||
| 28501 | 569029 | ZScriptVersion::RunScript(ScriptType::Global, GLOBAL_SCRIPT_GAME, GLOBAL_SCRIPT_GAME); | |
| 28502 | 569029 | FFCore.waitdraw(ScriptType::Global, GLOBAL_SCRIPT_GAME) = false; | |
| 28503 | 569029 | } | |
| 28504 | 1712173 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_GLOBAL_WAITDRAW); | |
| 28505 |
5/6✓ Branch 0 taken 1711516 times.
✓ Branch 1 taken 657 times.
✓ Branch 2 taken 48739 times.
✓ Branch 3 taken 1662777 times.
✓ Branch 4 taken 48739 times.
✗ Branch 5 not taken.
|
1712173 | if ( (!( FFCore.system_suspend[susptHEROACTIVE] )) && FFCore.waitdraw(ScriptType::Hero) && FFCore.getQuestHeaderInfo(vZelda) >= 0x255 ) |
| 28506 | { | ||
| 28507 | 48739 | ZScriptVersion::RunScript(ScriptType::Hero, SCRIPT_HERO_ACTIVE); | |
| 28508 | 48739 | FFCore.waitdraw(ScriptType::Hero) = false; | |
| 28509 | 48739 | } | |
| 28510 | 1712173 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_PLAYER_WAITDRAW); | |
| 28511 |
4/6✓ Branch 0 taken 1712173 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 5575 times.
✓ Branch 3 taken 1706598 times.
✓ Branch 4 taken 5575 times.
✗ Branch 5 not taken.
|
1712173 | if ( (!( FFCore.system_suspend[susptDMAPSCRIPT] )) && FFCore.waitdraw(ScriptType::DMap) && FFCore.getQuestHeaderInfo(vZelda) >= 0x255 ) |
| 28512 | { | ||
| 28513 | 5575 | ZScriptVersion::RunScript(ScriptType::DMap, DMaps[cur_dmap].script,cur_dmap); | |
| 28514 | 5575 | FFCore.waitdraw(ScriptType::DMap) = false; | |
| 28515 | 5575 | } | |
| 28516 | 1712173 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_DMAPDATA_ACTIVE_WAITDRAW); | |
| 28517 |
2/6✓ Branch 0 taken 1712173 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1712173 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
1712173 | if ( (!( FFCore.system_suspend[susptDMAPSCRIPT] )) && FFCore.waitdraw(ScriptType::ScriptedPassiveSubscreen) && FFCore.getQuestHeaderInfo(vZelda) >= 0x255 ) |
| 28518 | { | ||
| 28519 | ✗ | ZScriptVersion::RunScript(ScriptType::ScriptedPassiveSubscreen, DMaps[cur_dmap].passive_sub_script,cur_dmap); | |
| 28520 | ✗ | FFCore.waitdraw(ScriptType::ScriptedPassiveSubscreen) = false; | |
| 28521 | ✗ | } | |
| 28522 | 1712173 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_DMAPDATA_PASSIVESUBSCREEN_WAITDRAW); | |
| 28523 | |||
| 28524 |
4/4✓ Branch 0 taken 202671 times.
✓ Branch 1 taken 1509502 times.
✓ Branch 2 taken 590 times.
✓ Branch 3 taken 202081 times.
|
1712173 | if (FFCore.getQuestHeaderInfo(vZelda) >= 0x255 && !FFCore.system_suspend[susptSCREENSCRIPTS]) |
| 28525 | { | ||
| 28526 | 457092 | for_every_base_screen_in_region([&](mapscr* scr, unsigned int region_scr_x, unsigned int region_scr_y) { | |
| 28527 |
5/6✓ Branch 0 taken 3462 times.
✓ Branch 1 taken 251549 times.
✓ Branch 2 taken 400 times.
✓ Branch 3 taken 3062 times.
✓ Branch 4 taken 400 times.
✗ Branch 5 not taken.
|
255011 | if (scr->script != 0 && FFCore.waitdraw(ScriptType::Screen, scr->screen) && scr->preloadscript) |
| 28528 | { | ||
| 28529 | 400 | ZScriptVersion::RunScript(ScriptType::Screen, scr->script, scr->screen); | |
| 28530 | 400 | FFCore.waitdraw(ScriptType::Screen, scr->screen) = 0; | |
| 28531 | 400 | } | |
| 28532 | 255011 | }); | |
| 28533 | 202081 | } | |
| 28534 | 1712173 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_SCREEN_WAITDRAW); | |
| 28535 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1712173 times.
|
1712173 | if ( !FFCore.system_suspend[susptITEMSCRIPTENGINE] ) |
| 28536 | { | ||
| 28537 | 1712173 | FFCore.itemScriptEngineOnWaitdraw(); | |
| 28538 | 1712173 | } | |
| 28539 | 1712173 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_ITEM_WAITDRAW); | |
| 28540 | 1712173 | } | |
| 28541 | else | ||
| 28542 | { | ||
| 28543 |
4/4✓ Branch 0 taken 205810 times.
✓ Branch 1 taken 1509502 times.
✓ Branch 2 taken 590 times.
✓ Branch 3 taken 205220 times.
|
1715312 | if (FFCore.getQuestHeaderInfo(vZelda) >= 0x255 && !FFCore.system_suspend[susptSCREENSCRIPTS]) |
| 28544 | { | ||
| 28545 | 464146 | for_every_base_screen_in_region([&](mapscr* scr, unsigned int region_scr_x, unsigned int region_scr_y) { | |
| 28546 |
4/4✓ Branch 0 taken 3525 times.
✓ Branch 1 taken 255401 times.
✓ Branch 2 taken 1403 times.
✓ Branch 3 taken 2122 times.
|
258926 | if (scr->script != 0 && scr->preloadscript) |
| 28547 | { | ||
| 28548 | 1403 | ZScriptVersion::RunScript(ScriptType::Screen, scr->script, scr->screen); | |
| 28549 | 1403 | } | |
| 28550 | 258926 | }); | |
| 28551 | 205220 | } | |
| 28552 | 1715312 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_FFCS); | |
| 28553 |
3/4✓ Branch 0 taken 1715312 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1091695 times.
✓ Branch 3 taken 623617 times.
|
1715312 | if ((!( FFCore.system_suspend[susptGLOBALGAME] )) && FFCore.doscript(ScriptType::Global, GLOBAL_SCRIPT_GAME)) |
| 28554 | { | ||
| 28555 | 623617 | ZScriptVersion::RunScript(ScriptType::Global, GLOBAL_SCRIPT_GAME, GLOBAL_SCRIPT_GAME); | |
| 28556 | 623617 | } | |
| 28557 | 1715312 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_GLOBAL_ACTIVE); | |
| 28558 |
6/6✓ Branch 0 taken 1714654 times.
✓ Branch 1 taken 658 times.
✓ Branch 2 taken 1558716 times.
✓ Branch 3 taken 155938 times.
✓ Branch 4 taken 1509502 times.
✓ Branch 5 taken 49214 times.
|
1715312 | if ((!( FFCore.system_suspend[susptHEROACTIVE] )) && FFCore.doscript(ScriptType::Hero) && FFCore.getQuestHeaderInfo(vZelda) >= 0x255) |
| 28559 | { | ||
| 28560 | 49214 | ZScriptVersion::RunScript(ScriptType::Hero, SCRIPT_HERO_ACTIVE); | |
| 28561 | 49214 | } | |
| 28562 | 1715312 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_PLAYER_ACTIVE); | |
| 28563 |
5/6✓ Branch 0 taken 1715312 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1714720 times.
✓ Branch 3 taken 592 times.
✓ Branch 4 taken 1509502 times.
✓ Branch 5 taken 205218 times.
|
1715312 | if ( (!( FFCore.system_suspend[susptDMAPSCRIPT] )) && FFCore.doscript(ScriptType::DMap) && FFCore.getQuestHeaderInfo(vZelda) >= 0x255 ) |
| 28564 | { | ||
| 28565 | 205218 | ZScriptVersion::RunScript(ScriptType::DMap, DMaps[cur_dmap].script,cur_dmap); | |
| 28566 | 205218 | } | |
| 28567 | 1715312 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_DMAPDATA_ACTIVE); | |
| 28568 |
4/6✓ Branch 0 taken 1715312 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1715312 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1509502 times.
✓ Branch 5 taken 205810 times.
|
1715312 | if ( (!( FFCore.system_suspend[susptDMAPSCRIPT] )) && FFCore.doscript(ScriptType::ScriptedPassiveSubscreen) && FFCore.getQuestHeaderInfo(vZelda) >= 0x255 ) |
| 28569 | { | ||
| 28570 | 205810 | ZScriptVersion::RunScript(ScriptType::ScriptedPassiveSubscreen, DMaps[cur_dmap].passive_sub_script,cur_dmap); | |
| 28571 | 205810 | } | |
| 28572 | 1715312 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_DMAPDATA_PASSIVESUBSCREEN); | |
| 28573 | 1715312 | bool old = get_qr(qr_OLD_ITEMDATA_SCRIPT_TIMING); | |
| 28574 |
3/4✓ Branch 0 taken 1715312 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 148862 times.
✓ Branch 3 taken 1566450 times.
|
1715312 | if(!FFCore.system_suspend[susptITEMSCRIPTENGINE] && old) |
| 28575 | 1566450 | FFCore.itemScriptEngine(); | |
| 28576 | 1715312 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_OLD_ITEMDATA_SCRIPT); | |
| 28577 |
3/4✓ Branch 0 taken 1715312 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1566450 times.
✓ Branch 3 taken 148862 times.
|
1715312 | if(!FFCore.system_suspend[susptITEMSCRIPTENGINE] && !old) |
| 28578 | 148862 | FFCore.itemScriptEngine(); | |
| 28579 | } | ||
| 28580 | 3427485 | } | |
| 28581 | |||
| 28582 | 854 | static zfix new_hero_x, new_hero_y; | |
| 28583 | static int new_region_offset_x, new_region_offset_y; | ||
| 28584 | static region_t scrolling_new_region; | ||
| 28585 | |||
| 28586 | 3234993 | void HeroClass::run_scrolling_script_old(int32_t scrolldir, int32_t cx, int32_t sx, int32_t sy, bool end_frames, bool waitdraw) | |
| 28587 | { | ||
| 28588 | // For rafting (and possibly other esoteric things) | ||
| 28589 | // Hero's action should remain unchanged while scrolling, | ||
| 28590 | // but for the sake of scripts, here's an eye-watering kludge. | ||
| 28591 | 3234993 | actiontype lastaction = action; | |
| 28592 | 3234993 | action=scrolling; FFCore.setHeroAction(scrolling); | |
| 28593 |
2/2✓ Branch 0 taken 1616683 times.
✓ Branch 1 taken 1618310 times.
|
3234993 | if(waitdraw) |
| 28594 | { | ||
| 28595 | 1616683 | FFCore.runGenericPassiveEngine(SCR_TIMING_WAITDRAW); | |
| 28596 | 1616683 | } | |
| 28597 | else | ||
| 28598 | { | ||
| 28599 | 1618310 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_FFCS-1); | |
| 28600 | } | ||
| 28601 | |||
| 28602 | // Also, hero coordinates should remain unchanged. | ||
| 28603 | // For compat, this is happening after the generic scripts above... | ||
| 28604 | 3234993 | zfix storex = x, storey = y; | |
| 28605 | |||
| 28606 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 811700 times.
✓ Branch 2 taken 584957 times.
✓ Branch 3 taken 858345 times.
✓ Branch 4 taken 979991 times.
|
3234993 | switch(scrolldir) |
| 28607 | { | ||
| 28608 | case up: | ||
| 28609 |
2/2✓ Branch 0 taken 669768 times.
✓ Branch 1 taken 141932 times.
|
811700 | if(y < scrolling_new_region.height - 16) y = scrolling_new_region.height; |
| 28610 |
4/4✓ Branch 0 taken 118844 times.
✓ Branch 1 taken 23088 times.
✓ Branch 2 taken 52878 times.
✓ Branch 3 taken 65966 times.
|
141932 | else if(cx > 0 && !end_frames) y = sy + scrolling_new_region.height - 20; |
| 28611 | 75966 | else y = scrolling_new_region.height - 16; | |
| 28612 | |||
| 28613 | 811700 | x = new_hero_x; | |
| 28614 | 811700 | break; | |
| 28615 | |||
| 28616 | case down: | ||
| 28617 |
2/2✓ Branch 0 taken 476279 times.
✓ Branch 1 taken 108678 times.
|
584957 | if(y > 0) y = -16; |
| 28618 |
4/4✓ Branch 0 taken 90765 times.
✓ Branch 1 taken 17913 times.
✓ Branch 2 taken 40026 times.
✓ Branch 3 taken 50739 times.
|
108678 | else if(cx > 0 && !end_frames) y = sy - 172; |
| 28619 | 57939 | else y = 0; | |
| 28620 | |||
| 28621 | 584957 | x = new_hero_x; | |
| 28622 | 584957 | break; | |
| 28623 | |||
| 28624 | case left: | ||
| 28625 |
2/2✓ Branch 0 taken 786764 times.
✓ Branch 1 taken 71581 times.
|
858345 | if(x < scrolling_new_region.width - 16) x = scrolling_new_region.width; |
| 28626 |
2/2✓ Branch 0 taken 58288 times.
✓ Branch 1 taken 13293 times.
|
71581 | else if(cx > 0) x = sx + scrolling_new_region.width - 20; |
| 28627 | 13293 | else x = scrolling_new_region.width - 16; | |
| 28628 | |||
| 28629 | 858345 | y = new_hero_y; | |
| 28630 | 858345 | break; | |
| 28631 | |||
| 28632 | case right: | ||
| 28633 |
2/2✓ Branch 0 taken 898481 times.
✓ Branch 1 taken 81510 times.
|
979991 | if(x > 0) x = -16; |
| 28634 |
2/2✓ Branch 0 taken 66446 times.
✓ Branch 1 taken 15064 times.
|
81510 | else if(cx > 0) x = sx - 252; |
| 28635 | 15064 | else x = 0; | |
| 28636 | |||
| 28637 | 979991 | y = new_hero_y; | |
| 28638 | 979991 | break; | |
| 28639 | } | ||
| 28640 | |||
| 28641 | 3234993 | viewport.x -= new_region_offset_x; | |
| 28642 | 3234993 | viewport.y -= new_region_offset_y; | |
| 28643 | |||
| 28644 | 3234993 | run_scrolling_script_int(waitdraw); | |
| 28645 | |||
| 28646 | 3234993 | viewport.x += new_region_offset_x; | |
| 28647 | 3234993 | viewport.y += new_region_offset_y; | |
| 28648 | |||
| 28649 | 3234993 | x = storex, y = storey; | |
| 28650 | 3234993 | action=lastaction; FFCore.setHeroAction(lastaction); | |
| 28651 | 3234993 | } | |
| 28652 | |||
| 28653 | 3427485 | void HeroClass::run_scrolling_script(int32_t scrolldir, int32_t cx, int32_t sx, int32_t sy, bool end_frames, bool waitdraw) | |
| 28654 | { | ||
| 28655 |
2/2✓ Branch 0 taken 3234993 times.
✓ Branch 1 taken 192492 times.
|
3427485 | if (get_qr(qr_BROKEN_SCRIPTS_SCROLLING_HERO_POSITION)) |
| 28656 | { | ||
| 28657 | // Old code has an off-by-one error, and doesn't clamp the hero position to the viewport. | ||
| 28658 | // | ||
| 28659 | // Although this is behind a compat qr, most test replays wouldn't fail. The ones that do are: | ||
| 28660 | // | ||
| 28661 | // nargads: different sfx plays during last frames of scrolling, sometimes | ||
| 28662 | // crucible: fog is slightly different on last frames of scrolling | ||
| 28663 | // yuurand: breaks. blocks are not removed when returning to a screen during scroll | ||
| 28664 | 3234993 | run_scrolling_script_old(scrolldir, cx, sx, sy, end_frames, waitdraw); | |
| 28665 | 3234993 | return; | |
| 28666 | } | ||
| 28667 | |||
| 28668 | // For rafting (and possibly other esoteric things) | ||
| 28669 | // Hero's action should remain unchanged while scrolling, | ||
| 28670 | // but for the sake of scripts, here's an eye-watering kludge. | ||
| 28671 | 192492 | actiontype lastaction = action; | |
| 28672 | 192492 | action=scrolling; FFCore.setHeroAction(scrolling); | |
| 28673 | |||
| 28674 | // Also, hero coordinates should remain unchanged. | ||
| 28675 | 192492 | zfix storex = x, storey = y; | |
| 28676 | |||
| 28677 |
2/2✓ Branch 0 taken 95490 times.
✓ Branch 1 taken 97002 times.
|
192492 | if(waitdraw) |
| 28678 | { | ||
| 28679 | 95490 | FFCore.runGenericPassiveEngine(SCR_TIMING_WAITDRAW); | |
| 28680 | 95490 | } | |
| 28681 | else | ||
| 28682 | { | ||
| 28683 | 97002 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_FFCS-1); | |
| 28684 | } | ||
| 28685 | |||
| 28686 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 44679 times.
✓ Branch 2 taken 38437 times.
✓ Branch 3 taken 58021 times.
✓ Branch 4 taken 51355 times.
|
192492 | switch(scrolldir) |
| 28687 | { | ||
| 28688 | case up: | ||
| 28689 |
2/2✓ Branch 0 taken 128 times.
✓ Branch 1 taken 44551 times.
|
44679 | if(y <= scrolling_new_region.height - 16) y = scrolling_new_region.height; |
| 28690 | 128 | else y = scrolling_new_region.height - 16; | |
| 28691 | |||
| 28692 | 44679 | x = new_hero_x; | |
| 28693 | 44679 | break; | |
| 28694 | |||
| 28695 | case down: | ||
| 28696 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 38437 times.
|
38437 | if(y >= 0) y = -16; |
| 28697 | ✗ | else y = 0; | |
| 28698 | |||
| 28699 | 38437 | x = new_hero_x; | |
| 28700 | 38437 | break; | |
| 28701 | |||
| 28702 | case left: | ||
| 28703 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 58021 times.
|
58021 | if(x <= scrolling_new_region.width - 16) x = scrolling_new_region.width; |
| 28704 | ✗ | else x = scrolling_new_region.width - 16; | |
| 28705 | |||
| 28706 | 58021 | y = new_hero_y; | |
| 28707 | 58021 | break; | |
| 28708 | |||
| 28709 | case right: | ||
| 28710 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 51355 times.
|
51355 | if(x >= 0) x = -16; |
| 28711 | ✗ | else x = 0; | |
| 28712 | |||
| 28713 | 51355 | y = new_hero_y; | |
| 28714 | 51355 | break; | |
| 28715 | } | ||
| 28716 | |||
| 28717 | 192492 | viewport.x -= new_region_offset_x; | |
| 28718 | 192492 | viewport.y -= new_region_offset_y; | |
| 28719 | |||
| 28720 |
4/4✓ Branch 0 taken 134471 times.
✓ Branch 1 taken 58021 times.
✓ Branch 2 taken 51355 times.
✓ Branch 3 taken 83116 times.
|
192492 | if (scrolldir == left || scrolldir == right) |
| 28721 | 109376 | x.doClamp(viewport.left(), viewport.right() - 16); | |
| 28722 |
4/4✓ Branch 0 taken 147813 times.
✓ Branch 1 taken 44679 times.
✓ Branch 2 taken 38437 times.
✓ Branch 3 taken 109376 times.
|
192492 | if (scrolldir == up || scrolldir == down) |
| 28723 | 83116 | y.doClamp(viewport.top(), viewport.bottom() - 16); | |
| 28724 | |||
| 28725 | 192492 | run_scrolling_script_int(waitdraw); | |
| 28726 | |||
| 28727 | 192492 | viewport.x += new_region_offset_x; | |
| 28728 | 192492 | viewport.y += new_region_offset_y; | |
| 28729 | |||
| 28730 | 192492 | x = storex, y = storey; | |
| 28731 | 192492 | action=lastaction; FFCore.setHeroAction(lastaction); | |
| 28732 | 3427485 | } | |
| 28733 | |||
| 28734 | //Has solving the maze enabled a side warp? | ||
| 28735 | //Only used just before scrolling screens | ||
| 28736 | // Note: since scrollscr() calls this, and dowarp() calls scrollscr(), | ||
| 28737 | // return true to abort the topmost scrollscr() call. -L | ||
| 28738 | 29241 | bool HeroClass::maze_enabled_sizewarp(const mapscr *scr, int32_t scrolldir) | |
| 28739 | { | ||
| 28740 | 29241 | maze_state.last_check_herox = x; | |
| 28741 | 29241 | maze_state.last_check_heroy = y; | |
| 28742 | |||
| 28743 |
2/2✓ Branch 0 taken 87723 times.
✓ Branch 1 taken 29241 times.
|
116964 | for(int32_t i = 0; i < 3; i++) lastdir[i] = lastdir[i+1]; |
| 28744 | |||
| 28745 |
2/2✓ Branch 0 taken 268 times.
✓ Branch 1 taken 28973 times.
|
29241 | lastdir[3] = scr->flags&fMAZE ? scrolldir : 0xFF; |
| 28746 | |||
| 28747 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 29241 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
29241 | if(scr->flags8&fMAZEvSIDEWARP && scr->flags&fMAZE && scrolldir != scr->exitdir) |
| 28748 | { | ||
| 28749 | ✗ | switch(scrolldir) | |
| 28750 | { | ||
| 28751 | case up: | ||
| 28752 | ✗ | if(scr->flags2&wfUP && checkmaze(scr,true)) | |
| 28753 | { | ||
| 28754 | ✗ | lastdir[3] = 0xFF; | |
| 28755 | ✗ | sdir=up; | |
| 28756 | ✗ | dowarp(scr,1,(scr->sidewarpindex)&3); | |
| 28757 | ✗ | return true; | |
| 28758 | } | ||
| 28759 | |||
| 28760 | ✗ | break; | |
| 28761 | |||
| 28762 | case down: | ||
| 28763 | ✗ | if(scr->flags2&wfDOWN && checkmaze(scr,true)) | |
| 28764 | { | ||
| 28765 | ✗ | lastdir[3] = 0xFF; | |
| 28766 | ✗ | sdir=down; | |
| 28767 | ✗ | dowarp(scr,1,(scr->sidewarpindex>>2)&3); | |
| 28768 | ✗ | return true; | |
| 28769 | } | ||
| 28770 | |||
| 28771 | ✗ | break; | |
| 28772 | |||
| 28773 | case left: | ||
| 28774 | ✗ | if(scr->flags2&wfLEFT && checkmaze(scr,true)) | |
| 28775 | { | ||
| 28776 | ✗ | lastdir[3] = 0xFF; | |
| 28777 | ✗ | sdir=left; | |
| 28778 | ✗ | dowarp(scr,1,(scr->sidewarpindex>>4)&3); | |
| 28779 | ✗ | return true; | |
| 28780 | } | ||
| 28781 | |||
| 28782 | ✗ | break; | |
| 28783 | |||
| 28784 | case right: | ||
| 28785 | ✗ | if(scr->flags2&wfRIGHT && checkmaze(scr,true)) | |
| 28786 | { | ||
| 28787 | ✗ | lastdir[3] = 0xFF; | |
| 28788 | ✗ | sdir=right; | |
| 28789 | ✗ | dowarp(scr,1,(scr->sidewarpindex)&3); | |
| 28790 | ✗ | return true; | |
| 28791 | } | ||
| 28792 | |||
| 28793 | ✗ | break; | |
| 28794 | } | ||
| 28795 | ✗ | } | |
| 28796 | |||
| 28797 | 29241 | return false; | |
| 28798 | 29241 | } | |
| 28799 | |||
| 28800 | 29307 | int32_t HeroClass::get_scroll_step(int32_t scrolldir) | |
| 28801 | { | ||
| 28802 | // For side-scrollers, where the relative speed of 'fast' scrolling is a bit slow. | ||
| 28803 |
2/2✓ Branch 0 taken 2578 times.
✓ Branch 1 taken 26729 times.
|
29307 | if(get_qr(qr_VERYFASTSCROLLING)) |
| 28804 | 2578 | return 16; | |
| 28805 | |||
| 28806 |
2/2✓ Branch 0 taken 25270 times.
✓ Branch 1 taken 1459 times.
|
26729 | if(get_qr(qr_SMOOTHVERTICALSCROLLING) != 0) |
| 28807 | { | ||
| 28808 |
2/2✓ Branch 0 taken 17284 times.
✓ Branch 1 taken 7986 times.
|
25270 | return (isdungeon() && !get_qr(qr_FASTDNGN)) ? 2 : 4; |
| 28809 | } | ||
| 28810 | else | ||
| 28811 | { | ||
| 28812 |
4/4✓ Branch 0 taken 973 times.
✓ Branch 1 taken 486 times.
✓ Branch 2 taken 195 times.
✓ Branch 3 taken 778 times.
|
1459 | if(scrolldir == up || scrolldir == down) |
| 28813 | { | ||
| 28814 | 681 | return 8; | |
| 28815 | } | ||
| 28816 | else | ||
| 28817 | { | ||
| 28818 |
2/2✓ Branch 0 taken 341 times.
✓ Branch 1 taken 437 times.
|
778 | return (isdungeon() && !get_qr(qr_FASTDNGN)) ? 2 : 4; |
| 28819 | } | ||
| 28820 | } | ||
| 28821 | 29307 | } | |
| 28822 | |||
| 28823 | 29307 | int32_t HeroClass::get_scroll_delay(int32_t scrolldir) | |
| 28824 | { | ||
| 28825 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 29307 times.
|
29307 | if(get_qr(qr_NOSCROLL)) |
| 28826 | ✗ | return 0; | |
| 28827 | |||
| 28828 |
4/4✓ Branch 0 taken 26729 times.
✓ Branch 1 taken 2578 times.
✓ Branch 2 taken 25270 times.
✓ Branch 3 taken 1459 times.
|
29307 | if( (get_qr(qr_VERYFASTSCROLLING) != 0) || |
| 28829 | 26729 | (get_qr(qr_SMOOTHVERTICALSCROLLING) != 0) ) | |
| 28830 | { | ||
| 28831 | 27848 | return 1; | |
| 28832 | } | ||
| 28833 | else | ||
| 28834 | { | ||
| 28835 |
4/4✓ Branch 0 taken 973 times.
✓ Branch 1 taken 486 times.
✓ Branch 2 taken 195 times.
✓ Branch 3 taken 778 times.
|
1459 | if(scrolldir == up || scrolldir == down) |
| 28836 | { | ||
| 28837 |
2/2✓ Branch 0 taken 359 times.
✓ Branch 1 taken 322 times.
|
681 | return (isdungeon() && !get_qr(qr_FASTDNGN)) ? 4 : 2; |
| 28838 | } | ||
| 28839 | else | ||
| 28840 | { | ||
| 28841 | 778 | return 1; | |
| 28842 | } | ||
| 28843 | } | ||
| 28844 | 29307 | } | |
| 28845 | |||
| 28846 | 369915 | void HeroClass::calc_darkroom_hero(int32_t x1, int32_t y1) | |
| 28847 | { | ||
| 28848 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 369915 times.
|
369915 | if(!get_qr(qr_NEW_DARKROOM)) return; |
| 28849 | 369915 | int32_t lampid = current_item_id(itype_lantern); | |
| 28850 |
2/2✓ Branch 0 taken 364362 times.
✓ Branch 1 taken 5553 times.
|
369915 | if(lampid < 0) return; |
| 28851 |
2/4✓ Branch 0 taken 364362 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 364362 times.
|
364362 | if(!(checkbunny(lampid) && checkmagiccost(lampid,lamp_paid))) |
| 28852 | { | ||
| 28853 | ✗ | lamp_paid = false; | |
| 28854 | ✗ | return; | |
| 28855 | } | ||
| 28856 | 364362 | lamp_paid = true; | |
| 28857 | 364362 | paymagiccost(lampid,false,true); | |
| 28858 | |||
| 28859 | 364362 | int32_t hx = x.getInt() - x1 + 8; | |
| 28860 | 364362 | int32_t hy = y.getInt() - y1 + 8; | |
| 28861 | |||
| 28862 | 364362 | itemdata& lamp = itemsbuf[lampid]; | |
| 28863 | 364362 | optional<word> wave_opt; | |
| 28864 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 364362 times.
|
364362 | if(lamp.flags & item_flag1) |
| 28865 | ✗ | wave_opt = 0; // cancel wave effect | |
| 28866 | 364362 | handle_lighting(hx, hy, lamp.misc1, lamp.misc2, dir, darkscr_bmp, NULL, -1, -1, -1, -1, wave_opt, wave_opt); | |
| 28867 | 369915 | } | |
| 28868 | |||
| 28869 | struct nearby_scrolling_screen_t | ||
| 28870 | { | ||
| 28871 | int screen; | ||
| 28872 | int offx; | ||
| 28873 | int offy; | ||
| 28874 | bool is_new; | ||
| 28875 | screen_handles_t screen_handles; | ||
| 28876 | }; | ||
| 28877 | |||
| 28878 | struct rect_t | ||
| 28879 | { | ||
| 28880 | int l, r, t, b; | ||
| 28881 | |||
| 28882 | rect_t() = default; | ||
| 28883 | 117353 | explicit rect_t(const viewport_t& viewport) : l(viewport.left()), r(viewport.right()), t(viewport.top()), b(viewport.bottom()) {} | |
| 28884 | |||
| 28885 | 42 | void union_with(const rect_t& other) | |
| 28886 | { | ||
| 28887 | 42 | l = std::min(l, other.l); | |
| 28888 | 42 | r = std::max(r, other.r); | |
| 28889 | 42 | t = std::min(t, other.t); | |
| 28890 | 42 | b = std::max(b, other.b); | |
| 28891 | 42 | } | |
| 28892 | |||
| 28893 | 58614 | void intersect_with(const rect_t& other) | |
| 28894 | { | ||
| 28895 | 58614 | l = std::max(l, other.l); | |
| 28896 | 58614 | r = std::min(r, other.r); | |
| 28897 | 58614 | t = std::max(t, other.t); | |
| 28898 | 58614 | b = std::min(b, other.b); | |
| 28899 | |||
| 28900 |
2/4✓ Branch 0 taken 58614 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 58614 times.
|
58614 | if (l > r || t > b) |
| 28901 | ✗ | l = r = t = b = 0; | |
| 28902 | 58614 | } | |
| 28903 | |||
| 28904 | 125 | bool intersects_with(const rect_t& other) const | |
| 28905 | { | ||
| 28906 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 125 times.
|
125 | return std::max(t, other.t) < std::min(b, other.b) && std::max(l, other.l) < std::min(r, other.r); |
| 28907 | } | ||
| 28908 | |||
| 28909 | 58614 | int left() const {return l;} | |
| 28910 | 58614 | int right() const {return r;} | |
| 28911 | 58614 | int top() const {return t;} | |
| 28912 | 58614 | int bottom() const {return b;} | |
| 28913 | }; | ||
| 28914 | |||
| 28915 | struct nearby_scrolling_screens_t | ||
| 28916 | { | ||
| 28917 | std::vector<nearby_scrolling_screen_t> screens; | ||
| 28918 | // Only ever true during whistle warp scrolling. | ||
| 28919 | bool has_overlapping_screens; | ||
| 28920 | rect_t old_screens_rect; | ||
| 28921 | rect_t new_screens_rect; | ||
| 28922 | }; | ||
| 28923 | |||
| 28924 | // Returns all the screens (old and new region) that need to be rendered during scrolling, along | ||
| 28925 | // with thier draw offsets. | ||
| 28926 | // Note: The destination screen is Hero.current_screen, the starting screen is scrolling_hero_screen. | ||
| 28927 | // old_viewport_start: the viewport in the old region at start of scrolling | ||
| 28928 | // new_viewport_final: the viewport in the new region at end of scrolling | ||
| 28929 | // old_region_visible: the viewport in the old region that will be visible | ||
| 28930 | // new_region_visible: the viewport in the new region that will be visible | ||
| 28931 | 29307 | static nearby_scrolling_screens_t get_nearby_scrolling_screens(const std::vector<mapscr*>& old_temporary_screens, viewport_t old_viewport_start, viewport_t new_viewport_final, rect_t old_region_visible, rect_t new_region_visible) | |
| 28932 | { | ||
| 28933 | 29307 | bool is_whistle_warp_scroll = HeroInOutgoingWhistleWarp(); | |
| 28934 | 29307 | int old_region = get_region_id(scrolling_map, scrolling_hero_screen); | |
| 28935 | |||
| 28936 | 29307 | nearby_scrolling_screens_t nearby_screens{}; | |
| 28937 | 29307 | nearby_screens.has_overlapping_screens = is_whistle_warp_scroll; | |
| 28938 | |||
| 28939 | // base_scr, use_new_screens, offx, offy | ||
| 28940 | 29307 | std::vector<std::tuple<mapscr*, bool, int, int>> old_screen_deltas; | |
| 28941 | 29307 | std::vector<std::tuple<mapscr*, bool, int, int>> new_screen_deltas; | |
| 28942 | |||
| 28943 |
2/4✓ Branch 0 taken 29307 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 29307 times.
✗ Branch 3 not taken.
|
29307 | int old_screens_x0 = std::clamp(old_region_visible.left() / 256, 0, 15); |
| 28944 |
2/4✓ Branch 0 taken 29307 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 29307 times.
✗ Branch 3 not taken.
|
29307 | int old_screens_x1 = std::clamp((old_region_visible.right() - 1) / 256, 0, 15); |
| 28945 |
2/4✓ Branch 0 taken 29307 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 29307 times.
✗ Branch 3 not taken.
|
29307 | int old_screens_y0 = std::clamp(old_region_visible.top() / 176, 0, 8); |
| 28946 |
2/4✓ Branch 0 taken 29307 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 29307 times.
✗ Branch 3 not taken.
|
29307 | int old_screens_y1 = std::clamp((old_region_visible.bottom() - 1) / 176, 0, 8); |
| 28947 |
2/2✓ Branch 0 taken 29333 times.
✓ Branch 1 taken 29307 times.
|
58640 | for (int x = old_screens_x0; x <= old_screens_x1; x++) |
| 28948 | { | ||
| 28949 |
2/2✓ Branch 0 taken 29489 times.
✓ Branch 1 taken 29333 times.
|
58822 | for (int y = old_screens_y0; y <= old_screens_y1; y++) |
| 28950 | { | ||
| 28951 | 29489 | int screen = scrolling_region.origin_screen + x + y*16; | |
| 28952 |
2/4✓ Branch 0 taken 29489 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 29489 times.
|
29489 | if (get_region_id(scrolling_map, screen) != old_region) |
| 28953 | ✗ | continue; | |
| 28954 | |||
| 28955 | 29489 | mapscr* base_scr = old_temporary_screens[screen*7]; | |
| 28956 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 29489 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
29489 | CHECK(base_scr); |
| 28957 | 29489 | bool use_new_screens = false; | |
| 28958 | 29489 | int offx = get_region_relative_dx(screen, scrolling_region.origin_screen) * 256; | |
| 28959 | 29489 | int offy = get_region_relative_dy(screen, scrolling_region.origin_screen) * 176; | |
| 28960 |
1/2✓ Branch 0 taken 29489 times.
✗ Branch 1 not taken.
|
29489 | old_screen_deltas.push_back({base_scr, use_new_screens, offx, offy}); |
| 28961 | 29489 | } | |
| 28962 | 29333 | } | |
| 28963 | |||
| 28964 | // This translates from the new region to the old region's coordinates ... | ||
| 28965 | int dx, dy; | ||
| 28966 |
2/2✓ Branch 0 taken 125 times.
✓ Branch 1 taken 29182 times.
|
29307 | if (is_whistle_warp_scroll) |
| 28967 | { | ||
| 28968 | // ... anchored at the current viewport. | ||
| 28969 |
2/2✓ Branch 0 taken 113 times.
✓ Branch 1 taken 12 times.
|
125 | if (scrolling_dir == right) |
| 28970 |
2/4✓ Branch 0 taken 113 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 113 times.
✗ Branch 3 not taken.
|
113 | dx = old_viewport_start.right() - new_viewport_final.right(); |
| 28971 | else | ||
| 28972 |
2/4✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 12 times.
✗ Branch 3 not taken.
|
12 | dx = old_viewport_start.left() - new_viewport_final.left(); |
| 28973 | |||
| 28974 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 119 times.
|
125 | if (scrolling_dir == up) |
| 28975 |
2/4✓ Branch 0 taken 6 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
|
6 | dy = old_viewport_start.bottom() - new_viewport_final.bottom(); |
| 28976 | else | ||
| 28977 |
2/4✓ Branch 0 taken 119 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 119 times.
✗ Branch 3 not taken.
|
119 | dy = old_viewport_start.top() - new_viewport_final.top(); |
| 28978 | |||
| 28979 |
2/2✓ Branch 0 taken 119 times.
✓ Branch 1 taken 6 times.
|
125 | if (scrolling_dir == up) dy -= old_viewport_start.h; |
| 28980 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 115 times.
|
119 | else if (scrolling_dir == down) dy += old_viewport_start.h; |
| 28981 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 113 times.
|
115 | else if (scrolling_dir == left) dx -= old_viewport_start.w; |
| 28982 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 113 times.
|
113 | else if (scrolling_dir == right) dx += old_viewport_start.w; |
| 28983 | 125 | } | |
| 28984 | else | ||
| 28985 | { | ||
| 28986 | // ... anchored at the point where the screen scrolling starts. | ||
| 28987 | 58364 | dx = get_region_relative_dx(cur_screen, scrolling_region.origin_screen) - | |
| 28988 | 29182 | (get_region_relative_dx(Hero.current_screen, scrolling_region.origin_screen) - get_region_relative_dx(scrolling_hero_screen, scrolling_region.origin_screen)); | |
| 28989 | 58364 | dy = get_region_relative_dy(cur_screen, scrolling_region.origin_screen) - | |
| 28990 | 29182 | (get_region_relative_dy(Hero.current_screen, scrolling_region.origin_screen) - get_region_relative_dy(scrolling_hero_screen, scrolling_region.origin_screen)); | |
| 28991 |
2/2✓ Branch 0 taken 20719 times.
✓ Branch 1 taken 8463 times.
|
29182 | if (scrolling_dir == up) dy -= 1; |
| 28992 |
2/2✓ Branch 0 taken 6277 times.
✓ Branch 1 taken 14442 times.
|
20719 | else if (scrolling_dir == down) dy += 1; |
| 28993 |
2/2✓ Branch 0 taken 6866 times.
✓ Branch 1 taken 7576 times.
|
14442 | else if (scrolling_dir == left) dx -= 1; |
| 28994 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 7576 times.
|
7576 | else if (scrolling_dir == right) dx += 1; |
| 28995 | 29182 | dx *= 256; | |
| 28996 | 29182 | dy *= 176; | |
| 28997 | } | ||
| 28998 | |||
| 28999 |
2/4✓ Branch 0 taken 29307 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 29307 times.
✗ Branch 3 not taken.
|
29307 | int new_screens_x0 = std::clamp(new_region_visible.left() / 256, 0, 15); |
| 29000 |
2/4✓ Branch 0 taken 29307 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 29307 times.
✗ Branch 3 not taken.
|
29307 | int new_screens_x1 = std::clamp((new_region_visible.right() - 1) / 256, 0, 15); |
| 29001 |
2/4✓ Branch 0 taken 29307 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 29307 times.
✗ Branch 3 not taken.
|
29307 | int new_screens_y0 = std::clamp(new_region_visible.top() / 176, 0, 8); |
| 29002 |
2/4✓ Branch 0 taken 29307 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 29307 times.
✗ Branch 3 not taken.
|
29307 | int new_screens_y1 = std::clamp((new_region_visible.bottom() - 1) / 176, 0, 8); |
| 29003 | |||
| 29004 |
2/2✓ Branch 0 taken 29335 times.
✓ Branch 1 taken 29307 times.
|
58642 | for (int x = new_screens_x0; x <= new_screens_x1; x++) |
| 29005 | { | ||
| 29006 |
2/2✓ Branch 0 taken 29489 times.
✓ Branch 1 taken 29335 times.
|
58824 | for (int y = new_screens_y0; y <= new_screens_y1; y++) |
| 29007 | { | ||
| 29008 | 29489 | int screen = cur_screen + x + y*16; | |
| 29009 |
2/4✓ Branch 0 taken 29489 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 29489 times.
✗ Branch 3 not taken.
|
29489 | if (!is_in_current_region(screen)) |
| 29010 | ✗ | continue; | |
| 29011 | |||
| 29012 | 29489 | int sx = get_region_relative_dx(screen, cur_screen); | |
| 29013 | 29489 | int sy = get_region_relative_dy(screen, cur_screen); | |
| 29014 | 29489 | int offx = sx * 256 + dx; | |
| 29015 | 29489 | int offy = sy * 176 + dy; | |
| 29016 | |||
| 29017 |
1/2✓ Branch 0 taken 29489 times.
✗ Branch 1 not taken.
|
29489 | mapscr* base_scr = get_scr(cur_map, screen); |
| 29018 | 29489 | bool use_new_screens = true; | |
| 29019 |
1/2✓ Branch 0 taken 29489 times.
✗ Branch 1 not taken.
|
29489 | new_screen_deltas.push_back({base_scr, use_new_screens, offx, offy}); |
| 29020 | 29489 | } | |
| 29021 | 29335 | } | |
| 29022 | |||
| 29023 | // First handle the old screens, then the new screens. | ||
| 29024 | 29307 | std::vector<std::tuple<mapscr*, bool, int, int>> screen_deltas; | |
| 29025 |
1/2✓ Branch 0 taken 29307 times.
✗ Branch 1 not taken.
|
29307 | screen_deltas.insert(screen_deltas.end(), old_screen_deltas.begin(), old_screen_deltas.end()); |
| 29026 |
1/2✓ Branch 0 taken 29307 times.
✗ Branch 1 not taken.
|
29307 | screen_deltas.insert(screen_deltas.end(), new_screen_deltas.begin(), new_screen_deltas.end()); |
| 29027 | |||
| 29028 |
2/2✓ Branch 0 taken 58978 times.
✓ Branch 1 taken 29307 times.
|
88285 | for (const auto& pair : screen_deltas) |
| 29029 | { | ||
| 29030 | 58978 | mapscr* base_scr = std::get<0>(pair); | |
| 29031 | 58978 | bool use_new_screens = std::get<1>(pair); | |
| 29032 | 58978 | int offx = std::get<2>(pair); | |
| 29033 | 58978 | int offy = std::get<3>(pair); | |
| 29034 | |||
| 29035 | 58978 | int screen = base_scr->screen; | |
| 29036 | 58978 | int map = base_scr->map; | |
| 29037 | |||
| 29038 |
1/2✓ Branch 0 taken 58978 times.
✗ Branch 1 not taken.
|
58978 | auto& nearby_screen = nearby_screens.screens.emplace_back(); |
| 29039 | 58978 | nearby_screen.screen = screen; | |
| 29040 | 58978 | nearby_screen.offx = offx; | |
| 29041 | 58978 | nearby_screen.offy = offy; | |
| 29042 | 58978 | nearby_screen.is_new = use_new_screens; | |
| 29043 | |||
| 29044 | 58978 | nearby_screen.screen_handles[0] = {base_scr, base_scr, screen, 0}; | |
| 29045 |
2/2✓ Branch 0 taken 353868 times.
✓ Branch 1 taken 58978 times.
|
412846 | for (int i = 1; i <= 6; i++) |
| 29046 | { | ||
| 29047 |
2/2✓ Branch 0 taken 176934 times.
✓ Branch 1 taken 176934 times.
|
530802 | mapscr* scr = use_new_screens ? |
| 29048 |
1/2✓ Branch 0 taken 176934 times.
✗ Branch 1 not taken.
|
176934 | get_scr_layer(map, screen, i) : |
| 29049 | 176934 | old_temporary_screens[screen*7 + i]; | |
| 29050 |
2/2✓ Branch 0 taken 82866 times.
✓ Branch 1 taken 271002 times.
|
353868 | nearby_screen.screen_handles[i] = {base_scr, scr->is_valid() ? scr : nullptr, screen, i}; |
| 29051 | 353868 | } | |
| 29052 | } | ||
| 29053 | |||
| 29054 | // When old/new screens are possibly overlapping, reduce the drawing clip used for new screens based on the old viewport. | ||
| 29055 |
2/2✓ Branch 0 taken 125 times.
✓ Branch 1 taken 29182 times.
|
29307 | if (nearby_screens.has_overlapping_screens) |
| 29056 | { | ||
| 29057 |
1/2✓ Branch 0 taken 125 times.
✗ Branch 1 not taken.
|
125 | rect_t old_rect = rect_t(old_viewport_start); |
| 29058 | |||
| 29059 | 125 | std::vector<rect_t> new_rects; | |
| 29060 |
2/2✓ Branch 0 taken 125 times.
✓ Branch 1 taken 342 times.
|
467 | for (const auto& nearby_screen : nearby_screens.screens) |
| 29061 | { | ||
| 29062 |
2/2✓ Branch 0 taken 167 times.
✓ Branch 1 taken 175 times.
|
342 | if (!nearby_screen.is_new) |
| 29063 | 175 | continue; | |
| 29064 | |||
| 29065 | rect_t rect; | ||
| 29066 | 167 | rect.l = nearby_screen.offx; | |
| 29067 | 167 | rect.r = nearby_screen.offx + 256; | |
| 29068 | 167 | rect.t = nearby_screen.offy; | |
| 29069 | 167 | rect.b = nearby_screen.offy + 176; | |
| 29070 |
1/2✓ Branch 0 taken 167 times.
✗ Branch 1 not taken.
|
167 | new_rects.push_back(rect); |
| 29071 | } | ||
| 29072 | |||
| 29073 |
1/2✓ Branch 0 taken 125 times.
✗ Branch 1 not taken.
|
125 | rect_t new_rect = new_rects.at(0); |
| 29074 |
2/2✓ Branch 0 taken 125 times.
✓ Branch 1 taken 42 times.
|
167 | for (int i = 1; i < new_rects.size(); i++) |
| 29075 |
1/2✓ Branch 0 taken 42 times.
✗ Branch 1 not taken.
|
42 | new_rect.union_with(new_rects[i]); |
| 29076 | |||
| 29077 |
3/4✓ Branch 0 taken 125 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 111 times.
✓ Branch 3 taken 14 times.
|
125 | if (new_rect.intersects_with(old_rect)) |
| 29078 | { | ||
| 29079 |
3/4✓ Branch 0 taken 2 times.
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
|
14 | if (scrolling_dir == right && new_rect.l < old_rect.r) |
| 29080 | 2 | new_rect.l = old_rect.r + 1; | |
| 29081 |
3/4✓ Branch 0 taken 2 times.
✓ Branch 1 taken 10 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
|
12 | else if (scrolling_dir == left && new_rect.r > old_rect.l) |
| 29082 | 2 | new_rect.r = old_rect.l - 1; | |
| 29083 |
3/4✓ Branch 0 taken 6 times.
✓ Branch 1 taken 4 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 6 times.
|
10 | else if (scrolling_dir == up && new_rect.b > old_rect.t) |
| 29084 | 6 | new_rect.b = old_rect.t - 1; | |
| 29085 |
2/4✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 4 times.
|
4 | else if (scrolling_dir == down && new_rect.t < old_rect.b) |
| 29086 | 4 | new_rect.t = old_rect.b + 1; | |
| 29087 | 14 | } | |
| 29088 | |||
| 29089 | 125 | nearby_screens.old_screens_rect = old_rect; | |
| 29090 | 125 | nearby_screens.new_screens_rect = new_rect; | |
| 29091 | 125 | } | |
| 29092 | |||
| 29093 | 29307 | return nearby_screens; | |
| 29094 |
1/2✓ Branch 0 taken 29307 times.
✗ Branch 1 not taken.
|
29307 | } |
| 29095 | |||
| 29096 | 26639392 | static void for_every_nearby_screen_during_scroll( | |
| 29097 | const nearby_scrolling_screens_t& nearby_screens, | ||
| 29098 | const std::function <void (screen_handles_t, int, int, int, bool)>& fn) | ||
| 29099 | { | ||
| 29100 |
2/2✓ Branch 0 taken 129282 times.
✓ Branch 1 taken 26510110 times.
|
26639392 | if (!nearby_screens.has_overlapping_screens) |
| 29101 | { | ||
| 29102 |
2/2✓ Branch 0 taken 53485252 times.
✓ Branch 1 taken 26510110 times.
|
79995362 | for (const auto& nearby_screen : nearby_screens.screens) |
| 29103 | 53485252 | fn(nearby_screen.screen_handles, nearby_screen.screen, nearby_screen.offx, nearby_screen.offy, nearby_screen.is_new); | |
| 29104 | 26510110 | return; | |
| 29105 | } | ||
| 29106 | |||
| 29107 | 129282 | int cl = framebuf->cl; | |
| 29108 | 129282 | int cr = framebuf->cr; | |
| 29109 | 129282 | int ct = framebuf->ct; | |
| 29110 | 129282 | int cb = framebuf->cb; | |
| 29111 | |||
| 29112 |
2/2✓ Branch 0 taken 129282 times.
✓ Branch 1 taken 395460 times.
|
524742 | for (const auto& nearby_screen : nearby_screens.screens) |
| 29113 | { | ||
| 29114 |
2/2✓ Branch 0 taken 191742 times.
✓ Branch 1 taken 203718 times.
|
395460 | auto& rect = nearby_screen.is_new ? nearby_screens.new_screens_rect : nearby_screens.old_screens_rect; |
| 29115 | 395460 | int l = rect.l - viewport.x; | |
| 29116 | 395460 | int t = rect.t - viewport.y + playing_field_offset; | |
| 29117 | 395460 | int r = rect.r - viewport.x; | |
| 29118 | 395460 | int b = rect.b - viewport.y + playing_field_offset; | |
| 29119 | 395460 | add_clip_rect(framebuf, l, t, r, b); | |
| 29120 | |||
| 29121 | 395460 | fn(nearby_screen.screen_handles, nearby_screen.screen, nearby_screen.offx, nearby_screen.offy, nearby_screen.is_new); | |
| 29122 | |||
| 29123 | 395460 | set_clip_rect(framebuf, cl, ct, cr, cb); | |
| 29124 | } | ||
| 29125 | 26639392 | } | |
| 29126 | |||
| 29127 | 23016 | static void scrollscr_handle_dark(mapscr* newscr, mapscr* oldscr, const nearby_scrolling_screens_t& nearby_screens) | |
| 29128 | { | ||
| 29129 | extern int dither_offx; | ||
| 29130 | extern int dither_offy; | ||
| 29131 | |||
| 29132 | 23016 | clear_darkroom_bitmaps(); | |
| 29133 | 23016 | set_clip_rect(framebuf, 0, playing_field_offset, 256, framebuf->h); | |
| 29134 | |||
| 29135 |
1/2✓ Branch 0 taken 23016 times.
✗ Branch 1 not taken.
|
70372 | for_every_nearby_screen_during_scroll(nearby_screens, [&](screen_handles_t screen_handles, int screen, int offx, int offy, bool is_new_screen) { |
| 29136 | 47356 | mapscr* base_scr = screen_handles[0].scr; | |
| 29137 |
2/2✓ Branch 0 taken 23656 times.
✓ Branch 1 taken 23700 times.
|
47356 | bool dark = is_new_screen ? is_dark(base_scr) : scrolling_is_dark(base_scr); |
| 29138 |
2/2✓ Branch 0 taken 42874 times.
✓ Branch 1 taken 4482 times.
|
47356 | if (!dark) |
| 29139 | { | ||
| 29140 | 4482 | offy += playing_field_offset; | |
| 29141 | 4482 | rectfill(darkscr_bmp, offx - viewport.x, offy - viewport.y, offx - viewport.x + 256 - 1, offy - viewport.y + 176 - 1, 0); | |
| 29142 | 4482 | rectfill(darkscr_bmp_trans, offx - viewport.x, offy - viewport.y, offx - viewport.x + 256 - 1, offy - viewport.y + 176 - 1, 0); | |
| 29143 | 4482 | } | |
| 29144 | 47356 | }); | |
| 29145 | |||
| 29146 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 23016 times.
|
70372 | for_every_nearby_screen_during_scroll(nearby_screens, [&](screen_handles_t screen_handles, int screen, int offx, int offy, bool is_new_screen) { |
| 29147 | 47356 | mapscr* base_scr = screen_handles[0].scr; | |
| 29148 | |||
| 29149 |
2/2✓ Branch 0 taken 23656 times.
✓ Branch 1 taken 23700 times.
|
47356 | dither_offx = is_new_screen ? -new_region_offset_x : 0; |
| 29150 |
2/2✓ Branch 0 taken 23656 times.
✓ Branch 1 taken 23700 times.
|
47356 | dither_offy = is_new_screen ? -new_region_offset_y : 0; |
| 29151 | 47356 | calc_darkroom_combos(base_scr, offx, offy + playing_field_offset); | |
| 29152 | |||
| 29153 |
2/2✓ Branch 0 taken 23656 times.
✓ Branch 1 taken 23700 times.
|
47356 | int offx2 = is_new_screen ? new_region_offset_x : 0; |
| 29154 |
2/2✓ Branch 0 taken 23656 times.
✓ Branch 1 taken 23700 times.
|
47356 | int offy2 = is_new_screen ? new_region_offset_y : 0; |
| 29155 | 47356 | calc_darkroom_ffcs(base_scr, offx2, offy2 + playing_field_offset); | |
| 29156 | 47356 | }); | |
| 29157 | |||
| 29158 | 23016 | Hero.calc_darkroom_hero(0, -playing_field_offset); | |
| 29159 | 23016 | dither_offx = 0; | |
| 29160 | 23016 | dither_offy = 0; | |
| 29161 | |||
| 29162 | 23016 | do_primitives(framebuf, SPLAYER_DARKROOM_UNDER); | |
| 29163 | 23016 | set_clip_rect(framebuf, 0, playing_field_offset, framebuf->w, framebuf->h); | |
| 29164 |
1/2✓ Branch 0 taken 23016 times.
✗ Branch 1 not taken.
|
23016 | if (hero_scr->flags9 & fDARK_DITHER) //dither the entire bitmap |
| 29165 | { | ||
| 29166 | ✗ | ditherblit(darkscr_bmp,darkscr_bmp,0,game->get_dither_type(),game->get_dither_arg()); | |
| 29167 | ✗ | ditherblit(darkscr_bmp_trans,darkscr_bmp_trans,0,game->get_dither_type(),game->get_dither_arg()); | |
| 29168 | ✗ | } | |
| 29169 | |||
| 29170 | 23016 | color_map = &trans_table2; | |
| 29171 |
2/2✓ Branch 0 taken 264 times.
✓ Branch 1 taken 22752 times.
|
23016 | if(hero_scr->flags9 & fDARK_TRANS) //draw the dark as transparent |
| 29172 | { | ||
| 29173 | 264 | draw_trans_sprite(framebuf, darkscr_bmp, 0, 0); | |
| 29174 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 264 times.
|
264 | if(get_qr(qr_NEWDARK_TRANS_STACKING)) |
| 29175 | 264 | draw_trans_sprite(framebuf, darkscr_bmp_trans, 0, 0); | |
| 29176 | 264 | } | |
| 29177 | else | ||
| 29178 | { | ||
| 29179 | 22752 | masked_blit(darkscr_bmp, framebuf, 0, 0, 0, 0, framebuf->w, framebuf->h); | |
| 29180 | 22752 | draw_trans_sprite(framebuf, darkscr_bmp_trans, 0, 0); | |
| 29181 | } | ||
| 29182 | 23016 | color_map = &trans_table; | |
| 29183 | |||
| 29184 | 23016 | set_clip_rect(framebuf, 0, 0, framebuf->w, framebuf->h); | |
| 29185 | 23016 | do_primitives(framebuf, SPLAYER_DARKROOM_OVER); | |
| 29186 | 23016 | } | |
| 29187 | |||
| 29188 | 18810847 | static void do_ffc_scroll_layer(BITMAP* dest, int layer, const nearby_scrolling_screens_t& nearby_screens, int xoff, int yoff) | |
| 29189 | { | ||
| 29190 |
2/2✓ Branch 0 taken 12779789 times.
✓ Branch 1 taken 6031058 times.
|
18810847 | if(!get_qr(qr_FFCSCROLL)) |
| 29191 | 12779789 | return; | |
| 29192 | // Draw all FFCs from the previous region. | ||
| 29193 |
2/2✓ Branch 0 taken 820223888 times.
✓ Branch 1 taken 6031058 times.
|
826254946 | for (int i = 0; i < FFCore.ScrollingScreensAll.size(); i += 7) |
| 29194 | { | ||
| 29195 | 820223888 | mapscr* scr = FFCore.ScrollingScreensAll[i]; | |
| 29196 |
2/2✓ Branch 0 taken 6619646 times.
✓ Branch 1 taken 813604242 times.
|
820223888 | if (!scr) |
| 29197 | 813604242 | continue; | |
| 29198 | |||
| 29199 | 6619646 | auto screen_handle = screen_handle_t{scr, scr, scr->screen, 0}; | |
| 29200 | 6619646 | do_ffc_layer(dest, layer, screen_handle, 0, 0); | |
| 29201 | 6619646 | } | |
| 29202 | |||
| 29203 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6031058 times.
|
18379438 | for_every_nearby_screen_during_scroll(nearby_screens, [&](screen_handles_t screen_handles, int screen, int offx, int offy, bool is_new_screen) { |
| 29204 |
2/2✓ Branch 0 taken 6176456 times.
✓ Branch 1 taken 6171924 times.
|
12348380 | if (!is_new_screen) |
| 29205 | 6176456 | return; | |
| 29206 | |||
| 29207 | 6171924 | do_ffc_layer(dest, layer, screen_handles[0], xoff, yoff); | |
| 29208 | 12348380 | }); | |
| 29209 | 18810847 | } | |
| 29210 | |||
| 29211 | 29307 | void HeroClass::scrollscr(int32_t scrolldir, int32_t dest_screen, int32_t destdmap) | |
| 29212 | { | ||
| 29213 |
2/4✓ Branch 0 taken 29307 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 29307 times.
|
29307 | if(action==freeze||action==sideswimfreeze) |
| 29214 | { | ||
| 29215 | ✗ | return; | |
| 29216 | } | ||
| 29217 | |||
| 29218 | // If on a slope in sideview mode, move along that slope a bit. | ||
| 29219 | 29307 | zfix sideview_scrolling_slope; | |
| 29220 |
2/2✓ Branch 0 taken 28404 times.
✓ Branch 1 taken 903 times.
|
29307 | if (sideview_mode()) |
| 29221 | { | ||
| 29222 | 903 | y+=2+0.0001_zf; | |
| 29223 | 903 | slope_info const& s = get_slope(this, true).get_info(); | |
| 29224 | 903 | y-=2+0.0001_zf; | |
| 29225 | |||
| 29226 | 903 | sideview_scrolling_slope = s.slope(); | |
| 29227 |
1/2✓ Branch 0 taken 903 times.
✗ Branch 1 not taken.
|
903 | if (sideview_scrolling_slope) |
| 29228 | { | ||
| 29229 | ✗ | int dx = 0; | |
| 29230 | ✗ | int dy = 0; | |
| 29231 | ✗ | if (scrolldir == left) | |
| 29232 | ✗ | dx = -1; | |
| 29233 | ✗ | else if (scrolldir == right) | |
| 29234 | ✗ | dx = 1; | |
| 29235 | ✗ | else if (scrolldir == up) | |
| 29236 | ✗ | dy = -1; | |
| 29237 | ✗ | else if (scrolldir == down) | |
| 29238 | ✗ | dy = 1; | |
| 29239 | |||
| 29240 | // "Ride" the slope for 16 pixels. | ||
| 29241 | ✗ | for (int i = 0; i < 16; i++) | |
| 29242 | { | ||
| 29243 | ✗ | if (scrolldir == left || scrolldir == right) | |
| 29244 | { | ||
| 29245 | ✗ | x += dx; | |
| 29246 | ✗ | y = s.getY(x + (sideview_scrolling_slope > 0 ? 0 : hit_width)) - hit_height; | |
| 29247 | ✗ | } | |
| 29248 | else | ||
| 29249 | { | ||
| 29250 | ✗ | x += 1 / sideview_scrolling_slope * dy; | |
| 29251 | ✗ | y = s.getY(x + (sideview_scrolling_slope > 0 ? 0 : hit_width)) - hit_height; | |
| 29252 | } | ||
| 29253 | |||
| 29254 | ✗ | herostep(); | |
| 29255 | ✗ | draw_screen(); | |
| 29256 | ✗ | advanceframe(true); | |
| 29257 | |||
| 29258 | // Check if the slope the player is on has changed. | ||
| 29259 | ✗ | y+=2+0.0001_zf; | |
| 29260 | ✗ | slope_info const& s = get_slope(this, true).get_info(); | |
| 29261 | ✗ | y-=2+0.0001_zf; | |
| 29262 | ✗ | sideview_scrolling_slope = s.slope(); | |
| 29263 | ✗ | if (!sideview_scrolling_slope) | |
| 29264 | ✗ | break; | |
| 29265 | ✗ | } | |
| 29266 | ✗ | } | |
| 29267 | 903 | } | |
| 29268 | |||
| 29269 |
2/4✓ Branch 0 taken 29307 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 29307 times.
|
29307 | if (viewport_mode != ViewportMode::CenterAndBound || get_viewport_sprite() != &Hero) |
| 29270 | { | ||
| 29271 | ✗ | set_viewport_sprite(&Hero); | |
| 29272 | ✗ | viewport_mode = ViewportMode::CenterAndBound; | |
| 29273 | ✗ | update_viewport(); | |
| 29274 | ✗ | } | |
| 29275 | |||
| 29276 | 29307 | bool overlay = false; | |
| 29277 |
2/4✓ Branch 0 taken 29307 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 29307 times.
|
29307 | if(scrolldir >= 0 && scrolldir <= 3) |
| 29278 | { | ||
| 29279 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 29307 times.
|
29307 | overlay = get_bit(&(cur_screen >= 128 ? special_warp_return_scr : origin_scr)->sidewarpoverlayflags, scrolldir) ? true : false; |
| 29280 | 29307 | } | |
| 29281 | |||
| 29282 | 29307 | int old_dmap = cur_dmap; | |
| 29283 |
2/2✓ Branch 0 taken 1087 times.
✓ Branch 1 taken 28220 times.
|
29307 | int new_dmap = destdmap >= 0 ? destdmap : cur_dmap; |
| 29284 | 29307 | int new_map = DMaps[new_dmap].map; | |
| 29285 | |||
| 29286 | 29307 | bool updatemusic = FFCore.can_dmap_change_music(destdmap); | |
| 29287 | 29307 | bool musicrevert = FFCore.music_update_flags & MUSIC_UPDATE_FLAG_REVERT; | |
| 29288 | |||
| 29289 |
3/4✓ Branch 0 taken 29195 times.
✓ Branch 1 taken 112 times.
✓ Branch 2 taken 29195 times.
✗ Branch 3 not taken.
|
29307 | if (!has_advanced_maze(origin_scr) && maze_enabled_sizewarp(origin_scr, scrolldir)) |
| 29290 | ✗ | return; // dowarp() was called | |
| 29291 | |||
| 29292 | 29307 | int original_destscr = dest_screen; | |
| 29293 |
2/2✓ Branch 0 taken 1089 times.
✓ Branch 1 taken 28218 times.
|
29307 | if (dest_screen == -1) |
| 29294 | { | ||
| 29295 | 28218 | dest_screen = current_screen; | |
| 29296 |
3/4✓ Branch 0 taken 28059 times.
✓ Branch 1 taken 159 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 28059 times.
|
28218 | if (checkmaze(origin_scr, false) && !edge_of_dmap(scrolldir)) { |
| 29297 | 28059 | dest_screen = screen_index_direction(dest_screen, (direction)scrolldir); | |
| 29298 | 28059 | } | |
| 29299 | 28218 | } | |
| 29300 | |||
| 29301 | 29307 | int old_region_scr_dx = region_scr_dx; | |
| 29302 | 29307 | int old_region_scr_dy = region_scr_dy; | |
| 29303 | 29307 | int old_world_w = world_w; | |
| 29304 | 29307 | int old_world_h = world_h; | |
| 29305 | 29307 | int old_original_playing_field_offset = original_playing_field_offset; | |
| 29306 | 29307 | viewport_t old_viewport = viewport; | |
| 29307 | 29307 | region_t old_region = cur_region; | |
| 29308 | |||
| 29309 | // Determine what the player position will be after scrolling (within the new screen's coordinate system), | ||
| 29310 | // and what the new viewport will be. | ||
| 29311 | viewport_t new_viewport; | ||
| 29312 | region_t new_region; | ||
| 29313 | int new_scr_dx, new_scr_dy; | ||
| 29314 | 59000 | auto calc_new_viewport_and_pos = [&](){ | |
| 29315 | 29693 | calculate_region(new_map, dest_screen, new_region, new_scr_dx, new_scr_dy); | |
| 29316 | |||
| 29317 | // These mark the top-left coordinate of the new region, in the old region's world coordinates. | ||
| 29318 | 29693 | new_region_offset_x = (new_region.origin_screen_x - old_region.origin_screen_x)*256; | |
| 29319 | 29693 | new_region_offset_y = (new_region.origin_screen_y - old_region.origin_screen_y)*176; | |
| 29320 | |||
| 29321 | 29693 | new_hero_x = 0; | |
| 29322 | 29693 | new_hero_y = 0; | |
| 29323 |
4/5✓ Branch 0 taken 6393 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8693 times.
✓ Branch 3 taken 6888 times.
✓ Branch 4 taken 7719 times.
|
29693 | switch (scrolldir) |
| 29324 | { | ||
| 29325 | case up: | ||
| 29326 | { | ||
| 29327 | 8693 | new_hero_x.val = (new_scr_dx - old_region_scr_dx) * 256 * 10000L + x.val; | |
| 29328 | 8693 | new_hero_y = new_region.height - 16; | |
| 29329 | } | ||
| 29330 | 8693 | break; | |
| 29331 | |||
| 29332 | case down: | ||
| 29333 | { | ||
| 29334 | 6393 | new_hero_x.val = (new_scr_dx - old_region_scr_dx) * 256 * 10000L + x.val; | |
| 29335 | 6393 | new_hero_y = 0; | |
| 29336 | } | ||
| 29337 | 6393 | break; | |
| 29338 | |||
| 29339 | case left: | ||
| 29340 | { | ||
| 29341 | 6888 | new_hero_x = new_region.width - 16; | |
| 29342 | 6888 | new_hero_y.val = (new_scr_dy - old_region_scr_dy) * 176 * 10000L + y.val; | |
| 29343 | } | ||
| 29344 | 6888 | break; | |
| 29345 | |||
| 29346 | case right: | ||
| 29347 | { | ||
| 29348 | 7719 | new_hero_x = 0; | |
| 29349 | 7719 | new_hero_y.val = (new_scr_dy - old_region_scr_dy) * 176 * 10000L + y.val; | |
| 29350 | } | ||
| 29351 | 7719 | break; | |
| 29352 | |||
| 29353 | // Should never happen ... | ||
| 29354 | default: | ||
| 29355 | { | ||
| 29356 | ✗ | abort(); | |
| 29357 | } | ||
| 29358 | } | ||
| 29359 | |||
| 29360 | 29693 | int new_hero_x_for_viewport = new_hero_x; | |
| 29361 | 29693 | int new_hero_y_for_viewport = new_hero_y; | |
| 29362 | |||
| 29363 | // If arriving in a whistle warp, the new viewport will be based on the warp destination instead. | ||
| 29364 |
2/2✓ Branch 0 taken 29568 times.
✓ Branch 1 taken 125 times.
|
29693 | if (HeroInOutgoingWhistleWarp()) |
| 29365 | { | ||
| 29366 | 125 | const mapscr* newscr = get_canonical_scr(new_map, dest_screen); | |
| 29367 | |||
| 29368 |
2/2✓ Branch 0 taken 42 times.
✓ Branch 1 taken 83 times.
|
125 | if(get_qr(qr_NOARRIVALPOINT)) |
| 29369 | 42 | new_hero_x_for_viewport=newscr->warpreturnx[0]; | |
| 29370 | 83 | else new_hero_x_for_viewport=newscr->warparrivalx; | |
| 29371 | 125 | new_hero_x_for_viewport += new_scr_dx*256; | |
| 29372 | |||
| 29373 |
2/2✓ Branch 0 taken 42 times.
✓ Branch 1 taken 83 times.
|
125 | if(get_qr(qr_NOARRIVALPOINT)) |
| 29374 | 42 | new_hero_y_for_viewport=newscr->warpreturny[0]; | |
| 29375 | 83 | else new_hero_y_for_viewport=newscr->warparrivaly; | |
| 29376 | 125 | new_hero_y_for_viewport += new_scr_dy*176; | |
| 29377 | 125 | } | |
| 29378 | |||
| 29379 | 29693 | new_viewport = {}; | |
| 29380 | 29693 | calculate_viewport(new_viewport, new_dmap, dest_screen, new_region.width, new_region.height, new_hero_x_for_viewport + Hero.txsz*16/2, new_hero_y_for_viewport + Hero.tysz*16/2); | |
| 29381 | |||
| 29382 | 29693 | scrolling_new_region = new_region; | |
| 29383 | 29693 | }; | |
| 29384 | 29307 | calc_new_viewport_and_pos(); | |
| 29385 | |||
| 29386 | 29307 | int step = get_scroll_step(scrolldir); | |
| 29387 | 29307 | int delay = get_scroll_delay(scrolldir); | |
| 29388 | |||
| 29389 | int scroll_counter, scroll_amount, dx, dy; | ||
| 29390 | int secondary_axis_alignment_amount; | ||
| 29391 | 58807 | auto calc_scroll_data = [&](){ | |
| 29392 | 29500 | int scroll_height = std::min(viewport.h, new_viewport.h); | |
| 29393 | 29500 | int scroll_width = std::min(viewport.w, new_viewport.w); | |
| 29394 |
4/4✓ Branch 0 taken 20919 times.
✓ Branch 1 taken 8581 times.
✓ Branch 2 taken 6337 times.
✓ Branch 3 taken 14582 times.
|
29500 | scroll_amount = scrolldir == up || scrolldir == down ? scroll_height : scroll_width; |
| 29395 | 29500 | scroll_counter = scroll_amount / step; | |
| 29396 |
1/2✓ Branch 0 taken 29500 times.
✗ Branch 1 not taken.
|
29500 | if (scroll_amount % step != 0) |
| 29397 | ✗ | scroll_counter++; | |
| 29398 | |||
| 29399 | 29500 | dx = 0; | |
| 29400 | 29500 | dy = 0; | |
| 29401 |
2/2✓ Branch 0 taken 20919 times.
✓ Branch 1 taken 8581 times.
|
29500 | if (scrolldir == up) dy = -1; |
| 29402 |
2/2✓ Branch 0 taken 23163 times.
✓ Branch 1 taken 6337 times.
|
29500 | if (scrolldir == down) dy = 1; |
| 29403 |
2/2✓ Branch 0 taken 22622 times.
✓ Branch 1 taken 6878 times.
|
29500 | if (scrolldir == left) dx = -1; |
| 29404 |
2/2✓ Branch 0 taken 21796 times.
✓ Branch 1 taken 7704 times.
|
29500 | if (scrolldir == right) dx = 1; |
| 29405 | |||
| 29406 | // Determine by how much we need to align to the new region's viewport. | ||
| 29407 | // This sets `secondary_axis_alignment_amount` to the number of pixels needed to adjust along the secondary axis | ||
| 29408 | // to move (the position of link relative to the display) from the old viewport to the new viewport. | ||
| 29409 | 29500 | int old_hero_screen_x = x.getInt() - old_viewport.x; | |
| 29410 | 29500 | int old_hero_screen_y = y.getInt() - old_viewport.y + old_original_playing_field_offset; | |
| 29411 | 29500 | int new_hero_screen_x = new_hero_x - new_viewport.x; | |
| 29412 | 29500 | int new_hero_screen_y = new_hero_y - new_viewport.y + (232 - new_viewport.h); | |
| 29413 |
2/2✓ Branch 0 taken 14582 times.
✓ Branch 1 taken 14918 times.
|
29500 | if (dx) secondary_axis_alignment_amount = new_hero_screen_y - old_hero_screen_y; |
| 29414 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14918 times.
|
14918 | else if (dy) secondary_axis_alignment_amount = new_hero_screen_x - old_hero_screen_x; |
| 29415 | ✗ | else secondary_axis_alignment_amount = 0; | |
| 29416 | |||
| 29417 |
2/2✓ Branch 0 taken 29375 times.
✓ Branch 1 taken 125 times.
|
29500 | if (HeroInOutgoingWhistleWarp()) secondary_axis_alignment_amount = 0; |
| 29418 | 29500 | }; | |
| 29419 | 29307 | calc_scroll_data(); | |
| 29420 | |||
| 29421 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 29307 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
29307 | bool isForceFaceUp = getOnSideviewLadder() && canSideviewLadder() && |
| 29422 | ✗ | !(jumping<0 || fall!=0 || fakefall!=0) && get_qr(qr_SIDEVIEWLADDER_FACEUP); | |
| 29423 |
1/2✓ Branch 0 taken 29307 times.
✗ Branch 1 not taken.
|
29307 | if (isForceFaceUp) dir = up; |
| 29424 | |||
| 29425 | 29307 | bool is_unsmooth_vertical_scrolling = | |
| 29426 |
4/4✓ Branch 0 taken 20838 times.
✓ Branch 1 taken 8469 times.
✓ Branch 2 taken 6281 times.
✓ Branch 3 taken 14557 times.
|
29307 | (scrolldir == up || scrolldir == down) && get_qr(qr_SMOOTHVERTICALSCROLLING) == 0; |
| 29427 | |||
| 29428 | 29307 | kill_enemy_sfx(); | |
| 29429 | 29307 | stop_sfx(QMisc.miscsfx[sfxLOWHEART]); | |
| 29430 | 29307 | FFCore.ScrollingData[SCROLLDATA_DIR] = scrolldir; | |
| 29431 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 8469 times.
✓ Branch 2 taken 6281 times.
✓ Branch 3 taken 6868 times.
✓ Branch 4 taken 7689 times.
|
29307 | switch(scrolldir) |
| 29432 | { | ||
| 29433 | case up: | ||
| 29434 | 8469 | FFCore.ScrollingData[SCROLLDATA_NX] = 0; | |
| 29435 | 8469 | FFCore.ScrollingData[SCROLLDATA_NY] = -176; | |
| 29436 | 8469 | break; | |
| 29437 | case down: | ||
| 29438 | 6281 | FFCore.ScrollingData[SCROLLDATA_NX] = 0; | |
| 29439 | 6281 | FFCore.ScrollingData[SCROLLDATA_NY] = 176; | |
| 29440 | 6281 | break; | |
| 29441 | case left: | ||
| 29442 | 6868 | FFCore.ScrollingData[SCROLLDATA_NX] = -256; | |
| 29443 | 6868 | FFCore.ScrollingData[SCROLLDATA_NY] = 0; | |
| 29444 | 6868 | break; | |
| 29445 | case right: | ||
| 29446 | 7689 | FFCore.ScrollingData[SCROLLDATA_NX] = 256; | |
| 29447 | 7689 | FFCore.ScrollingData[SCROLLDATA_NY] = 0; | |
| 29448 | 7689 | break; | |
| 29449 | } | ||
| 29450 | 29307 | FFCore.ScrollingData[SCROLLDATA_NEW_REGION_DELTA_X] = new_region_offset_x; | |
| 29451 | 29307 | FFCore.ScrollingData[SCROLLDATA_NEW_REGION_DELTA_Y] = new_region_offset_y; | |
| 29452 | 29307 | FFCore.ScrollingData[SCROLLDATA_NRX] = new_region_offset_x - viewport.x; | |
| 29453 | 29307 | FFCore.ScrollingData[SCROLLDATA_NRY] = new_region_offset_y - viewport.y; | |
| 29454 | 29307 | FFCore.ScrollingData[SCROLLDATA_ORX] = -viewport.x; | |
| 29455 | 29307 | FFCore.ScrollingData[SCROLLDATA_ORY] = -viewport.y; | |
| 29456 | |||
| 29457 | // Get the screen coords of the top-left of the screen we are scrolling away from. | ||
| 29458 | 117228 | auto [old_sx, old_sy] = translate_screen_coordinates_to_world(current_screen); | |
| 29459 | 29307 | FFCore.ScrollingData[SCROLLDATA_OX] = old_sx - viewport.x; | |
| 29460 | 29307 | FFCore.ScrollingData[SCROLLDATA_OY] = old_sy - viewport.y; | |
| 29461 | |||
| 29462 | 29307 | FFCore.ScrollingData[SCROLLDATA_NEW_SCREEN_X] = new_scr_dx * 256; | |
| 29463 | 29307 | FFCore.ScrollingData[SCROLLDATA_NEW_SCREEN_Y] = new_scr_dy * 176; | |
| 29464 | |||
| 29465 | 29307 | FFCore.ScrollingData[SCROLLDATA_OLD_SCREEN_X] = old_sx; | |
| 29466 | 29307 | FFCore.ScrollingData[SCROLLDATA_OLD_SCREEN_Y] = old_sy; | |
| 29467 | |||
| 29468 | 29307 | FFCore.ScrollingData[SCROLLDATA_NEW_HERO_X] = new_hero_x.getInt(); | |
| 29469 | 29307 | FFCore.ScrollingData[SCROLLDATA_NEW_HERO_Y] = new_hero_y.getInt(); | |
| 29470 | |||
| 29471 | 29307 | FFCore.ScrollingData[SCROLLDATA_OLD_HERO_X] = x.getInt(); | |
| 29472 | 29307 | FFCore.ScrollingData[SCROLLDATA_OLD_HERO_Y] = y.getInt(); | |
| 29473 | |||
| 29474 | 29307 | FFCore.ScrollingData[SCROLLDATA_NEW_REGION_SCREEN_WIDTH] = new_region.screen_width; | |
| 29475 | 29307 | FFCore.ScrollingData[SCROLLDATA_NEW_REGION_SCREEN_HEIGHT] = new_region.screen_height; | |
| 29476 | |||
| 29477 | 29307 | FFCore.ScrollingData[SCROLLDATA_OLD_REGION_SCREEN_WIDTH] = cur_region.screen_width; | |
| 29478 | 29307 | FFCore.ScrollingData[SCROLLDATA_OLD_REGION_SCREEN_HEIGHT] = cur_region.screen_height; | |
| 29479 | |||
| 29480 | 29307 | FFCore.ScrollingData[SCROLLDATA_NEW_VIEWPORT_WIDTH] = new_viewport.w; | |
| 29481 | 29307 | FFCore.ScrollingData[SCROLLDATA_NEW_VIEWPORT_HEIGHT] = new_viewport.h; | |
| 29482 | |||
| 29483 | 29307 | FFCore.ScrollingData[SCROLLDATA_OLD_VIEWPORT_WIDTH] = viewport.w; | |
| 29484 | 29307 | FFCore.ScrollingData[SCROLLDATA_OLD_VIEWPORT_HEIGHT] = viewport.h; | |
| 29485 | |||
| 29486 | 29307 | FFCore.ScrollingData[SCROLLDATA_NEW_VIEWPORT_X] = new_viewport.x; | |
| 29487 | 29307 | FFCore.ScrollingData[SCROLLDATA_NEW_VIEWPORT_Y] = new_viewport.y; | |
| 29488 | |||
| 29489 | 29307 | FFCore.ScrollingData[SCROLLDATA_OLD_VIEWPORT_X] = viewport.x; | |
| 29490 | 29307 | FFCore.ScrollingData[SCROLLDATA_OLD_VIEWPORT_Y] = viewport.y; | |
| 29491 | |||
| 29492 | 29307 | FFCore.clear_combo_scripts(); | |
| 29493 | |||
| 29494 | 29307 | conveyclk = 2; | |
| 29495 | 29307 | screenscrolling = true; | |
| 29496 | 29307 | scrolling_dir = (direction) scrolldir; | |
| 29497 | 29307 | scrolling_hero_screen = current_screen; | |
| 29498 | 29307 | scrolling_region = cur_region; | |
| 29499 | 29307 | scrolling_region_is_lit = region_is_lit; | |
| 29500 | |||
| 29501 | 29307 | int32_t scx = get_qr(qr_FASTDNGN) ? 30 : 0; | |
| 29502 |
2/2✓ Branch 0 taken 26729 times.
✓ Branch 1 taken 2578 times.
|
29307 | if(get_qr(qr_VERYFASTSCROLLING)) //just a minor adjustment. |
| 29503 | 2578 | scx = 32; //for sideview very fast screolling. | |
| 29504 | |||
| 29505 | 29307 | auto hero_x_before_scripts = x; | |
| 29506 | 29307 | auto hero_y_before_scripts = y; | |
| 29507 | |||
| 29508 | // Don't signal to scripts that scrolling has "started" (and thus all the Game->Scrolling variables are valid) | ||
| 29509 | // just yet. Store what we calculated and apply them after this next frame. | ||
| 29510 | // TODO(replays): update. And probably just move the calculation to after this frame renders (rather than cache). | ||
| 29511 |
11/20✓ Branch 0 taken 8 times.
✓ Branch 1 taken 29299 times.
✓ Branch 2 taken 29299 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 29299 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 29299 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 8 times.
✓ Branch 9 taken 29299 times.
✓ Branch 10 taken 8 times.
✓ Branch 11 taken 29299 times.
✓ Branch 12 taken 8 times.
✓ Branch 13 taken 29299 times.
✗ Branch 14 not taken.
✗ Branch 15 not taken.
✗ Branch 16 not taken.
✗ Branch 17 not taken.
✗ Branch 18 not taken.
✗ Branch 19 not taken.
|
58606 | bool crucible_quest_compat = replay_is_debug() && replay_get_meta_str("qst") == "crucible_quest.qst"; |
| 29512 | int cached_scrolling[SZ_SCROLLDATA]; | ||
| 29513 |
2/2✓ Branch 0 taken 220 times.
✓ Branch 1 taken 29087 times.
|
29307 | if (!crucible_quest_compat) |
| 29514 | { | ||
| 29515 |
2/2✓ Branch 0 taken 901697 times.
✓ Branch 1 taken 29087 times.
|
930784 | for (int i = 0; i < SZ_SCROLLDATA; i++) |
| 29516 | 901697 | cached_scrolling[i] = FFCore.ScrollingData[i]; | |
| 29517 | 29087 | memset(FFCore.ScrollingData, 0, sizeof(int32_t) * SZ_SCROLLDATA); | |
| 29518 | 29087 | FFCore.ScrollingData[SCROLLDATA_DIR] = -1; | |
| 29519 | 29087 | } | |
| 29520 | |||
| 29521 | // Wait one frame. This still uses the old region's coordinates. | ||
| 29522 | 29307 | int32_t lastattackclk = attackclk, lastspins = spins, lastcharging = charging; | |
| 29523 | 29307 | bool lasttapping = tapping; | |
| 29524 | 29307 | actiontype lastaction = action; | |
| 29525 | { | ||
| 29526 | 29307 | ALLOFF(false, false); | |
| 29527 | // for now, restore Hero's previous action | ||
| 29528 |
2/2✓ Branch 0 taken 26070 times.
✓ Branch 1 taken 3237 times.
|
29307 | if(!get_qr(qr_SCROLLING_KILLS_CHARGE)) |
| 29529 | 3237 | charging = lastcharging; | |
| 29530 |
2/2✓ Branch 0 taken 10597 times.
✓ Branch 1 taken 18710 times.
|
29307 | if (replay_version_check(0, 28)) |
| 29531 | { | ||
| 29532 | // nargads_trail_crystal_crusades replay tests need this. | ||
| 29533 |
2/2✓ Branch 0 taken 18436 times.
✓ Branch 1 taken 274 times.
|
18710 | if(!get_qr(qr_SCROLLING_KILLS_CHARGE)) attackclk = lastattackclk; |
| 29534 | 18710 | spins = lastspins; charging = lastcharging; tapping = lasttapping; | |
| 29535 | 18710 | } | |
| 29536 | |||
| 29537 | 29307 | action=lastaction; FFCore.setHeroAction(lastaction); | |
| 29538 | |||
| 29539 | 29307 | lstep = (lstep + 6) % 12; | |
| 29540 | 29307 | FFCore.runGenericPassiveEngine(SCR_TIMING_WAITDRAW); | |
| 29541 |
3/4✓ Branch 0 taken 29307 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 18377 times.
✓ Branch 3 taken 10930 times.
|
29307 | if((!( FFCore.system_suspend[susptGLOBALGAME] )) && FFCore.waitdraw(ScriptType::Global, GLOBAL_SCRIPT_GAME)) |
| 29542 | { | ||
| 29543 | 10930 | ZScriptVersion::RunScript(ScriptType::Global, GLOBAL_SCRIPT_GAME, GLOBAL_SCRIPT_GAME); | |
| 29544 | 10930 | FFCore.waitdraw(ScriptType::Global, GLOBAL_SCRIPT_GAME) = false; | |
| 29545 | 10930 | } | |
| 29546 | 29307 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_GLOBAL_WAITDRAW); | |
| 29547 |
5/6✓ Branch 0 taken 29296 times.
✓ Branch 1 taken 11 times.
✓ Branch 2 taken 1099 times.
✓ Branch 3 taken 28197 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 1099 times.
|
29307 | if ( (!( FFCore.system_suspend[susptHEROACTIVE] )) && FFCore.waitdraw(ScriptType::Hero) && FFCore.getQuestHeaderInfo(vZelda) >= 0x255 ) |
| 29548 | { | ||
| 29549 | 1099 | ZScriptVersion::RunScript(ScriptType::Hero, SCRIPT_HERO_ACTIVE); | |
| 29550 | 1099 | FFCore.waitdraw(ScriptType::Hero) = false; | |
| 29551 | 1099 | } | |
| 29552 | 29307 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_PLAYER_WAITDRAW); | |
| 29553 |
4/6✓ Branch 0 taken 29307 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 92 times.
✓ Branch 3 taken 29215 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 92 times.
|
29307 | if ( (!( FFCore.system_suspend[susptDMAPSCRIPT] )) && FFCore.waitdraw(ScriptType::DMap) && FFCore.getQuestHeaderInfo(vZelda) >= 0x255 ) |
| 29554 | { | ||
| 29555 | 92 | ZScriptVersion::RunScript(ScriptType::DMap, DMaps[cur_dmap].script,cur_dmap); | |
| 29556 | 92 | FFCore.waitdraw(ScriptType::DMap) = false; | |
| 29557 | 92 | } | |
| 29558 | 29307 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_DMAPDATA_ACTIVE_WAITDRAW); | |
| 29559 |
2/6✓ Branch 0 taken 29307 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 29307 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
29307 | if ( (!( FFCore.system_suspend[susptDMAPSCRIPT] )) && FFCore.waitdraw(ScriptType::ScriptedPassiveSubscreen) && FFCore.getQuestHeaderInfo(vZelda) >= 0x255 ) |
| 29560 | { | ||
| 29561 | ✗ | ZScriptVersion::RunScript(ScriptType::ScriptedPassiveSubscreen, DMaps[cur_dmap].passive_sub_script,cur_dmap); | |
| 29562 | ✗ | FFCore.waitdraw(ScriptType::ScriptedPassiveSubscreen) = false; | |
| 29563 | ✗ | } | |
| 29564 | 29307 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_DMAPDATA_PASSIVESUBSCREEN_WAITDRAW); | |
| 29565 | |||
| 29566 |
4/4✓ Branch 0 taken 4566 times.
✓ Branch 1 taken 24741 times.
✓ Branch 2 taken 10 times.
✓ Branch 3 taken 4556 times.
|
29307 | if (FFCore.getQuestHeaderInfo(vZelda) >= 0x255 && !FFCore.system_suspend[susptSCREENSCRIPTS]) |
| 29567 | { | ||
| 29568 | 9884 | for_every_base_screen_in_region([&](mapscr* scr, unsigned int region_scr_x, unsigned int region_scr_y) { | |
| 29569 |
4/4✓ Branch 0 taken 25 times.
✓ Branch 1 taken 5303 times.
✓ Branch 2 taken 11 times.
✓ Branch 3 taken 14 times.
|
5328 | if (scr->script != 0 && FFCore.waitdraw(ScriptType::Screen, scr->screen)) |
| 29570 | { | ||
| 29571 | 14 | ZScriptVersion::RunScript(ScriptType::Screen, scr->script, scr->screen); | |
| 29572 | 14 | FFCore.waitdraw(ScriptType::Screen, scr->screen) = 0; | |
| 29573 | 14 | } | |
| 29574 | 5328 | }); | |
| 29575 | 4556 | } | |
| 29576 | 29307 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_SCREEN_WAITDRAW); | |
| 29577 | |||
| 29578 | 891882 | for_every_ffc([&](const ffc_handle_t& ffc_handle) { | |
| 29579 |
4/4✓ Branch 0 taken 13252 times.
✓ Branch 1 taken 849323 times.
✓ Branch 2 taken 13228 times.
✓ Branch 3 taken 24 times.
|
862575 | if (ffc_handle.ffc->script != 0 && FFCore.waitdraw(ScriptType::FFC, ffc_handle.id)) |
| 29580 | { | ||
| 29581 | 24 | ZScriptVersion::RunScript(ScriptType::FFC, ffc_handle.ffc->script, ffc_handle.id); | |
| 29582 | 24 | FFCore.waitdraw(ScriptType::FFC, ffc_handle.id) = false; | |
| 29583 | 24 | } | |
| 29584 | 862575 | }); | |
| 29585 | |||
| 29586 | 29307 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_FFC_WAITDRAW); | |
| 29587 | 29307 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_COMBO_WAITDRAW); | |
| 29588 | //Waitdraw for item scripts. | ||
| 29589 | 29307 | FFCore.itemScriptEngineOnWaitdraw(); | |
| 29590 | 29307 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_ITEM_WAITDRAW); | |
| 29591 | 29307 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_NPC_WAITDRAW); | |
| 29592 | |||
| 29593 | //Sprite scripts on Waitdraw | ||
| 29594 | 29307 | FFCore.eweaponScriptEngineOnWaitdraw(); | |
| 29595 | 29307 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_EWPN_WAITDRAW); | |
| 29596 | 29307 | FFCore.itemSpriteScriptEngineOnWaitdraw(); | |
| 29597 | 29307 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_ITEMSPRITE_WAITDRAW); | |
| 29598 | |||
| 29599 | //This is no longer a do-while, as the first iteration is now slightly different. -Em | ||
| 29600 | 29307 | draw_screen(true,true); | |
| 29601 | |||
| 29602 | 29307 | rehydratelake(false); | |
| 29603 | |||
| 29604 | 29307 | FFCore.runGenericPassiveEngine(SCR_TIMING_END_FRAME); | |
| 29605 | } | ||
| 29606 | |||
| 29607 | 29307 | advanceframe(true); | |
| 29608 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 29307 times.
|
29307 | if(Quit) |
| 29609 | { | ||
| 29610 | ✗ | screenscrolling = false; | |
| 29611 | ✗ | return; | |
| 29612 | } | ||
| 29613 | |||
| 29614 |
2/2✓ Branch 0 taken 220 times.
✓ Branch 1 taken 29087 times.
|
29307 | if (!crucible_quest_compat) |
| 29615 | { | ||
| 29616 |
2/2✓ Branch 0 taken 901697 times.
✓ Branch 1 taken 29087 times.
|
930784 | for (int i = 0; i < SZ_SCROLLDATA; i++) |
| 29617 | 901697 | FFCore.ScrollingData[i] = cached_scrolling[i]; | |
| 29618 | 29087 | } | |
| 29619 | |||
| 29620 | // cur_dmap won't change until the end of the scroll. Store new dmap in this global variable. | ||
| 29621 | 29307 | scrolling_destdmap = new_dmap; | |
| 29622 | |||
| 29623 | // Calling functions are responsible for setting cur_map (but not cur_screen...), but before we | ||
| 29624 | // _actually_ start to scroll we draw a few frames of the current screen (draw_screen). So we | ||
| 29625 | // need cur_map to be the old value initially. Callers also set the old map value to | ||
| 29626 | // `scrolling_map`, so we can use that. | ||
| 29627 | 29307 | int destmap = cur_map; | |
| 29628 | 29307 | cur_map = scrolling_map; | |
| 29629 | |||
| 29630 | // This adjusts how drawing commands are interpreted in `do_drawing_command`. | ||
| 29631 | // Currently, since only one set of screen scripts/item scripts/etc. can run at a time during | ||
| 29632 | // scrolling (either the old screens, which was above and this next "waiting" phase, or the new | ||
| 29633 | // screens, which comes after this next part) - a boolean is enough to capture this. If this | ||
| 29634 | // changes, we need to vary this behavior based on "is this from the new or old set of screens?" | ||
| 29635 | 29307 | scrolling_using_new_region_coords = true; | |
| 29636 | |||
| 29637 | // Wait at least one frame, possibly 32. | ||
| 29638 | // These frames will use the new region's coordinates. | ||
| 29639 | { | ||
| 29640 | 29307 | int wait_counter = scx + 1; | |
| 29641 |
2/2✓ Branch 0 taken 140459 times.
✓ Branch 1 taken 29307 times.
|
169766 | while (wait_counter < 32) |
| 29642 | { | ||
| 29643 |
1/2✓ Branch 0 taken 140459 times.
✗ Branch 1 not taken.
|
140459 | if(isForceFaceUp) dir = up; |
| 29644 |
2/2✓ Branch 0 taken 2096 times.
✓ Branch 1 taken 138363 times.
|
140459 | if(get_qr(qr_FIXSCRIPTSDURINGSCROLLING)) |
| 29645 | { | ||
| 29646 | 2096 | script_drawing_commands.Clear(); | |
| 29647 | 2096 | FFCore.runGenericPassiveEngine(SCR_TIMING_START_FRAME); | |
| 29648 | 2096 | ZScriptVersion::RunScrollingScript(scrolldir, wait_counter, 0, 0, false, false); // Prewaitdraw | |
| 29649 | 2096 | ZScriptVersion::RunScrollingScript(scrolldir, wait_counter, 0, 0, false, true); // Waitdraw | |
| 29650 | 2096 | } | |
| 29651 | 138363 | else FFCore.runGenericPassiveEngine(SCR_TIMING_START_FRAME); | |
| 29652 | 140459 | draw_screen(true,true); | |
| 29653 | |||
| 29654 |
1/2✓ Branch 0 taken 140459 times.
✗ Branch 1 not taken.
|
140459 | if (wait_counter == scx) |
| 29655 | ✗ | rehydratelake(false); | |
| 29656 | |||
| 29657 | 140459 | FFCore.runGenericPassiveEngine(SCR_TIMING_END_FRAME); | |
| 29658 | 140459 | advanceframe(true); | |
| 29659 | |||
| 29660 |
1/2✓ Branch 0 taken 140459 times.
✗ Branch 1 not taken.
|
140459 | if(Quit) |
| 29661 | { | ||
| 29662 | ✗ | screenscrolling = false; | |
| 29663 | ✗ | return; | |
| 29664 | } | ||
| 29665 | |||
| 29666 | 140459 | ++wait_counter; | |
| 29667 | } | ||
| 29668 | } | ||
| 29669 | |||
| 29670 | 29307 | script_drawing_commands.Clear(); | |
| 29671 | 29307 | FFCore.runGenericPassiveEngine(SCR_TIMING_START_FRAME); | |
| 29672 | |||
| 29673 | // Just trying to play the sound. | ||
| 29674 |
2/2✓ Branch 0 taken 28218 times.
✓ Branch 1 taken 1089 times.
|
29307 | if (original_destscr == -1) |
| 29675 | 28218 | checkmaze(origin_scr, true); | |
| 29676 | |||
| 29677 |
3/4✓ Branch 0 taken 13067 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 7560 times.
✓ Branch 3 taken 8680 times.
|
29307 | switch(DMaps[cur_dmap].type&dmfTYPE) |
| 29678 | { | ||
| 29679 | case dmDNGN: | ||
| 29680 |
2/2✓ Branch 0 taken 8673 times.
✓ Branch 1 taken 7 times.
|
8680 | if(!get_qr(qr_DUNGEONS_USE_CLASSIC_CHARTING)) |
| 29681 | { | ||
| 29682 | 7 | markBmap(scrolldir, current_screen); | |
| 29683 | 7 | } | |
| 29684 | 8680 | break; | |
| 29685 | case dmOVERW: case dmBSOVERW: | ||
| 29686 |
2/2✓ Branch 0 taken 12016 times.
✓ Branch 1 taken 1051 times.
|
13067 | if(get_qr(qr_NO_OVERWORLD_MAP_CHARTING)) |
| 29687 | 12016 | break; | |
| 29688 | [[fallthrough]]; | ||
| 29689 | case dmCAVE: | ||
| 29690 | 8611 | markBmap(scrolldir, current_screen); | |
| 29691 | 8611 | break; | |
| 29692 | } | ||
| 29693 | |||
| 29694 | // Remember everything about the current region, because `loadscr` is about to reset this data. | ||
| 29695 | 29307 | std::vector<mapscr*> old_temporary_screens; | |
| 29696 |
1/2✓ Branch 0 taken 29307 times.
✗ Branch 1 not taken.
|
29307 | old_temporary_screens = take_temporary_scrs(); |
| 29697 |
1/2✓ Branch 0 taken 29307 times.
✗ Branch 1 not taken.
|
29307 | FFCore.ScrollingScreensAll = old_temporary_screens; |
| 29698 | 29307 | cur_map = destmap; | |
| 29699 | |||
| 29700 |
1/2✓ Branch 0 taken 29307 times.
✗ Branch 1 not taken.
|
29307 | loadscr(destdmap, dest_screen, scrolldir, overlay); |
| 29701 | 29307 | mapscr* oldscr = old_temporary_screens[scrolling_hero_screen * 7]; | |
| 29702 |
1/2✓ Branch 0 taken 29307 times.
✗ Branch 1 not taken.
|
29307 | mapscr* newscr = get_scr(destmap, dest_screen); |
| 29703 | |||
| 29704 | // Start scrolling with the previous pfo, and adjust during scrolling if necessary. | ||
| 29705 | 29307 | int new_playing_field_offset = playing_field_offset; | |
| 29706 | 29307 | playing_field_offset = old_original_playing_field_offset; | |
| 29707 | |||
| 29708 | // We must recalculate the new hero position and viewport, if a script run above just change the | ||
| 29709 | // hero position. | ||
| 29710 |
10/16✓ Branch 0 taken 29307 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 29307 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 29307 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 29277 times.
✓ Branch 7 taken 30 times.
✓ Branch 8 taken 29277 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 29277 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 29277 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 163 times.
✓ Branch 15 taken 29114 times.
|
29307 | if (hero_x_before_scripts != x || hero_y_before_scripts != y) |
| 29711 | { | ||
| 29712 |
1/2✓ Branch 0 taken 193 times.
✗ Branch 1 not taken.
|
193 | calc_new_viewport_and_pos(); |
| 29713 |
1/2✓ Branch 0 taken 193 times.
✗ Branch 1 not taken.
|
193 | calc_scroll_data(); |
| 29714 | |||
| 29715 | 193 | FFCore.ScrollingData[SCROLLDATA_NEW_VIEWPORT_X] = new_viewport.x; | |
| 29716 | 193 | FFCore.ScrollingData[SCROLLDATA_NEW_VIEWPORT_Y] = new_viewport.y; | |
| 29717 | |||
| 29718 | 193 | FFCore.ScrollingData[SCROLLDATA_OLD_VIEWPORT_X] = viewport.x; | |
| 29719 | 193 | FFCore.ScrollingData[SCROLLDATA_OLD_VIEWPORT_Y] = viewport.y; | |
| 29720 | |||
| 29721 |
1/2✓ Branch 0 taken 193 times.
✗ Branch 1 not taken.
|
193 | FFCore.ScrollingData[SCROLLDATA_NEW_HERO_X] = new_hero_x.getInt(); |
| 29722 |
1/2✓ Branch 0 taken 193 times.
✗ Branch 1 not taken.
|
193 | FFCore.ScrollingData[SCROLLDATA_NEW_HERO_Y] = new_hero_y.getInt(); |
| 29723 | 193 | } | |
| 29724 | |||
| 29725 | // 0 for change playing field offset, then scroll. | ||
| 29726 | // 1 for scroll, then change playing field offset. | ||
| 29727 | 29307 | int pfo_mode = 0; | |
| 29728 | |||
| 29729 |
2/2✓ Branch 0 taken 6281 times.
✓ Branch 1 taken 23026 times.
|
29307 | if (dy == 1) |
| 29730 | 6281 | pfo_mode = 0; | |
| 29731 |
2/2✓ Branch 0 taken 14557 times.
✓ Branch 1 taken 8469 times.
|
23026 | else if (dy == -1) |
| 29732 | 8469 | pfo_mode = 1; | |
| 29733 |
5/6✓ Branch 0 taken 14511 times.
✓ Branch 1 taken 46 times.
✓ Branch 2 taken 14511 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 14481 times.
✓ Branch 5 taken 30 times.
|
14557 | else if (old_region_scr_dy == 0 && sign(new_playing_field_offset - old_original_playing_field_offset) == -1) |
| 29734 | 30 | pfo_mode = 1; | |
| 29735 | |||
| 29736 | 29307 | int pfo_counter = abs(new_playing_field_offset - old_original_playing_field_offset); | |
| 29737 | |||
| 29738 | // When scrolling up/down, and if scrolling first and the final pfo is less, reduce the scroll distance. | ||
| 29739 |
6/6✓ Branch 0 taken 14750 times.
✓ Branch 1 taken 14557 times.
✓ Branch 2 taken 8469 times.
✓ Branch 3 taken 6281 times.
✓ Branch 4 taken 8467 times.
✓ Branch 5 taken 2 times.
|
29307 | if (dy && pfo_mode == 1 && new_playing_field_offset > old_original_playing_field_offset) |
| 29740 | { | ||
| 29741 | 2 | scroll_amount += new_playing_field_offset - old_original_playing_field_offset; | |
| 29742 | 2 | scroll_counter = scroll_amount / step; | |
| 29743 | 2 | } | |
| 29744 | |||
| 29745 | // If adjusting pfo first and the final pfo is more, increase the scroll distance. | ||
| 29746 | // Also make the pfo adjust instantly. | ||
| 29747 |
6/6✓ Branch 0 taken 14750 times.
✓ Branch 1 taken 14557 times.
✓ Branch 2 taken 6281 times.
✓ Branch 3 taken 8469 times.
✓ Branch 4 taken 6279 times.
✓ Branch 5 taken 2 times.
|
29307 | if (dy && pfo_mode == 0 && new_playing_field_offset < old_original_playing_field_offset) |
| 29748 | { | ||
| 29749 | 2 | scroll_amount -= new_playing_field_offset - old_original_playing_field_offset; | |
| 29750 | 2 | scroll_counter = scroll_amount / step; | |
| 29751 | 2 | pfo_counter = 1; | |
| 29752 | 2 | } | |
| 29753 | |||
| 29754 | viewport_t old_world_rect; | ||
| 29755 | 29307 | old_world_rect.x = 0; | |
| 29756 | 29307 | old_world_rect.y = 0; | |
| 29757 | 29307 | old_world_rect.w = old_world_w; | |
| 29758 | 29307 | old_world_rect.h = old_world_h; | |
| 29759 | |||
| 29760 | viewport_t new_world_rect; | ||
| 29761 | 29307 | new_world_rect.x = 0; | |
| 29762 | 29307 | new_world_rect.y = 0; | |
| 29763 | 29307 | new_world_rect.w = world_w; | |
| 29764 | 29307 | new_world_rect.h = world_h; | |
| 29765 | |||
| 29766 | // 0 for align, then scroll. | ||
| 29767 | // 1 for scroll, then align. | ||
| 29768 | 29307 | int align_mode = 0; | |
| 29769 | 29307 | int align_counter = abs(secondary_axis_alignment_amount); | |
| 29770 | // Align first, unless that would show screens outside the old region. | ||
| 29771 |
2/2✓ Branch 0 taken 29229 times.
✓ Branch 1 taken 78 times.
|
29307 | if (align_counter) |
| 29772 | { | ||
| 29773 | 78 | viewport_t old_viewport_aligned = old_viewport; | |
| 29774 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 68 times.
|
78 | old_viewport_aligned.x -= (dy ? secondary_axis_alignment_amount : 0); |
| 29775 |
2/2✓ Branch 0 taken 68 times.
✓ Branch 1 taken 10 times.
|
78 | old_viewport_aligned.y -= (dx ? secondary_axis_alignment_amount : 0); |
| 29776 | // The playing field offset is changed before aligning, so apply the delta in this check. | ||
| 29777 |
2/2✓ Branch 0 taken 28 times.
✓ Branch 1 taken 50 times.
|
78 | if (pfo_mode == 0) |
| 29778 | 50 | old_viewport_aligned.y += new_playing_field_offset - old_original_playing_field_offset; | |
| 29779 |
3/4✓ Branch 0 taken 78 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 34 times.
✓ Branch 3 taken 44 times.
|
78 | if (old_world_rect.contains_or_on(old_viewport_aligned)) |
| 29780 | 34 | align_mode = 0; | |
| 29781 | else | ||
| 29782 | 44 | align_mode = 1; | |
| 29783 | 78 | } | |
| 29784 | |||
| 29785 | // Determine the area that will be visible in the old and the new regions, | ||
| 29786 | // taking into account any possible alignment. All screens within these | ||
| 29787 | // area will be fetched by get_nearby_scrolling_screens. | ||
| 29788 |
1/2✓ Branch 0 taken 29307 times.
✗ Branch 1 not taken.
|
29307 | rect_t old_region_visible = rect_t(old_viewport); |
| 29789 |
1/2✓ Branch 0 taken 29307 times.
✗ Branch 1 not taken.
|
29307 | rect_t new_region_visible = rect_t(new_viewport); |
| 29790 |
2/2✓ Branch 0 taken 29229 times.
✓ Branch 1 taken 78 times.
|
29307 | if (secondary_axis_alignment_amount) |
| 29791 | { | ||
| 29792 |
2/2✓ Branch 0 taken 44 times.
✓ Branch 1 taken 34 times.
|
78 | rect_t& r = align_mode == 0 ? old_region_visible : new_region_visible; |
| 29793 |
2/2✓ Branch 0 taken 44 times.
✓ Branch 1 taken 34 times.
|
78 | int delta = align_mode == 0 ? -secondary_axis_alignment_amount : secondary_axis_alignment_amount; |
| 29794 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 68 times.
|
78 | if (dy) |
| 29795 | { | ||
| 29796 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 2 times.
|
10 | if (delta > 0) |
| 29797 | 8 | r.r += delta; | |
| 29798 | else | ||
| 29799 | 2 | r.l += delta; | |
| 29800 | 10 | } | |
| 29801 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 68 times.
|
68 | else if (dx) |
| 29802 | { | ||
| 29803 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 52 times.
|
68 | if (delta > 0) |
| 29804 | 16 | r.b += delta; | |
| 29805 | else | ||
| 29806 | 52 | r.t += delta; | |
| 29807 | 68 | } | |
| 29808 | 78 | } | |
| 29809 | |||
| 29810 |
2/4✓ Branch 0 taken 29307 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 29307 times.
✗ Branch 3 not taken.
|
29307 | old_region_visible.intersect_with(rect_t(old_world_rect)); |
| 29811 |
2/4✓ Branch 0 taken 29307 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 29307 times.
✗ Branch 3 not taken.
|
29307 | new_region_visible.intersect_with(rect_t(new_world_rect)); |
| 29812 | |||
| 29813 | // For the duration of the scrolling, the old region coordinate system is used for all drawing | ||
| 29814 | // operations. This means that the new screens are drawn with offsets relative to the old | ||
| 29815 | // coordinate system. These offsets are determined in get_nearby_scrolling_screens. | ||
| 29816 |
1/2✓ Branch 0 taken 29307 times.
✗ Branch 1 not taken.
|
29307 | auto nearby_screens = get_nearby_scrolling_screens(old_temporary_screens, old_viewport, new_viewport, old_region_visible, new_region_visible); |
| 29817 | |||
| 29818 |
2/2✓ Branch 0 taken 6868 times.
✓ Branch 1 taken 22439 times.
|
29307 | int sx = viewport.x + (scrolldir == left ? viewport.w : 0); |
| 29819 |
2/2✓ Branch 0 taken 20838 times.
✓ Branch 1 taken 8469 times.
|
29307 | int sy = viewport.y + (scrolldir == up ? viewport.h : 0); |
| 29820 |
2/2✓ Branch 0 taken 28626 times.
✓ Branch 1 taken 681 times.
|
29307 | if (is_unsmooth_vertical_scrolling) sy += 3; |
| 29821 | |||
| 29822 | // We must recalculate the new hero position, if a script run above just change the | ||
| 29823 | // hero position. | ||
| 29824 |
8/14✓ Branch 0 taken 29307 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 29307 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 29307 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 29277 times.
✓ Branch 7 taken 30 times.
✓ Branch 8 taken 29277 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 29277 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 29277 times.
✗ Branch 13 not taken.
|
29307 | if (hero_x_before_scripts != x || hero_y_before_scripts != y) |
| 29825 | { | ||
| 29826 |
2/2✓ Branch 0 taken 193 times.
✓ Branch 1 taken 29114 times.
|
29307 | calc_new_viewport_and_pos(); |
| 29827 | |||
| 29828 |
1/2✓ Branch 0 taken 193 times.
✗ Branch 1 not taken.
|
193 | FFCore.ScrollingData[SCROLLDATA_NEW_HERO_X] = new_hero_x.getInt(); |
| 29829 |
1/2✓ Branch 0 taken 193 times.
✗ Branch 1 not taken.
|
193 | FFCore.ScrollingData[SCROLLDATA_NEW_HERO_Y] = new_hero_y.getInt(); |
| 29830 | 193 | } | |
| 29831 | |||
| 29832 | // change Hero's state if entering water | ||
| 29833 |
6/10✓ Branch 0 taken 29307 times.
✓ Branch 1 taken 29114 times.
✓ Branch 2 taken 29307 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 29307 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 29307 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 29307 times.
✗ Branch 9 not taken.
|
193 | int32_t ahead = lookahead(scrolldir, new_hero_x, new_hero_y + 8); |
| 29834 |
7/14✓ Branch 0 taken 29307 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 29307 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 29307 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 29307 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 29307 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 29307 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 29307 times.
✗ Branch 13 not taken.
|
29307 | auto [lookaheadx, lookaheady] = lookahead_coords(scrolldir, new_hero_x + 8, new_hero_y + (bigHitbox?8:12)); |
| 29835 |
7/14✓ Branch 0 taken 29307 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 29307 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 29307 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 29307 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 29307 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 29307 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 29307 times.
✗ Branch 13 not taken.
|
86759 | auto [wateraheadx1, wateraheady1] = lookahead_coords(scrolldir, new_hero_x + 4, new_hero_y + 9); |
| 29836 |
7/14✓ Branch 0 taken 29307 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 29307 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 29307 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 29307 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 29307 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 29307 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 29307 times.
✗ Branch 13 not taken.
|
30067 | auto [wateraheadx2, wateraheady2] = lookahead_coords(scrolldir, new_hero_x + 11, new_hero_y + 15); |
| 29837 | |||
| 29838 | 29307 | bool nowinwater = false; | |
| 29839 | { | ||
| 29840 |
2/2✓ Branch 0 taken 125 times.
✓ Branch 1 taken 29182 times.
|
29307 | if(lastaction != inwind) |
| 29841 | { | ||
| 29842 |
2/2✓ Branch 0 taken 456 times.
✓ Branch 1 taken 28726 times.
|
29182 | if(lastaction == rafting ) //&& isRaftFlag(aheadflag)) |
| 29843 | { | ||
| 29844 |
5/8✓ Branch 0 taken 456 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 456 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 456 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 440 times.
✓ Branch 7 taken 16 times.
|
456 | if (lookaheadraftflag(scrolldir, new_hero_x, new_hero_y)) |
| 29845 | { | ||
| 29846 |
1/2✓ Branch 0 taken 440 times.
✗ Branch 1 not taken.
|
440 | action=rafting; FFCore.setHeroAction(rafting); |
| 29847 | 440 | raftclk=0; | |
| 29848 | 440 | } | |
| 29849 | 456 | } | |
| 29850 |
13/20✓ Branch 0 taken 28726 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 28726 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 28726 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 380 times.
✓ Branch 7 taken 28346 times.
✓ Branch 8 taken 380 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 380 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 380 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 373 times.
✓ Branch 15 taken 7 times.
✓ Branch 16 taken 373 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 348 times.
✓ Branch 19 taken 25 times.
|
86178 | else if(iswaterex_z3(ahead, -1, wateraheadx1,wateraheady1) && iswaterex_z3(ahead, -1, wateraheadx2,wateraheady2) && (current_item(itype_flippers))) |
| 29851 | { | ||
| 29852 |
9/16✓ Branch 0 taken 20 times.
✓ Branch 1 taken 328 times.
✓ Branch 2 taken 20 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 20 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 20 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 20 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 20 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 20 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 20 times.
✗ Branch 15 not taken.
|
348 | if(lastaction==swimming || lastaction == sideswimming || lastaction == sideswimattacking || lastaction == sideswimhit || lastaction == swimhit || lastaction == sideswimcasting || lastaction == sidewaterhold1 || lastaction == sidewaterhold2) |
| 29853 | { | ||
| 29854 |
1/2✓ Branch 0 taken 328 times.
✗ Branch 1 not taken.
|
328 | SetSwim(); |
| 29855 | 328 | hopclk = 0xFF; | |
| 29856 | 328 | nowinwater = true; | |
| 29857 | 328 | } | |
| 29858 | else | ||
| 29859 | { | ||
| 29860 |
1/2✓ Branch 0 taken 20 times.
✗ Branch 1 not taken.
|
20 | action=hopping; FFCore.setHeroAction(hopping); |
| 29861 | 20 | hopclk = 2; | |
| 29862 | 20 | nowinwater = true; | |
| 29863 | } | ||
| 29864 | 348 | } | |
| 29865 |
4/4✓ Branch 0 taken 28326 times.
✓ Branch 1 taken 52 times.
✓ Branch 2 taken 36 times.
✓ Branch 3 taken 28342 times.
|
28378 | else if((lastaction == attacking || lastaction == sideswimattacking) && charging) |
| 29866 | { | ||
| 29867 |
1/2✓ Branch 0 taken 36 times.
✗ Branch 1 not taken.
|
36 | action = lastaction; FFCore.setHeroAction(lastaction); |
| 29868 | 36 | } | |
| 29869 | else | ||
| 29870 | { | ||
| 29871 |
1/2✓ Branch 0 taken 28342 times.
✗ Branch 1 not taken.
|
28342 | action=none; FFCore.setHeroAction(none); |
| 29872 | } | ||
| 29873 | 29182 | } | |
| 29874 |
2/4✓ Branch 0 taken 125 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 125 times.
|
125 | else if((lastaction == attacking || lastaction == sideswimattacking) && charging) |
| 29875 | { | ||
| 29876 | ✗ | action = lastaction; FFCore.setHeroAction(lastaction); | |
| 29877 | ✗ | } | |
| 29878 | else | ||
| 29879 | { | ||
| 29880 |
1/2✓ Branch 0 taken 125 times.
✗ Branch 1 not taken.
|
125 | action=none; FFCore.setHeroAction(none); |
| 29881 | } | ||
| 29882 | |||
| 29883 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 29307 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
29307 | isForceFaceUp = isForceFaceUp && canSideviewLadderRemote(lookaheadx,lookaheady); |
| 29884 | |||
| 29885 | // The naturaldark state can be read/set by an FFC script before | ||
| 29886 | // fade() or lighting() is called. | ||
| 29887 |
3/4✓ Branch 0 taken 25737 times.
✓ Branch 1 taken 3570 times.
✓ Branch 2 taken 25737 times.
✗ Branch 3 not taken.
|
55044 | naturaldark = !get_qr(qr_NEW_DARKROOM) && is_dark(newscr); |
| 29888 | |||
| 29889 |
3/4✓ Branch 0 taken 566 times.
✓ Branch 1 taken 28741 times.
✓ Branch 2 taken 566 times.
✗ Branch 3 not taken.
|
29307 | if(newscr->oceansfx != oldscr->oceansfx) adjust_sfx(oldscr->oceansfx, 128, false); |
| 29890 | |||
| 29891 |
3/4✓ Branch 0 taken 455 times.
✓ Branch 1 taken 28852 times.
✓ Branch 2 taken 455 times.
✗ Branch 3 not taken.
|
29307 | if(newscr->bosssfx != oldscr->bosssfx) adjust_sfx(oldscr->bosssfx, 128, false); |
| 29892 | |||
| 29893 | //Preloaded ffc scripts | ||
| 29894 | { | ||
| 29895 | // Kludge | ||
| 29896 | 29307 | cur_dmap = new_dmap; | |
| 29897 |
1/2✓ Branch 0 taken 29307 times.
✗ Branch 1 not taken.
|
29307 | ffscript_engine(true); |
| 29898 | 29307 | cur_dmap = old_dmap; | |
| 29899 | } | ||
| 29900 | |||
| 29901 | // There are two occasions when scrolling must be darkened: | ||
| 29902 | // 1) When scrolling into a dark room. | ||
| 29903 | // 2) When scrolling between DMaps of different colours. | ||
| 29904 |
4/4✓ Branch 0 taken 1087 times.
✓ Branch 1 taken 28220 times.
✓ Branch 2 taken 548 times.
✓ Branch 3 taken 539 times.
|
29307 | if(destdmap != -1 && DMaps[destdmap].color != currcset) |
| 29905 | { | ||
| 29906 |
2/4✗ Branch 0 not taken.
✓ Branch 1 taken 539 times.
✓ Branch 2 taken 539 times.
✗ Branch 3 not taken.
|
539 | fade((specialcave > 0) ? (specialcave >= GUYCAVE) ? 10 : 11 : currcset, true, false); |
| 29907 | 539 | darkroom = true; | |
| 29908 | 539 | } | |
| 29909 |
2/2✓ Branch 0 taken 28514 times.
✓ Branch 1 taken 254 times.
|
28768 | else if(!darkroom) |
| 29910 |
1/2✓ Branch 0 taken 28514 times.
✗ Branch 1 not taken.
|
28514 | lighting(false, false); // NES behaviour: fade to dark before scrolling |
| 29911 | |||
| 29912 |
2/2✓ Branch 0 taken 456 times.
✓ Branch 1 taken 28851 times.
|
29307 | if(action != rafting) // Is this supposed to be here?! |
| 29913 | 28851 | scroll_counter++; //This was the easiest way to re-arrange the loop so drawing is in the middle | |
| 29914 | } | ||
| 29915 | |||
| 29916 | 29307 | bool draw_dark = false; | |
| 29917 |
1/2✓ Branch 0 taken 29307 times.
✗ Branch 1 not taken.
|
88285 | for_every_nearby_screen_during_scroll(nearby_screens, [&](screen_handles_t screen_handles, int screen, int offx, int offy, bool is_new_screen) { |
| 29918 | 58978 | mapscr* base_scr = screen_handles[0].scr; | |
| 29919 |
2/2✓ Branch 0 taken 29489 times.
✓ Branch 1 taken 29489 times.
|
58978 | bool dark = is_new_screen ? is_dark(base_scr) : scrolling_is_dark(base_scr); |
| 29920 | 58978 | draw_dark |= dark; | |
| 29921 | 58978 | }); | |
| 29922 | |||
| 29923 | 29307 | int no_move = 0; | |
| 29924 | 29307 | int move_counter = 0; | |
| 29925 | 29307 | bool end_frames = false; | |
| 29926 | |||
| 29927 | 29307 | scroll_counter *= delay; | |
| 29928 | |||
| 29929 |
1/2✓ Branch 0 taken 29307 times.
✗ Branch 1 not taken.
|
29307 | if (get_qr(qr_NOSCROLL)) |
| 29930 | { | ||
| 29931 | ✗ | delay = 0; | |
| 29932 | ✗ | secondary_axis_alignment_amount = 0; | |
| 29933 | ✗ | pfo_counter = 0; | |
| 29934 | ✗ | align_counter = 0; | |
| 29935 | ✗ | } | |
| 29936 | |||
| 29937 | 29307 | viewport_t initial_viewport = old_viewport; | |
| 29938 | 29307 | viewport = initial_viewport; | |
| 29939 |
2/2✓ Branch 0 taken 28626 times.
✓ Branch 1 taken 681 times.
|
29307 | if (is_unsmooth_vertical_scrolling) viewport.y += 3; |
| 29940 | |||
| 29941 | // These mark the top-left coordinate of the new screen and the old screen, in the old region | ||
| 29942 | // coordinates. | ||
| 29943 | 29307 | int nx = 0; | |
| 29944 | 29307 | int ny = 0; | |
| 29945 | 29307 | int ox = 0; | |
| 29946 | 29307 | int oy = 0; | |
| 29947 |
2/4✓ Branch 0 taken 29307 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 29307 times.
✗ Branch 3 not taken.
|
88285 | for_every_nearby_screen_during_scroll(nearby_screens, [&](screen_handles_t screen_handles, int screen, int offx, int offy, bool is_new_screen) { |
| 29948 |
4/4✓ Branch 0 taken 29482 times.
✓ Branch 1 taken 29496 times.
✓ Branch 2 taken 175 times.
✓ Branch 3 taken 29307 times.
|
58978 | if (screen == dest_screen && is_new_screen) |
| 29949 | { | ||
| 29950 | 29307 | nx = offx; | |
| 29951 | 29307 | ny = offy; | |
| 29952 | 29307 | } | |
| 29953 |
4/4✓ Branch 0 taken 29313 times.
✓ Branch 1 taken 358 times.
✓ Branch 2 taken 6 times.
✓ Branch 3 taken 29307 times.
|
29671 | else if (screen == scrolling_hero_screen && !is_new_screen) |
| 29954 | { | ||
| 29955 | 29307 | ox = offx; | |
| 29956 | 29307 | oy = offy; | |
| 29957 | 29307 | } | |
| 29958 | 58978 | }); | |
| 29959 | |||
| 29960 | // FFCs coordinates are world positions, and so don't need an offset like when drawing a | ||
| 29961 | // specific screen's combos in do_scrolling_layer. But since their coordinates are in the new | ||
| 29962 | // region's coordinate system, an offset of the difference between the two coordinate systems is | ||
| 29963 | // needed. | ||
| 29964 | // TODO: figure out how to calculate this in calc_new_viewport_and_pos, before their first usage... | ||
| 29965 |
1/2✓ Branch 0 taken 29307 times.
✗ Branch 1 not taken.
|
29307 | new_region_offset_x = nx - get_region_relative_dx(dest_screen)*256; |
| 29966 |
1/2✓ Branch 0 taken 29307 times.
✗ Branch 1 not taken.
|
29307 | new_region_offset_y = ny - get_region_relative_dy(dest_screen)*176; |
| 29967 | |||
| 29968 | 29307 | cur_dmap = new_dmap; | |
| 29969 | 29307 | bool classic_draw = get_qr(qr_CLASSIC_DRAWING_ORDER); | |
| 29970 |
6/6✓ Branch 0 taken 1709306 times.
✓ Branch 1 taken 30077 times.
✓ Branch 2 taken 572 times.
✓ Branch 3 taken 29505 times.
✓ Branch 4 taken 29303 times.
✓ Branch 5 taken 1710080 times.
|
1739383 | for (int i = 0; (scroll_counter >= 0 && delay != 0) || align_counter || pfo_counter; i++, scroll_counter--) |
| 29971 | { | ||
| 29972 | // Scripts see the hero position as if relative to the scrolling viewport. This is a weird | ||
| 29973 | // quirk that should probably be placed behind a compat QR. | ||
| 29974 |
2/4✓ Branch 0 taken 1710080 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1710080 times.
✗ Branch 3 not taken.
|
1710080 | zfix prev_x, prev_y; |
| 29975 | #define SAVE_HERO_POS {prev_x = x; prev_y = y;} | ||
| 29976 | #define USE_COMPAT_HERO_POS {x -= viewport.x; y -= viewport.y;} | ||
| 29977 | #define RESTORE_HERO_POS {x = prev_x; y = prev_y;} | ||
| 29978 | |||
| 29979 |
3/4✓ Branch 0 taken 1710080 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 159376 times.
✓ Branch 3 taken 1550704 times.
|
1710080 | if (replay_version_check(0, 3)) |
| 29980 | { | ||
| 29981 |
1/2✓ Branch 0 taken 159376 times.
✗ Branch 1 not taken.
|
159376 | replay_poll(); |
| 29982 | 159376 | } | |
| 29983 | |||
| 29984 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 1710077 times.
|
1710080 | if(Quit) |
| 29985 | { | ||
| 29986 | // Just for compat with pre-z3 replays that quit during a scroll. | ||
| 29987 |
2/4✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 3 times.
|
3 | if (replay_is_recording()) |
| 29988 | { | ||
| 29989 | ✗ | USE_COMPAT_HERO_POS; | |
| 29990 | ✗ | } | |
| 29991 | 3 | screenscrolling = false; | |
| 29992 | 3 | return; | |
| 29993 | } | ||
| 29994 | |||
| 29995 |
2/4✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1710077 times.
✗ Branch 3 not taken.
|
1710077 | SAVE_HERO_POS; |
| 29996 |
2/4✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1710077 times.
✗ Branch 3 not taken.
|
1710077 | USE_COMPAT_HERO_POS; |
| 29997 |
1/2✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
|
1710077 | ZScriptVersion::RunScrollingScript(scrolldir, scroll_counter, sx, sy, end_frames, false); |
| 29998 |
3/4✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 4096457 times.
✓ Branch 3 taken 2386380 times.
|
1710077 | RESTORE_HERO_POS; |
| 29999 | |||
| 30000 |
2/2✓ Branch 0 taken 121795 times.
✓ Branch 1 taken 3974662 times.
|
4096457 | if(no_move > 0) |
| 30001 | 121795 | no_move--; | |
| 30002 | |||
| 30003 | //Don't want to move things on the first or last iteration, or between delays, or while aligning, or while adjusting playing field offset | ||
| 30004 |
12/12✓ Branch 0 taken 1680770 times.
✓ Branch 1 taken 2415687 times.
✓ Branch 2 taken 1637406 times.
✓ Branch 3 taken 43364 times.
✓ Branch 4 taken 1604357 times.
✓ Branch 5 taken 33049 times.
✓ Branch 6 taken 1601017 times.
✓ Branch 7 taken 3340 times.
✓ Branch 8 taken 1222497 times.
✓ Branch 9 taken 2823514 times.
✓ Branch 10 taken 1223361 times.
✓ Branch 11 taken 1603493 times.
|
4096457 | if(i == 0 || scroll_counter == 0 || scroll_counter % delay != 0 || (align_mode == 0 && align_counter) || (pfo_mode == 0 && pfo_counter)) |
| 30005 | 4937958 | no_move++; | |
| 30006 | |||
| 30007 |
4/4✓ Branch 0 taken 1282862 times.
✓ Branch 1 taken 427215 times.
✓ Branch 2 taken 310852 times.
✓ Branch 3 taken 972010 times.
|
1710077 | if(scrolldir == up || scrolldir == down) |
| 30008 | { | ||
| 30009 |
2/2✓ Branch 0 taken 687997 times.
✓ Branch 1 taken 50070 times.
|
738067 | if(!get_qr(qr_SMOOTHVERTICALSCROLLING)) |
| 30010 | { | ||
| 30011 | //Add a few extra frames if on the second loop and cool scrolling is not set | ||
| 30012 |
2/2✓ Branch 0 taken 49389 times.
✓ Branch 1 taken 681 times.
|
50070 | if(i == 1) |
| 30013 | { | ||
| 30014 | 681 | scroll_counter += (scrolldir == down) ? 3 : 2; | |
| 30015 | 681 | no_move += (scrolldir == down) ? 3 : 2; | |
| 30016 | 681 | } | |
| 30017 | 50070 | } | |
| 30018 | else | ||
| 30019 | { | ||
| 30020 | //4 frames after we've finished scrolling of being still | ||
| 30021 |
6/6✓ Branch 0 taken 28130 times.
✓ Branch 1 taken 659867 times.
✓ Branch 2 taken 28122 times.
✓ Branch 3 taken 8 times.
✓ Branch 4 taken 14061 times.
✓ Branch 5 taken 14061 times.
|
687997 | if (scroll_counter == 0 && pfo_counter == 0 && !end_frames) |
| 30022 | { | ||
| 30023 | 14061 | scroll_counter += 4; | |
| 30024 | 14061 | no_move += 4; | |
| 30025 | 14061 | end_frames = true; | |
| 30026 | 14061 | } | |
| 30027 | } | ||
| 30028 | 738067 | } | |
| 30029 | |||
| 30030 |
2/2✓ Branch 0 taken 3432 times.
✓ Branch 1 taken 1706645 times.
|
1710077 | if (align_mode == 0) |
| 30031 | { | ||
| 30032 |
5/6✓ Branch 0 taken 690 times.
✓ Branch 1 taken 1705955 times.
✓ Branch 2 taken 252 times.
✓ Branch 3 taken 438 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 252 times.
|
1706645 | if (align_counter > 0 && (pfo_counter == 0 || pfo_mode == 1)) |
| 30033 | { | ||
| 30034 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 420 times.
|
438 | align_counter = MAX(0, align_counter - 4); |
| 30035 |
2/2✓ Branch 0 taken 34 times.
✓ Branch 1 taken 404 times.
|
438 | if (align_counter) |
| 30036 | 404 | scroll_counter++; | |
| 30037 | 438 | } | |
| 30038 | 1706645 | } | |
| 30039 | else | ||
| 30040 | { | ||
| 30041 |
5/6✓ Branch 0 taken 3370 times.
✓ Branch 1 taken 62 times.
✓ Branch 2 taken 2798 times.
✓ Branch 3 taken 572 times.
✓ Branch 4 taken 2798 times.
✗ Branch 5 not taken.
|
3432 | if (align_counter > 0 && !(scroll_counter >= 0 && delay != 0)) |
| 30042 | { | ||
| 30043 |
2/2✓ Branch 0 taken 12 times.
✓ Branch 1 taken 560 times.
|
572 | align_counter = MAX(0, align_counter - 4); |
| 30044 | 572 | no_move = 1; | |
| 30045 | 572 | } | |
| 30046 | } | ||
| 30047 | |||
| 30048 | 1710077 | bool do_pfo_adjust = false; | |
| 30049 |
2/2✓ Branch 0 taken 429623 times.
✓ Branch 1 taken 1280454 times.
|
1710077 | if (pfo_mode == 0) |
| 30050 | { | ||
| 30051 |
2/2✓ Branch 0 taken 478 times.
✓ Branch 1 taken 1279976 times.
|
1280454 | if (pfo_counter > 0) |
| 30052 | 478 | do_pfo_adjust = true; | |
| 30053 | 1280454 | } | |
| 30054 | else | ||
| 30055 | { | ||
| 30056 |
5/6✓ Branch 0 taken 2908 times.
✓ Branch 1 taken 426715 times.
✓ Branch 2 taken 2376 times.
✓ Branch 3 taken 532 times.
✓ Branch 4 taken 2376 times.
✗ Branch 5 not taken.
|
429623 | if (pfo_counter > 0 && !(scroll_counter >= 0 && delay != 0)) |
| 30057 | { | ||
| 30058 | 532 | do_pfo_adjust = true; | |
| 30059 | 532 | no_move = 1; | |
| 30060 | 532 | } | |
| 30061 | } | ||
| 30062 | |||
| 30063 |
2/2✓ Branch 0 taken 1010 times.
✓ Branch 1 taken 1709067 times.
|
1710077 | if (do_pfo_adjust) |
| 30064 | { | ||
| 30065 |
1/2✓ Branch 0 taken 1010 times.
✗ Branch 1 not taken.
|
1010 | int dpfo = sign(new_playing_field_offset - old_original_playing_field_offset); |
| 30066 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 1008 times.
|
1010 | pfo_counter = MAX(0, pfo_counter - 4); |
| 30067 | 1010 | playing_field_offset = new_playing_field_offset - pfo_counter * dpfo; | |
| 30068 | 1010 | viewport.h = 232 - playing_field_offset; | |
| 30069 | 1010 | viewport.y = initial_viewport.y + step * move_counter * dy + (playing_field_offset - old_original_playing_field_offset); | |
| 30070 |
4/4✓ Branch 0 taken 478 times.
✓ Branch 1 taken 532 times.
✓ Branch 2 taken 36 times.
✓ Branch 3 taken 442 times.
|
1010 | if (pfo_mode == 0 && pfo_counter) |
| 30071 | 442 | scroll_counter++; | |
| 30072 | 1010 | } | |
| 30073 | |||
| 30074 |
2/2✓ Branch 0 taken 793 times.
✓ Branch 1 taken 1709284 times.
|
1710077 | if (lift_wpn) |
| 30075 |
1/2✓ Branch 0 taken 793 times.
✗ Branch 1 not taken.
|
793 | lift_wpn->yofs = playing_field_offset - 2; |
| 30076 | |||
| 30077 |
2/2✓ Branch 0 taken 1558979 times.
✓ Branch 1 taken 151098 times.
|
1710077 | if(!no_move) |
| 30078 | { | ||
| 30079 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 352973 times.
✓ Branch 2 taken 264512 times.
✓ Branch 3 taken 442813 times.
✓ Branch 4 taken 498681 times.
|
1558979 | switch(scrolldir) |
| 30080 | { | ||
| 30081 | case up: | ||
| 30082 | 352973 | sy -= step; | |
| 30083 | 352973 | break; | |
| 30084 | |||
| 30085 | case down: | ||
| 30086 | 264512 | sy += step; | |
| 30087 | 264512 | break; | |
| 30088 | |||
| 30089 | case left: | ||
| 30090 | 442813 | sx -= step; | |
| 30091 | 442813 | break; | |
| 30092 | |||
| 30093 | case right: | ||
| 30094 | 498681 | sx += step; | |
| 30095 | 498681 | break; | |
| 30096 | } | ||
| 30097 | |||
| 30098 | 1558979 | move_counter++; | |
| 30099 | { | ||
| 30100 | 1558979 | viewport.x = initial_viewport.x + step * move_counter * dx; | |
| 30101 |
1/2✓ Branch 0 taken 1558979 times.
✗ Branch 1 not taken.
|
1558979 | viewport.y = initial_viewport.y + std::min(step * move_counter, scroll_amount) * dy + playing_field_offset - old_original_playing_field_offset; |
| 30102 | } | ||
| 30103 | |||
| 30104 | // This is the only thing that moves the hero. | ||
| 30105 |
2/4✓ Branch 0 taken 1558979 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1558979 times.
✗ Branch 3 not taken.
|
1558979 | if (!sideview_scrolling_slope) |
| 30106 | { | ||
| 30107 |
4/4✓ Branch 0 taken 1116166 times.
✓ Branch 1 taken 442813 times.
✓ Branch 2 taken 617485 times.
✓ Branch 3 taken 498681 times.
|
1558979 | if (scrolling_dir == left || scrolling_dir == right) |
| 30108 | { | ||
| 30109 |
2/4✓ Branch 0 taken 941494 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 941494 times.
✗ Branch 3 not taken.
|
941494 | x.doClamp(viewport.x, viewport.right() - 16); |
| 30110 | 941494 | } | |
| 30111 | else | ||
| 30112 | { | ||
| 30113 |
2/4✓ Branch 0 taken 617485 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 617485 times.
✗ Branch 3 not taken.
|
617485 | y.doClamp(viewport.y, viewport.bottom() - 16); |
| 30114 | } | ||
| 30115 | 1558979 | } | |
| 30116 | |||
| 30117 |
2/2✓ Branch 0 taken 1544877 times.
✓ Branch 1 taken 14102 times.
|
1558979 | if (is_unsmooth_vertical_scrolling) viewport.y += 3; |
| 30118 | |||
| 30119 |
4/4✓ Branch 0 taken 1558851 times.
✓ Branch 1 taken 128 times.
✓ Branch 2 taken 128 times.
✓ Branch 3 taken 1558723 times.
|
1558979 | if(ladderx > 0 || laddery > 0) |
| 30120 | { | ||
| 30121 | // If the ladder moves on both axes, the player can | ||
| 30122 | // gradually shift it by going back and forth | ||
| 30123 |
2/4✓ Branch 0 taken 256 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 256 times.
✗ Branch 3 not taken.
|
256 | if(scrolldir==up || scrolldir==down) |
| 30124 | ✗ | laddery = y.getInt(); | |
| 30125 | else | ||
| 30126 |
1/2✓ Branch 0 taken 256 times.
✗ Branch 1 not taken.
|
256 | ladderx = x.getInt(); |
| 30127 | 256 | } | |
| 30128 | 1558979 | } | |
| 30129 | |||
| 30130 |
2/2✓ Branch 0 taken 6314 times.
✓ Branch 1 taken 1703763 times.
|
1710077 | if (secondary_axis_alignment_amount) |
| 30131 | { | ||
| 30132 |
1/2✓ Branch 0 taken 6314 times.
✗ Branch 1 not taken.
|
6314 | int delta = (align_counter - abs(secondary_axis_alignment_amount)) * sign(secondary_axis_alignment_amount); |
| 30133 |
4/4✓ Branch 0 taken 5944 times.
✓ Branch 1 taken 370 times.
✓ Branch 2 taken 284 times.
✓ Branch 3 taken 5660 times.
|
6314 | if (scrolldir == up || scrolldir == down) viewport.x = initial_viewport.x + delta; |
| 30134 | 5660 | else viewport.y = initial_viewport.y + delta + (playing_field_offset - old_original_playing_field_offset); | |
| 30135 | 6314 | } | |
| 30136 | |||
| 30137 | 1710077 | FFCore.ScrollingData[SCROLLDATA_NX] = nx - viewport.x; | |
| 30138 | 1710077 | FFCore.ScrollingData[SCROLLDATA_NY] = ny - viewport.y; | |
| 30139 | 1710077 | FFCore.ScrollingData[SCROLLDATA_OX] = ox - viewport.x; | |
| 30140 | 1710077 | FFCore.ScrollingData[SCROLLDATA_OY] = oy - viewport.y; | |
| 30141 | 1710077 | FFCore.ScrollingData[SCROLLDATA_NRX] = new_region_offset_x - viewport.x; | |
| 30142 | 1710077 | FFCore.ScrollingData[SCROLLDATA_NRY] = new_region_offset_y - viewport.y; | |
| 30143 | 1710077 | FFCore.ScrollingData[SCROLLDATA_ORX] = -viewport.x; | |
| 30144 | 1710077 | FFCore.ScrollingData[SCROLLDATA_ORY] = -viewport.y; | |
| 30145 | |||
| 30146 |
2/4✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1710077 times.
✗ Branch 3 not taken.
|
1710077 | SAVE_HERO_POS; |
| 30147 |
2/4✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1710077 times.
✗ Branch 3 not taken.
|
1710077 | USE_COMPAT_HERO_POS; |
| 30148 |
1/2✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
|
1710077 | ZScriptVersion::RunScrollingScript(scrolldir, scroll_counter, sx, sy, end_frames, true); //Waitdraw |
| 30149 |
1/2✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
|
1710077 | FFCore.runGenericPassiveEngine(SCR_TIMING_PRE_DRAW); |
| 30150 |
2/4✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1710077 times.
✗ Branch 3 not taken.
|
1710077 | RESTORE_HERO_POS; |
| 30151 | |||
| 30152 |
1/2✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
|
1710077 | clear_bitmap(framebuf); |
| 30153 |
1/2✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
|
1710077 | clear_info_bmp(); |
| 30154 |
1/2✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
|
1710077 | if (!classic_draw) |
| 30155 | ✗ | for (int layer = -7; layer <= -4; ++layer) | |
| 30156 | ✗ | do_ffc_scroll_layer(framebuf, layer, nearby_screens, new_region_offset_x, new_region_offset_y); | |
| 30157 | |||
| 30158 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1710077 times.
|
1710077 | if(classic_draw) // -2 < -3 |
| 30159 | { | ||
| 30160 |
1/2✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
|
5156255 | for_every_nearby_screen_during_scroll(nearby_screens, [&](screen_handles_t screen_handles, int screen, int offx, int offy, bool is_new_screen) { |
| 30161 | 3446178 | mapscr* base_scr = screen_handles[0].base_scr; | |
| 30162 |
2/2✓ Branch 0 taken 3440891 times.
✓ Branch 1 taken 5287 times.
|
3446178 | if(XOR(base_scr->flags7&fLAYER2BG, DMaps[cur_dmap].flags&dmfLAYER2BG)) do_layer(framebuf, 0, screen_handles[2], offx, offy); |
| 30163 | 3446178 | }); | |
| 30164 |
4/4✓ Branch 0 taken 2703 times.
✓ Branch 1 taken 1707374 times.
✓ Branch 2 taken 4771 times.
✓ Branch 3 taken 1705306 times.
|
1710077 | if(XOR((newscr->flags7&fLAYER2BG) || (oldscr->flags7&fLAYER2BG), DMaps[cur_dmap].flags&dmfLAYER2BG)) |
| 30165 |
1/2✓ Branch 0 taken 4771 times.
✗ Branch 1 not taken.
|
4771 | do_primitives(framebuf, 2); |
| 30166 |
1/2✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
|
1710077 | do_ffc_scroll_layer(framebuf, -2, nearby_screens, new_region_offset_x, new_region_offset_y); |
| 30167 | 1710077 | } | |
| 30168 | |||
| 30169 |
1/2✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
|
5156255 | for_every_nearby_screen_during_scroll(nearby_screens, [&](screen_handles_t screen_handles, int screen, int offx, int offy, bool is_new_screen) { |
| 30170 | 3446178 | mapscr* base_scr = screen_handles[0].base_scr; | |
| 30171 |
2/2✓ Branch 0 taken 3400762 times.
✓ Branch 1 taken 45416 times.
|
3446178 | if(XOR(base_scr->flags7&fLAYER3BG, DMaps[cur_dmap].flags&dmfLAYER3BG)) do_layer(framebuf, 0, screen_handles[3], offx, offy); |
| 30172 | 3446178 | }); | |
| 30173 |
4/4✓ Branch 0 taken 22177 times.
✓ Branch 1 taken 1687900 times.
✓ Branch 2 taken 33123 times.
✓ Branch 3 taken 1676954 times.
|
1710077 | if(XOR((newscr->flags7&fLAYER3BG) || (oldscr->flags7&fLAYER3BG), DMaps[cur_dmap].flags&dmfLAYER3BG)) |
| 30174 |
1/2✓ Branch 0 taken 33123 times.
✗ Branch 1 not taken.
|
33123 | do_primitives(framebuf, 3); |
| 30175 |
1/2✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
|
1710077 | do_ffc_scroll_layer(framebuf, -3, nearby_screens, new_region_offset_x, new_region_offset_y); |
| 30176 | |||
| 30177 |
1/2✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
|
1710077 | if(!classic_draw) // -2 > -3 |
| 30178 | { | ||
| 30179 | ✗ | for_every_nearby_screen_during_scroll(nearby_screens, [&](screen_handles_t screen_handles, int screen, int offx, int offy, bool is_new_screen) { | |
| 30180 | ✗ | mapscr* base_scr = screen_handles[0].base_scr; | |
| 30181 | ✗ | if(XOR(base_scr->flags7&fLAYER2BG, DMaps[cur_dmap].flags&dmfLAYER2BG)) do_layer(framebuf, 0, screen_handles[2], offx, offy); | |
| 30182 | ✗ | }); | |
| 30183 | ✗ | if(XOR((newscr->flags7&fLAYER2BG) || (oldscr->flags7&fLAYER2BG), DMaps[cur_dmap].flags&dmfLAYER2BG)) | |
| 30184 | ✗ | do_primitives(framebuf, 2); | |
| 30185 | ✗ | do_ffc_scroll_layer(framebuf, -2, nearby_screens, new_region_offset_x, new_region_offset_y); | |
| 30186 | ✗ | do_ffc_scroll_layer(framebuf, -1, nearby_screens, new_region_offset_x, new_region_offset_y); | |
| 30187 | ✗ | } | |
| 30188 | |||
| 30189 | |||
| 30190 | 1710077 | combotile_add_y = is_unsmooth_vertical_scrolling ? -3 : 0; | |
| 30191 |
1/2✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
|
5156255 | for_every_nearby_screen_during_scroll(nearby_screens, [&](screen_handles_t screen_handles, int screen, int offx, int offy, bool is_new_screen) { |
| 30192 | 3446178 | offy += playing_field_offset; | |
| 30193 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3446178 times.
|
3446178 | if (lenscheck(screen_handles[0].scr, 0)) |
| 30194 | 3446178 | putscr(screen_handles[0].scr, framebuf, offx, offy); | |
| 30195 | 3446178 | }); | |
| 30196 | 1710077 | combotile_add_y = 0; | |
| 30197 | |||
| 30198 |
2/4✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1710077 times.
✗ Branch 3 not taken.
|
1710077 | if (lenscheck(newscr, 0)) |
| 30199 |
1/2✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
|
1710077 | do_primitives(framebuf, 0); |
| 30200 | |||
| 30201 |
1/2✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
|
1710077 | do_ffc_scroll_layer(framebuf, 0, nearby_screens, new_region_offset_x, new_region_offset_y); |
| 30202 | |||
| 30203 |
1/2✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
|
5156255 | for_every_nearby_screen_during_scroll(nearby_screens, [&](screen_handles_t screen_handles, int screen, int offx, int offy, bool is_new_screen) { |
| 30204 | 3446178 | do_layer(framebuf, 0, screen_handles[1], offx, offy); | |
| 30205 | 3446178 | }); | |
| 30206 |
1/2✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
|
1710077 | do_layer_primitives(framebuf, 1); |
| 30207 | |||
| 30208 |
1/2✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
|
1710077 | do_ffc_scroll_layer(framebuf, 1, nearby_screens, new_region_offset_x, new_region_offset_y); |
| 30209 | |||
| 30210 |
1/2✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
|
5156255 | for_every_nearby_screen_during_scroll(nearby_screens, [&](screen_handles_t screen_handles, int screen, int offx, int offy, bool is_new_screen) { |
| 30211 | 3446178 | mapscr* base_scr = screen_handles[0].base_scr; | |
| 30212 |
2/2✓ Branch 0 taken 5287 times.
✓ Branch 1 taken 3440891 times.
|
3446178 | if (!(XOR(base_scr->flags7&fLAYER2BG, DMaps[cur_dmap].flags&dmfLAYER2BG))) |
| 30213 | 3440891 | do_layer(framebuf, 0, screen_handles[2], offx, offy); | |
| 30214 | 3446178 | }); | |
| 30215 | |||
| 30216 |
4/4✓ Branch 0 taken 1707493 times.
✓ Branch 1 taken 2584 times.
✓ Branch 2 taken 1705306 times.
✓ Branch 3 taken 2187 times.
|
1710077 | if (!(oldscr->flags7&fLAYER2BG) && !(XOR(origin_scr->flags7&fLAYER2BG, DMaps[cur_dmap].flags&dmfLAYER2BG))) |
| 30217 |
1/2✓ Branch 0 taken 1705306 times.
✗ Branch 1 not taken.
|
1705306 | do_layer_primitives(framebuf, 2); |
| 30218 |
1/2✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
|
1710077 | do_ffc_scroll_layer(framebuf, 2, nearby_screens, new_region_offset_x, new_region_offset_y); |
| 30219 | |||
| 30220 |
2/2✓ Branch 0 taken 17236 times.
✓ Branch 1 taken 1692841 times.
|
1710077 | if (get_qr(qr_PUSHBLOCK_SPRITE_LAYER)) |
| 30221 | { | ||
| 30222 |
1/2✓ Branch 0 taken 1692841 times.
✗ Branch 1 not taken.
|
5104547 | for_every_nearby_screen_during_scroll(nearby_screens, [&](screen_handles_t screen_handles, int screen, int offx, int offy, bool is_new_screen) { |
| 30223 | 3411706 | do_layer(framebuf, -2, screen_handles[0], offx, offy); | |
| 30224 |
2/2✓ Branch 0 taken 3127350 times.
✓ Branch 1 taken 284356 times.
|
3411706 | if (get_qr(qr_PUSHBLOCK_LAYER_1_2)) |
| 30225 | { | ||
| 30226 | 284356 | do_layer(framebuf, -2, screen_handles[1], offx, offy); | |
| 30227 | 284356 | do_layer(framebuf, -2, screen_handles[2], offx, offy); | |
| 30228 | 284356 | } | |
| 30229 | 3411706 | }); | |
| 30230 | |||
| 30231 |
1/2✓ Branch 0 taken 1692841 times.
✗ Branch 1 not taken.
|
1692841 | do_primitives(framebuf, SPLAYER_PUSHBLOCK); |
| 30232 | 1692841 | } | |
| 30233 | |||
| 30234 |
2/4✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 1710077 times.
|
1710077 | if (show_walkflags || show_effectflags) |
| 30235 | { | ||
| 30236 | ✗ | for_every_nearby_screen_during_scroll(nearby_screens, [&](screen_handles_t screen_handles, int screen, int offx, int offy, bool is_new_screen) { | |
| 30237 | ✗ | do_walkflags(screen_handles, offx, offy); // show walkflags if the cheat is on | |
| 30238 | ✗ | do_effectflags(screen_handles[0].base_scr, offx, offy); // show effectflags if the cheat is on | |
| 30239 | ✗ | }); | |
| 30240 | |||
| 30241 | ✗ | do_walkflags(nx, ny); | |
| 30242 | ✗ | } | |
| 30243 | |||
| 30244 |
1/2✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
|
5156255 | for_every_nearby_screen_during_scroll(nearby_screens, [&](screen_handles_t screen_handles, int screen, int offx, int offy, bool is_new_screen) { |
| 30245 | 3446178 | offy += playing_field_offset; | |
| 30246 | 3446178 | putscrdoors(screen_handles[0].scr, framebuf, offx, offy); | |
| 30247 | 3446178 | }); | |
| 30248 | |||
| 30249 |
4/4✓ Branch 0 taken 3982 times.
✓ Branch 1 taken 1706095 times.
✓ Branch 2 taken 3938 times.
✓ Branch 3 taken 44 times.
|
1710077 | if (!align_counter || scroll_counter) herostep(); |
| 30250 | |||
| 30251 | { | ||
| 30252 |
1/2✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
|
1710077 | auto prev_y = y; |
| 30253 |
1/2✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
|
1710077 | auto prev_yofs = yofs; |
| 30254 | |||
| 30255 |
3/4✓ Branch 0 taken 50070 times.
✓ Branch 1 taken 1660007 times.
✓ Branch 2 taken 50070 times.
✗ Branch 3 not taken.
|
1710077 | if (is_unsmooth_vertical_scrolling) y += 3; |
| 30256 |
1/2✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
|
1710077 | yofs = playing_field_offset; |
| 30257 | |||
| 30258 |
7/12✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1710077 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1709313 times.
✓ Branch 5 taken 764 times.
✓ Branch 6 taken 1709313 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1709313 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 1710077 times.
|
1710077 | if((z > 0 || fakez > 0) && (!get_qr(qr_SHADOWSFLICKER) || frame&1)) |
| 30259 | { | ||
| 30260 |
2/2✓ Branch 0 taken 764 times.
✓ Branch 1 taken 1709313 times.
|
1710077 | drawshadow(framebuf, get_qr(qr_TRANSSHADOWS) != 0); |
| 30261 | 764 | } | |
| 30262 | |||
| 30263 |
6/6✓ Branch 0 taken 1710077 times.
✓ Branch 1 taken 1709313 times.
✓ Branch 2 taken 615767 times.
✓ Branch 3 taken 1094310 times.
✓ Branch 4 taken 295458 times.
✓ Branch 5 taken 320309 times.
|
764 | if(!isdungeon() || get_qr(qr_FREEFORM)) |
| 30264 | { | ||
| 30265 |
3/4✓ Branch 0 taken 1435230 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 45462 times.
✓ Branch 3 taken 1389768 times.
|
1435230 | for (int i = 0; i < decorations.Count(); i++) |
| 30266 | { | ||
| 30267 |
1/2✓ Branch 0 taken 45462 times.
✗ Branch 1 not taken.
|
45462 | auto sprite = decorations.spr(i); |
| 30268 |
1/2✓ Branch 0 taken 45462 times.
✗ Branch 1 not taken.
|
45462 | sprite->yofs += playing_field_offset - old_original_playing_field_offset; |
| 30269 | 45462 | } | |
| 30270 | |||
| 30271 |
1/2✓ Branch 0 taken 1389768 times.
✗ Branch 1 not taken.
|
1389768 | draw_under(framebuf); //draw the ladder or raft |
| 30272 |
1/2✓ Branch 0 taken 1389768 times.
✗ Branch 1 not taken.
|
1389768 | decorations.draw2(framebuf, true); |
| 30273 |
1/2✓ Branch 0 taken 1389768 times.
✗ Branch 1 not taken.
|
1389768 | draw(framebuf); //Hero |
| 30274 |
1/2✓ Branch 0 taken 1389768 times.
✗ Branch 1 not taken.
|
1389768 | decorations.draw(framebuf, true); |
| 30275 | |||
| 30276 |
3/4✓ Branch 0 taken 1435230 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 45462 times.
✓ Branch 3 taken 1389768 times.
|
1435230 | for (int i = 0; i < decorations.Count(); i++) |
| 30277 | { | ||
| 30278 |
1/2✓ Branch 0 taken 45462 times.
✗ Branch 1 not taken.
|
45462 | auto sprite = decorations.spr(i); |
| 30279 |
1/2✓ Branch 0 taken 45462 times.
✗ Branch 1 not taken.
|
45462 | sprite->yofs -= playing_field_offset - old_original_playing_field_offset; |
| 30280 | 45462 | } | |
| 30281 | 1389768 | } | |
| 30282 | |||
| 30283 |
1/2✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
|
1710077 | y = prev_y; |
| 30284 |
1/2✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
|
1710077 | yofs = prev_yofs; |
| 30285 | } | ||
| 30286 | |||
| 30287 |
2/4✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1710077 times.
✗ Branch 3 not taken.
|
1710077 | RESTORE_HERO_POS; |
| 30288 | |||
| 30289 |
1/2✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
|
5156255 | for_every_nearby_screen_during_scroll(nearby_screens, [&](screen_handles_t screen_handles, int screen, int offx, int offy, bool is_new_screen) { |
| 30290 | 3446178 | mapscr* base_scr = screen_handles[0].base_scr; | |
| 30291 |
2/2✓ Branch 0 taken 45416 times.
✓ Branch 1 taken 3400762 times.
|
3446178 | if (!(XOR(base_scr->flags7&fLAYER3BG, DMaps[cur_dmap].flags&dmfLAYER3BG))) |
| 30292 | 3400762 | do_layer(framebuf, 0, screen_handles[3], offx, offy); | |
| 30293 | 3446178 | }); | |
| 30294 | |||
| 30295 |
2/2✓ Branch 0 taken 1687900 times.
✓ Branch 1 taken 22177 times.
|
1710077 | if (!(XOR(origin_scr->flags7&fLAYER3BG, DMaps[cur_dmap].flags&dmfLAYER3BG))) |
| 30296 |
1/2✓ Branch 0 taken 1687900 times.
✗ Branch 1 not taken.
|
1687900 | do_layer_primitives(framebuf, 3); |
| 30297 |
1/2✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
|
1710077 | do_ffc_scroll_layer(framebuf, 3, nearby_screens, new_region_offset_x, new_region_offset_y); |
| 30298 | |||
| 30299 |
1/2✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
|
5156255 | for_every_nearby_screen_during_scroll(nearby_screens, [&](screen_handles_t screen_handles, int screen, int offx, int offy, bool is_new_screen) { |
| 30300 | 3446178 | do_layer(framebuf, 0, screen_handles[4], offx, offy); //layer 4 | |
| 30301 | 3446178 | }); | |
| 30302 | |||
| 30303 |
1/2✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
|
1710077 | do_layer_primitives(framebuf, 4); |
| 30304 |
1/2✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
|
1710077 | do_ffc_scroll_layer(framebuf, 4, nearby_screens, new_region_offset_x, new_region_offset_y); |
| 30305 | |||
| 30306 |
1/2✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
|
5156255 | for_every_nearby_screen_during_scroll(nearby_screens, [&](screen_handles_t screen_handles, int screen, int offx, int offy, bool is_new_screen) { |
| 30307 | 3446178 | do_layer(framebuf, -1, screen_handles[0], offx, offy); //overhead combos | |
| 30308 |
2/2✓ Branch 0 taken 3151618 times.
✓ Branch 1 taken 294560 times.
|
3446178 | if (get_qr(qr_OVERHEAD_COMBOS_L1_L2)) |
| 30309 | { | ||
| 30310 | 294560 | do_layer(framebuf, -1, screen_handles[1], offx, offy); //overhead combos | |
| 30311 | 294560 | do_layer(framebuf, -1, screen_handles[2], offx, offy); //overhead combos | |
| 30312 | 294560 | } | |
| 30313 | 3446178 | }); | |
| 30314 | |||
| 30315 |
1/2✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
|
5156255 | for_every_nearby_screen_during_scroll(nearby_screens, [&](screen_handles_t screen_handles, int screen, int offx, int offy, bool is_new_screen) { |
| 30316 | 3446178 | do_layer(framebuf, 0, screen_handles[5], offx, offy); //layer 5 | |
| 30317 | 3446178 | }); | |
| 30318 | |||
| 30319 |
1/2✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
|
1710077 | do_layer_primitives(framebuf, 5); |
| 30320 |
1/2✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
|
1710077 | do_ffc_scroll_layer(framebuf, 5, nearby_screens, new_region_offset_x, new_region_offset_y); |
| 30321 | |||
| 30322 |
1/2✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
|
1710077 | do_ffc_scroll_layer(framebuf, -1000, nearby_screens, new_region_offset_x, new_region_offset_y); |
| 30323 | |||
| 30324 |
1/2✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
|
5156255 | for_every_nearby_screen_during_scroll(nearby_screens, [&](screen_handles_t screen_handles, int screen, int offx, int offy, bool is_new_screen) { |
| 30325 | 3446178 | do_layer(framebuf, 0, screen_handles[6], offx, offy); //layer 6 | |
| 30326 | 3446178 | }); | |
| 30327 | |||
| 30328 |
1/2✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
|
1710077 | do_layer_primitives(framebuf, 6); |
| 30329 |
1/2✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
|
1710077 | do_ffc_scroll_layer(framebuf, 6, nearby_screens, new_region_offset_x, new_region_offset_y); |
| 30330 | |||
| 30331 |
6/6✓ Branch 0 taken 101220 times.
✓ Branch 1 taken 1608857 times.
✓ Branch 2 taken 23016 times.
✓ Branch 3 taken 78204 times.
✓ Branch 4 taken 22424 times.
✓ Branch 5 taken 592 times.
|
1710077 | if (draw_dark && get_qr(qr_NEW_DARKROOM) && get_qr(qr_NEWDARK_L6)) |
| 30332 | { | ||
| 30333 |
1/2✓ Branch 0 taken 22424 times.
✗ Branch 1 not taken.
|
22424 | scrollscr_handle_dark(newscr, oldscr, nearby_screens); |
| 30334 | 22424 | } | |
| 30335 | |||
| 30336 |
2/4✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1710077 times.
✗ Branch 3 not taken.
|
1710077 | put_passive_subscr(framebuf, 0, 0, game->should_show_time(), sspUP); |
| 30337 | |||
| 30338 |
2/2✓ Branch 0 taken 677093 times.
✓ Branch 1 taken 1032984 times.
|
1710077 | if(get_qr(qr_SUBSCREENOVERSPRITES)) |
| 30339 |
1/2✓ Branch 0 taken 677093 times.
✗ Branch 1 not taken.
|
677093 | do_primitives(framebuf, 7); |
| 30340 |
1/2✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
|
1710077 | do_ffc_scroll_layer(framebuf, 7, nearby_screens, new_region_offset_x, new_region_offset_y); |
| 30341 | |||
| 30342 |
6/6✓ Branch 0 taken 101220 times.
✓ Branch 1 taken 1608857 times.
✓ Branch 2 taken 23016 times.
✓ Branch 3 taken 78204 times.
✓ Branch 4 taken 592 times.
✓ Branch 5 taken 22424 times.
|
1710077 | if (draw_dark && get_qr(qr_NEW_DARKROOM) && !get_qr(qr_NEWDARK_L6)) |
| 30343 | { | ||
| 30344 |
1/2✓ Branch 0 taken 592 times.
✗ Branch 1 not taken.
|
592 | scrollscr_handle_dark(newscr, oldscr, nearby_screens); |
| 30345 | 592 | } | |
| 30346 | |||
| 30347 |
2/4✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1710077 times.
✗ Branch 3 not taken.
|
1710077 | SAVE_HERO_POS; |
| 30348 |
2/4✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1710077 times.
✗ Branch 3 not taken.
|
1710077 | USE_COMPAT_HERO_POS; |
| 30349 |
1/2✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
|
1710077 | FFCore.runGenericPassiveEngine(SCR_TIMING_POST_DRAW); |
| 30350 |
1/2✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
|
1710077 | FFCore.runGenericPassiveEngine(SCR_TIMING_END_FRAME); |
| 30351 | |||
| 30352 |
2/4✓ Branch 0 taken 1710077 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1710077 times.
✗ Branch 3 not taken.
|
1710077 | RESTORE_HERO_POS; |
| 30353 |
2/2✓ Branch 0 taken 1710076 times.
✓ Branch 1 taken 1 times.
|
1710077 | advanceframe(true/*,true,false*/); |
| 30354 |
2/4✓ Branch 0 taken 1710076 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1710076 times.
✗ Branch 3 not taken.
|
1710076 | USE_COMPAT_HERO_POS; |
| 30355 | |||
| 30356 | //Don't clear the last frame, unless 'fixed' | ||
| 30357 |
2/2✓ Branch 0 taken 30077 times.
✓ Branch 1 taken 1679999 times.
|
1710076 | if (scroll_counter > 0 || get_qr(qr_FIXSCRIPTSDURINGSCROLLING)) |
| 30358 |
2/2✓ Branch 0 taken 1684010 times.
✓ Branch 1 taken 26066 times.
|
1710076 | script_drawing_commands.Clear(); |
| 30359 |
2/2✓ Branch 0 taken 1710076 times.
✓ Branch 1 taken 26066 times.
|
1684010 | FFCore.runGenericPassiveEngine(SCR_TIMING_START_FRAME); |
| 30360 | 1710076 | actiontype lastaction = action; | |
| 30361 |
1/2✓ Branch 0 taken 1710076 times.
✗ Branch 1 not taken.
|
1710076 | action=scrolling; FFCore.setHeroAction(scrolling); |
| 30362 |
1/2✓ Branch 0 taken 1710076 times.
✗ Branch 1 not taken.
|
1710076 | FFCore.runF6Engine(); |
| 30363 |
1/2✓ Branch 0 taken 1710076 times.
✗ Branch 1 not taken.
|
1710076 | action=lastaction; FFCore.setHeroAction(lastaction); |
| 30364 | |||
| 30365 |
2/4✓ Branch 0 taken 1710076 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1710076 times.
✗ Branch 3 not taken.
|
1710076 | RESTORE_HERO_POS; |
| 30366 | 1710076 | } | |
| 30367 | 29303 | cur_dmap = old_dmap; | |
| 30368 | |||
| 30369 | // TODO(replays): Prior to z3 refactor, old scrolling code didn't clear the darkroom bitmaps at end of scroll, | ||
| 30370 | // so the first frame drawn had some lighting from previous screen... | ||
| 30371 | // game_loop clears these bitmaps but that should be moved to advanceframe, and these other calls to `clear_darkroom_bitmaps` | ||
| 30372 | // deleted. | ||
| 30373 |
4/6✓ Branch 0 taken 1647 times.
✓ Branch 1 taken 27656 times.
✓ Branch 2 taken 1647 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 1647 times.
|
29303 | if (draw_dark && !replay_is_active()) |
| 30374 | ✗ | clear_darkroom_bitmaps(); | |
| 30375 | |||
| 30376 |
1/2✓ Branch 0 taken 29303 times.
✗ Branch 1 not taken.
|
29303 | clear_bitmap(msg_txt_display_buf); |
| 30377 |
1/2✓ Branch 0 taken 29303 times.
✗ Branch 1 not taken.
|
29303 | set_clip_state(msg_txt_display_buf, 1); |
| 30378 |
1/2✓ Branch 0 taken 29303 times.
✗ Branch 1 not taken.
|
29303 | clear_bitmap(msg_bg_display_buf); |
| 30379 |
1/2✓ Branch 0 taken 29303 times.
✗ Branch 1 not taken.
|
29303 | set_clip_state(msg_bg_display_buf, 1); |
| 30380 |
1/2✓ Branch 0 taken 29303 times.
✗ Branch 1 not taken.
|
29303 | clear_bitmap(msg_portrait_display_buf); |
| 30381 |
1/2✓ Branch 0 taken 29303 times.
✗ Branch 1 not taken.
|
29303 | set_clip_state(msg_portrait_display_buf, 1); |
| 30382 | |||
| 30383 | 29303 | viewport = new_viewport; | |
| 30384 | 29303 | playing_field_offset = new_playing_field_offset; | |
| 30385 |
1/2✓ Branch 0 taken 29303 times.
✗ Branch 1 not taken.
|
29303 | x = new_hero_x; |
| 30386 |
1/2✓ Branch 0 taken 29303 times.
✗ Branch 1 not taken.
|
29303 | y = new_hero_y; |
| 30387 |
1/2✓ Branch 0 taken 29303 times.
✗ Branch 1 not taken.
|
29303 | yofs = playing_field_offset; |
| 30388 |
2/2✓ Branch 0 taken 29301 times.
✓ Branch 1 taken 2 times.
|
29303 | if(ladderx > 0 || laddery > 0) |
| 30389 | { | ||
| 30390 | // If the ladder moves on both axes, the player can | ||
| 30391 | // gradually shift it by going back and forth | ||
| 30392 |
3/4✓ Branch 0 taken 4 times.
✓ Branch 1 taken 29299 times.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
|
29303 | if(scrolldir==up || scrolldir==down) |
| 30393 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 29299 times.
|
29299 | laddery = y.getInt(); |
| 30394 | else | ||
| 30395 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | ladderx = x.getInt(); |
| 30396 | 4 | } | |
| 30397 |
2/2✓ Branch 0 taken 35 times.
✓ Branch 1 taken 39 times.
|
4 | if (lift_wpn) |
| 30398 |
1/2✓ Branch 0 taken 35 times.
✗ Branch 1 not taken.
|
35 | lift_wpn->yofs = playing_field_offset - 2; |
| 30399 | |||
| 30400 |
10/14✓ Branch 0 taken 29303 times.
✓ Branch 1 taken 29229 times.
✓ Branch 2 taken 29303 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 29289 times.
✓ Branch 5 taken 14 times.
✓ Branch 6 taken 29289 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 29289 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 14 times.
✓ Branch 11 taken 29289 times.
✗ Branch 12 not taken.
✓ Branch 13 taken 14 times.
|
74 | if((z > 0 || fakez > 0) && isSideViewHero()) |
| 30401 | { | ||
| 30402 | ✗ | y -= z; | |
| 30403 | ✗ | y -= fakez; | |
| 30404 | ✗ | z = 0; | |
| 30405 | ✗ | fakez = 0; | |
| 30406 | ✗ | } | |
| 30407 | |||
| 30408 |
2/2✓ Branch 0 taken 29303 times.
✓ Branch 1 taken 29289 times.
|
14 | set_respawn_point(false); |
| 30409 |
1/2✓ Branch 0 taken 29303 times.
✗ Branch 1 not taken.
|
29303 | trySideviewLadder(); |
| 30410 | 29303 | warpx = -1; | |
| 30411 | 29303 | warpy = -1; | |
| 30412 | |||
| 30413 | 29303 | screenscrolling = false; | |
| 30414 | 29303 | scrolling_using_new_region_coords = false; | |
| 30415 | 29303 | scrolling_destdmap = -1; | |
| 30416 | 29303 | memset(FFCore.ScrollingData, 0, sizeof(int32_t) * SZ_SCROLLDATA); | |
| 30417 | 29303 | FFCore.ScrollingData[SCROLLDATA_DIR] = -1; | |
| 30418 | |||
| 30419 |
2/2✓ Branch 0 taken 28216 times.
✓ Branch 1 taken 1087 times.
|
29303 | if (destdmap != -1) |
| 30420 | { | ||
| 30421 | 1087 | bool changedlevel = false; | |
| 30422 | 1087 | bool changeddmap = false; | |
| 30423 |
2/2✓ Branch 0 taken 915 times.
✓ Branch 1 taken 172 times.
|
1087 | if (cur_dmap != destdmap) |
| 30424 | { | ||
| 30425 |
1/2✓ Branch 0 taken 915 times.
✗ Branch 1 not taken.
|
915 | timeExitAllGenscript(GENSCR_ST_CHANGE_DMAP); |
| 30426 | 915 | changeddmap = true; | |
| 30427 | 915 | } | |
| 30428 |
2/2✓ Branch 0 taken 184 times.
✓ Branch 1 taken 903 times.
|
1087 | if (DMaps[cur_dmap].level != DMaps[destdmap].level) |
| 30429 | { | ||
| 30430 |
1/2✓ Branch 0 taken 184 times.
✗ Branch 1 not taken.
|
184 | timeExitAllGenscript(GENSCR_ST_CHANGE_LEVEL); |
| 30431 | 184 | changedlevel = true; | |
| 30432 | 184 | } | |
| 30433 | 1087 | dlevel = DMaps[destdmap].level; | |
| 30434 | 1087 | cur_dmap = destdmap; | |
| 30435 |
2/2✓ Branch 0 taken 915 times.
✓ Branch 1 taken 172 times.
|
1087 | if (changeddmap) |
| 30436 | { | ||
| 30437 |
1/2✓ Branch 0 taken 915 times.
✗ Branch 1 not taken.
|
915 | throwGenScriptEvent(GENSCR_EVENT_CHANGE_DMAP); |
| 30438 | 915 | } | |
| 30439 |
2/2✓ Branch 0 taken 184 times.
✓ Branch 1 taken 903 times.
|
1087 | if (changedlevel) |
| 30440 | { | ||
| 30441 |
1/2✓ Branch 0 taken 184 times.
✗ Branch 1 not taken.
|
184 | throwGenScriptEvent(GENSCR_EVENT_CHANGE_LEVEL); |
| 30442 | 184 | } | |
| 30443 | 1087 | } | |
| 30444 | |||
| 30445 | //if Hero is going from non-water to water, and we set his animation to "hopping" above, we must now | ||
| 30446 | //change it to swimming - since we have manually moved Hero onto the first tile, the hopping code | ||
| 30447 | //will get confused and try to hop Hero onto the next (possibly nonexistant) water tile in his current | ||
| 30448 | //direction. -DD | ||
| 30449 | |||
| 30450 |
2/2✓ Branch 0 taken 348 times.
✓ Branch 1 taken 28955 times.
|
29303 | if(nowinwater) |
| 30451 | { | ||
| 30452 |
1/2✓ Branch 0 taken 348 times.
✗ Branch 1 not taken.
|
348 | SetSwim(); |
| 30453 | 348 | hopclk = 0xFF; | |
| 30454 | 348 | } | |
| 30455 | |||
| 30456 | // NES behaviour: Fade to light after scrolling | ||
| 30457 |
1/2✓ Branch 0 taken 29303 times.
✗ Branch 1 not taken.
|
29303 | lighting(false, false); // No, we don't need to set naturaldark... |
| 30458 | |||
| 30459 |
1/2✓ Branch 0 taken 29303 times.
✗ Branch 1 not taken.
|
29303 | init_dmap(); |
| 30460 | |||
| 30461 | // Check for raft flags | ||
| 30462 |
4/4✓ Branch 0 taken 2526 times.
✓ Branch 1 taken 26777 times.
✓ Branch 2 taken 25940 times.
✓ Branch 3 taken 57 times.
|
55300 | if((get_qr(qr_BROKEN_RAFT_SCROLL) || lastaction == rafting) |
| 30463 |
4/4✓ Branch 0 taken 26323 times.
✓ Branch 1 taken 2980 times.
✓ Branch 2 taken 25997 times.
✓ Branch 3 taken 326 times.
|
29303 | && action!=rafting && hopclk==0 && !walk_through_walls) |
| 30464 | { | ||
| 30465 |
9/16✓ Branch 0 taken 25940 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 25940 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 25940 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 25935 times.
✓ Branch 7 taken 5 times.
✓ Branch 8 taken 25935 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 25935 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 25935 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 25935 times.
✗ Branch 15 not taken.
|
25940 | if(MAPFLAG(x,y)==mfRAFT||MAPCOMBOFLAG(x,y)==mfRAFT) |
| 30466 | { | ||
| 30467 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | sfx(hero_scr->secretsfx); |
| 30468 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | action=rafting; FFCore.setHeroAction(rafting); |
| 30469 | 5 | raftclk=0; | |
| 30470 | 5 | } | |
| 30471 | |||
| 30472 | // Half a tile off? | ||
| 30473 |
16/28✓ Branch 0 taken 19656 times.
✓ Branch 1 taken 6279 times.
✓ Branch 2 taken 7071 times.
✓ Branch 3 taken 12585 times.
✓ Branch 4 taken 13350 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 13350 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 13350 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 13350 times.
✗ Branch 11 not taken.
✓ Branch 12 taken 13350 times.
✗ Branch 13 not taken.
✓ Branch 14 taken 13350 times.
✗ Branch 15 not taken.
✓ Branch 16 taken 13350 times.
✗ Branch 17 not taken.
✓ Branch 18 taken 13350 times.
✗ Branch 19 not taken.
✓ Branch 20 taken 13350 times.
✗ Branch 21 not taken.
✓ Branch 22 taken 13350 times.
✗ Branch 23 not taken.
✓ Branch 24 taken 13350 times.
✗ Branch 25 not taken.
✗ Branch 26 not taken.
✓ Branch 27 taken 25935 times.
|
39285 | else if((dir==left || dir==right) && (MAPFLAG(x,y+8)==mfRAFT||MAPCOMBOFLAG(x,y+8)==mfRAFT)) |
| 30474 | { | ||
| 30475 | ✗ | sfx(hero_scr->secretsfx); | |
| 30476 | ✗ | action=rafting; FFCore.setHeroAction(rafting); | |
| 30477 | ✗ | raftclk=0; | |
| 30478 | ✗ | } | |
| 30479 | 25940 | } | |
| 30480 | |||
| 30481 |
1/2✓ Branch 0 taken 29303 times.
✗ Branch 1 not taken.
|
59382 | for_every_base_screen_in_region([&](mapscr* scr, unsigned int region_scr_x, unsigned int region_scr_y) { |
| 30482 | 30079 | get_screen_state(scr->screen).open_doors = 0; | |
| 30483 | 30079 | }); | |
| 30484 |
1/2✓ Branch 0 taken 29303 times.
✗ Branch 1 not taken.
|
29303 | markBmap(); |
| 30485 | |||
| 30486 |
3/4✓ Branch 0 taken 29303 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 8704 times.
✓ Branch 3 taken 20599 times.
|
29303 | if (isdungeon(current_screen)) |
| 30487 | { | ||
| 30488 |
4/4✓ Branch 0 taken 5100 times.
✓ Branch 1 taken 1694 times.
✓ Branch 2 taken 1904 times.
✓ Branch 3 taken 6 times.
|
8704 | switch(hero_scr->door[scrolldir^1]) |
| 30489 | { | ||
| 30490 | case dNONE: | ||
| 30491 | 6 | dir = scrolldir; | |
| 30492 | 6 | break; | |
| 30493 | case dOPEN: | ||
| 30494 | case dUNLOCKED: | ||
| 30495 | case dOPENBOSS: | ||
| 30496 | 5100 | dir = scrolldir; | |
| 30497 | |||
| 30498 |
1/2✓ Branch 0 taken 5100 times.
✗ Branch 1 not taken.
|
5100 | if(action!=rafting) |
| 30499 |
1/2✓ Branch 0 taken 5100 times.
✗ Branch 1 not taken.
|
5100 | stepforward(diagonalMovement?11:12, false); |
| 30500 | |||
| 30501 | 5100 | break; | |
| 30502 | |||
| 30503 | case dSHUTTER: | ||
| 30504 | case d1WAYSHUTTER: | ||
| 30505 | 1694 | dir = scrolldir; | |
| 30506 | |||
| 30507 |
1/2✓ Branch 0 taken 1694 times.
✗ Branch 1 not taken.
|
1694 | if(action!=rafting) |
| 30508 |
1/2✓ Branch 0 taken 1694 times.
✗ Branch 1 not taken.
|
1694 | stepforward(diagonalMovement?21:24, false); |
| 30509 | |||
| 30510 |
1/2✓ Branch 0 taken 1694 times.
✗ Branch 1 not taken.
|
1694 | putdoor(hero_scr, scrollbuf, scrolldir^1, hero_scr->door[scrolldir^1]); |
| 30511 |
1/2✓ Branch 0 taken 1694 times.
✗ Branch 1 not taken.
|
1694 | get_screen_state(hero_scr->screen).open_doors = -4; |
| 30512 |
1/2✓ Branch 0 taken 1694 times.
✗ Branch 1 not taken.
|
1694 | sfx(WAV_DOOR); |
| 30513 | 1694 | break; | |
| 30514 | |||
| 30515 | default: | ||
| 30516 | 1904 | dir = scrolldir; | |
| 30517 | |||
| 30518 |
2/2✓ Branch 0 taken 1857 times.
✓ Branch 1 taken 47 times.
|
1904 | if(action!=rafting) |
| 30519 |
1/2✓ Branch 0 taken 1857 times.
✗ Branch 1 not taken.
|
1857 | stepforward(diagonalMovement?21:24, false); |
| 30520 | 1904 | } | |
| 30521 | 8704 | } | |
| 30522 | |||
| 30523 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 29303 times.
|
29303 | if(action == scrolling) |
| 30524 | { | ||
| 30525 | ✗ | action=none; FFCore.setHeroAction(none); | |
| 30526 | ✗ | } | |
| 30527 | |||
| 30528 |
3/4✓ Branch 0 taken 29267 times.
✓ Branch 1 taken 36 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 29267 times.
|
29303 | if(action != attacking && action != sideswimattacking) |
| 30529 | { | ||
| 30530 | 29267 | charging = 0; | |
| 30531 | 29267 | tapping = false; | |
| 30532 | 29267 | } | |
| 30533 | |||
| 30534 |
1/2✓ Branch 0 taken 29303 times.
✗ Branch 1 not taken.
|
29303 | map_bkgsfx(true); |
| 30535 | |||
| 30536 |
2/2✓ Branch 0 taken 35 times.
✓ Branch 1 taken 29268 times.
|
29303 | if(newscr->flags2&fSECRET_SFX) |
| 30537 | { | ||
| 30538 |
1/2✓ Branch 0 taken 35 times.
✗ Branch 1 not taken.
|
35 | sfx(newscr->secretsfx); |
| 30539 | 35 | } | |
| 30540 | |||
| 30541 |
1/2✓ Branch 0 taken 29303 times.
✗ Branch 1 not taken.
|
29303 | if (updatemusic) |
| 30542 | { | ||
| 30543 |
1/2✓ Branch 0 taken 29303 times.
✗ Branch 1 not taken.
|
29303 | playLevelMusic(); |
| 30544 |
1/2✓ Branch 0 taken 29303 times.
✗ Branch 1 not taken.
|
29303 | if (musicrevert) |
| 30545 | ✗ | FFCore.music_update_cond = MUSIC_UPDATE_SCREEN; | |
| 30546 | 29303 | } | |
| 30547 | |||
| 30548 | // It happens that all decorations that are not drawn with an offset | ||
| 30549 | // are temporary sprites (like combo sprites) that should never carry over. | ||
| 30550 |
3/4✓ Branch 0 taken 29303 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 29303 times.
✓ Branch 3 taken 827 times.
|
30130 | for (int i = decorations.Count()-1; i >=0; i--) |
| 30551 | { | ||
| 30552 |
1/2✓ Branch 0 taken 827 times.
✗ Branch 1 not taken.
|
827 | auto sprite = (decoration*)decorations.spr(i); |
| 30553 |
3/4✓ Branch 0 taken 827 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 14 times.
✓ Branch 3 taken 813 times.
|
827 | if (!sprite->is_drawn_with_offset()) |
| 30554 |
1/2✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
|
14 | decorations.remove(sprite); // TODO: improve deletions by adding remove_by_index |
| 30555 |
4/4✓ Branch 0 taken 799 times.
✓ Branch 1 taken 14 times.
✓ Branch 2 taken 4 times.
✓ Branch 3 taken 795 times.
|
813 | else if (old_region.region_id || new_region.region_id) |
| 30556 |
1/2✓ Branch 0 taken 18 times.
✗ Branch 1 not taken.
|
18 | sprite->yofs = playing_field_offset; |
| 30557 | 827 | } | |
| 30558 | |||
| 30559 | 29303 | newscr_clk = frame; | |
| 30560 | 29303 | activated_timed_warp=false; | |
| 30561 | 29303 | loadside = scrolldir^1; | |
| 30562 |
1/2✓ Branch 0 taken 29303 times.
✗ Branch 1 not taken.
|
29303 | FFCore.clear_combo_scripts(); |
| 30563 |
1/2✓ Branch 0 taken 29303 times.
✗ Branch 1 not taken.
|
29303 | eventlog_mapflags(); |
| 30564 |
1/2✓ Branch 0 taken 29303 times.
✗ Branch 1 not taken.
|
29303 | decorations.animate(); //continue to animate tall grass during scrolling |
| 30565 |
2/2✓ Branch 0 taken 3237 times.
✓ Branch 1 taken 26066 times.
|
29303 | if(get_qr(qr_FIXSCRIPTSDURINGSCROLLING)) |
| 30566 | { | ||
| 30567 |
5/6✓ Branch 0 taken 104 times.
✓ Branch 1 taken 3133 times.
✓ Branch 2 taken 104 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 6 times.
✓ Branch 5 taken 98 times.
|
3237 | if (old_dmap == new_dmap || (replay_version_check(0, 15))) |
| 30568 | { | ||
| 30569 |
1/2✓ Branch 0 taken 3139 times.
✗ Branch 1 not taken.
|
3139 | ZScriptVersion::RunScrollingScript(scrolldir, scroll_counter, sx, sy, end_frames, false); //Prewaitdraw |
| 30570 | 3139 | } | |
| 30571 | 3237 | } | |
| 30572 | |||
| 30573 | // Bye! | ||
| 30574 |
2/2✓ Branch 0 taken 6003170 times.
✓ Branch 1 taken 6032473 times.
|
29303 | delete_temporary_screens(old_temporary_screens.data()); |
| 30575 | 6003170 | FFCore.ScrollingScreensAll.clear(); | |
| 30576 | |||
| 30577 |
2/2✓ Branch 0 taken 6001714 times.
✓ Branch 1 taken 1456 times.
|
6003170 | if(!get_qr(qr_SCROLLWARP_NO_RESET_FRAME)) |
| 30578 | 1456 | GameFlags |= GAMEFLAG_RESET_GAME_LOOP; | |
| 30579 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 6003173 times.
|
18068119 | } |
| 30580 | |||
| 30581 | // How much to reduce Hero's damage, taking into account various rings. | ||
| 30582 | 15807 | int32_t HeroClass::ringpower(int32_t dmg, bool noPeril, bool noRing) | |
| 30583 | { | ||
| 30584 |
1/2✓ Branch 0 taken 15807 times.
✗ Branch 1 not taken.
|
15807 | if(dmg < 0) return dmg; //Don't reduce healing |
| 30585 |
2/2✓ Branch 0 taken 14539 times.
✓ Branch 1 taken 1268 times.
|
15807 | if ( get_qr(qr_BROKEN_RING_POWER) ) |
| 30586 | { | ||
| 30587 | 14539 | int32_t divisor = 1; | |
| 30588 | 14539 | float percentage = 1; | |
| 30589 | 14539 | int32_t itemid = current_item_id(itype_ring); | |
| 30590 | 14539 | bool usering = false; | |
| 30591 | |||
| 30592 |
4/4✓ Branch 0 taken 10813 times.
✓ Branch 1 taken 3726 times.
✓ Branch 2 taken 324 times.
✓ Branch 3 taken 10489 times.
|
14539 | if(itemid>-1 && !noRing) // current_item_id checks magic cost for rings |
| 30593 | { | ||
| 30594 | 10489 | usering = true; | |
| 30595 | 10489 | paymagiccost(itemid); | |
| 30596 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 10489 times.
|
10489 | if(itemsbuf[itemid].flags & item_flag2)//"Divisor is Percentage Multiplier" flag |
| 30597 | { | ||
| 30598 | ✗ | percentage *= itemsbuf[itemid].power/100.0; | |
| 30599 | ✗ | } | |
| 30600 | else | ||
| 30601 | { | ||
| 30602 | 10489 | divisor *= itemsbuf[itemid].power; | |
| 30603 | } | ||
| 30604 | 10489 | } | |
| 30605 | |||
| 30606 | /* Now for the Peril Ring */ | ||
| 30607 | 14539 | itemid = current_item_id(itype_perilring); | |
| 30608 | |||
| 30609 |
8/10✓ Branch 0 taken 2844 times.
✓ Branch 1 taken 11695 times.
✓ Branch 2 taken 2698 times.
✓ Branch 3 taken 146 times.
✓ Branch 4 taken 402 times.
✓ Branch 5 taken 2296 times.
✓ Branch 6 taken 402 times.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✓ Branch 9 taken 402 times.
|
14539 | if(itemid>-1 && !noPeril && game->get_life()<=itemsbuf[itemid].misc1*game->get_hp_per_heart() && checkmagiccost(itemid) && checkbunny(itemid)) |
| 30610 | { | ||
| 30611 | 402 | usering = true; | |
| 30612 | 402 | paymagiccost(itemid); | |
| 30613 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 402 times.
|
402 | if(itemsbuf[itemid].flags & item_flag2)//"Divisor is Percentage Multiplier" flag |
| 30614 | { | ||
| 30615 | ✗ | percentage *= itemsbuf[itemid].power/100.0; | |
| 30616 | ✗ | } | |
| 30617 | else | ||
| 30618 | { | ||
| 30619 | 402 | divisor *= itemsbuf[itemid].power; | |
| 30620 | } | ||
| 30621 | 402 | } | |
| 30622 | |||
| 30623 | // Ring divisor of 0 = no damage. -L | ||
| 30624 |
4/6✓ Branch 0 taken 10507 times.
✓ Branch 1 taken 4032 times.
✓ Branch 2 taken 10507 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 10507 times.
|
14539 | if(usering && (divisor==0 || percentage==0)) //Change dto allow negative power rings. -Z |
| 30625 | ✗ | return 0; | |
| 30626 | |||
| 30627 |
1/2✓ Branch 0 taken 14539 times.
✗ Branch 1 not taken.
|
14539 | if( percentage < 0 ) percentage = (percentage * -1) + 1; //Negative percentage = that percent MORE damage -V |
| 30628 | |||
| 30629 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 14539 times.
|
14539 | if ( divisor < 0 ) return dmg * percentage * (divisor*-1); |
| 30630 |
1/2✓ Branch 0 taken 14539 times.
✗ Branch 1 not taken.
|
14539 | return dmg*percentage/( divisor != 0 ? divisor : 1 ); //zc_max(divisor, 1); // well, better safe... |
| 30631 | |||
| 30632 | } | ||
| 30633 | else | ||
| 30634 | { | ||
| 30635 | 1268 | double divisor = 1; | |
| 30636 | 1268 | double percentage = 1; | |
| 30637 | 1268 | int32_t itemid = current_item_id(itype_ring); | |
| 30638 | 1268 | bool usering = false; | |
| 30639 | |||
| 30640 |
3/4✓ Branch 0 taken 37 times.
✓ Branch 1 taken 1231 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 37 times.
|
1268 | if(itemid>-1 && !noRing) // current_item_id checks magic cost for rings |
| 30641 | { | ||
| 30642 | 37 | usering = true; | |
| 30643 | 37 | paymagiccost(itemid); | |
| 30644 |
2/2✓ Branch 0 taken 35 times.
✓ Branch 1 taken 2 times.
|
37 | if(itemsbuf[itemid].flags & item_flag2)//"Divisor is Percentage Multiplier" flag |
| 30645 | { | ||
| 30646 | 35 | double perc = itemsbuf[itemid].power/100.0; | |
| 30647 |
1/2✓ Branch 0 taken 35 times.
✗ Branch 1 not taken.
|
35 | if(perc < 0) perc = -perc + 1; //Negative percentage = that percent MORE damage -V |
| 30648 | 35 | percentage *= perc; | |
| 30649 | 35 | } | |
| 30650 | else | ||
| 30651 | { | ||
| 30652 |
1/2✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
|
2 | if(itemsbuf[itemid].power < 0) |
| 30653 | ✗ | divisor /= -(itemsbuf[itemid].power); | |
| 30654 | 2 | else divisor *= itemsbuf[itemid].power; | |
| 30655 | } | ||
| 30656 | 37 | } | |
| 30657 | |||
| 30658 | /* Now for the Peril Ring */ | ||
| 30659 | 1268 | itemid = current_item_id(itype_perilring); | |
| 30660 | |||
| 30661 |
4/10✓ Branch 0 taken 6 times.
✓ Branch 1 taken 1262 times.
✓ Branch 2 taken 6 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 6 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
1268 | if(itemid>-1 && !noPeril && game->get_life()<=itemsbuf[itemid].misc1*game->get_hp_per_heart() && checkmagiccost(itemid) && checkbunny(itemid)) |
| 30662 | { | ||
| 30663 | ✗ | usering = true; | |
| 30664 | ✗ | paymagiccost(itemid); | |
| 30665 | ✗ | if(itemsbuf[itemid].flags & item_flag2)//"Divisor is Percentage Multiplier" flag | |
| 30666 | { | ||
| 30667 | ✗ | double perc = itemsbuf[itemid].power/100.0; | |
| 30668 | ✗ | if(perc < 0) perc = -perc + 1; //Negative percentage = that percent MORE damage -V | |
| 30669 | ✗ | percentage *= perc; | |
| 30670 | ✗ | } | |
| 30671 | else | ||
| 30672 | { | ||
| 30673 | ✗ | if(itemsbuf[itemid].power < 0) | |
| 30674 | ✗ | divisor /= -(itemsbuf[itemid].power); | |
| 30675 | ✗ | else divisor *= itemsbuf[itemid].power; | |
| 30676 | } | ||
| 30677 | ✗ | } | |
| 30678 | |||
| 30679 | // Ring divisor of 0 = no damage. -L | ||
| 30680 |
4/6✓ Branch 0 taken 37 times.
✓ Branch 1 taken 1231 times.
✓ Branch 2 taken 37 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 37 times.
|
1268 | if(usering && (divisor==0 || percentage==0)) //Change dto allow negative power rings. -Z |
| 30681 | ✗ | return 0; | |
| 30682 | |||
| 30683 | //if ( divisor < 0 ) return dmg * percentage * (divisor*-1); //handle this further up now | ||
| 30684 |
1/2✓ Branch 0 taken 1268 times.
✗ Branch 1 not taken.
|
1268 | return dmg*percentage/( divisor != 0 ? divisor : 1 ); //zc_max(divisor, 1); // well, better safe... |
| 30685 | } | ||
| 30686 | 15807 | } | |
| 30687 | |||
| 30688 | // Should swinging the hammer make the 'pound' sound? | ||
| 30689 | // Or is Hero just hitting air? | ||
| 30690 | 6941 | bool HeroClass::sideviewhammerpound() | |
| 30691 | { | ||
| 30692 | 6941 | int32_t wx=0,wy=0; | |
| 30693 | |||
| 30694 |
4/5✗ Branch 0 not taken.
✓ Branch 1 taken 1146 times.
✓ Branch 2 taken 1610 times.
✓ Branch 3 taken 2268 times.
✓ Branch 4 taken 1917 times.
|
6941 | switch(dir) |
| 30695 | { | ||
| 30696 | case up: | ||
| 30697 | 1146 | wx=-1; | |
| 30698 | 1146 | wy=-15; | |
| 30699 | |||
| 30700 |
1/2✓ Branch 0 taken 1146 times.
✗ Branch 1 not taken.
|
1146 | if(isSideViewHero()) wy+=8; |
| 30701 | |||
| 30702 | 1146 | break; | |
| 30703 | |||
| 30704 | case down: | ||
| 30705 | 1610 | wx=8; | |
| 30706 | 1610 | wy=28; | |
| 30707 | |||
| 30708 |
1/2✓ Branch 0 taken 1610 times.
✗ Branch 1 not taken.
|
1610 | if(isSideViewHero()) wy-=8; |
| 30709 | |||
| 30710 | 1610 | break; | |
| 30711 | |||
| 30712 | case left: | ||
| 30713 | 2268 | wx=-8; | |
| 30714 | 2268 | wy=14; | |
| 30715 | |||
| 30716 |
2/2✓ Branch 0 taken 2256 times.
✓ Branch 1 taken 12 times.
|
2268 | if(isSideViewHero()) wy+=8; |
| 30717 | |||
| 30718 | 2268 | break; | |
| 30719 | |||
| 30720 | case right: | ||
| 30721 | 1917 | wx=21; | |
| 30722 | 1917 | wy=14; | |
| 30723 | |||
| 30724 |
1/2✓ Branch 0 taken 1917 times.
✗ Branch 1 not taken.
|
1917 | if(isSideViewHero()) wy+=8; |
| 30725 | |||
| 30726 | 1917 | break; | |
| 30727 | } | ||
| 30728 | |||
| 30729 |
2/2✓ Branch 0 taken 12 times.
✓ Branch 1 taken 6929 times.
|
6941 | if(!isSideViewHero()) |
| 30730 | { | ||
| 30731 |
2/2✓ Branch 0 taken 9 times.
✓ Branch 1 taken 6920 times.
|
6929 | return (COMBOTYPE(x+wx,y+wy)!=cSHALLOWWATER && !iswaterex_z3(MAPCOMBO(x+wx,y+wy), -1, x+wx,y+wy)); |
| 30732 | } | ||
| 30733 | |||
| 30734 |
1/2✓ Branch 0 taken 12 times.
✗ Branch 1 not taken.
|
12 | if(_walkflag(x+wx,y+wy,0,get_standing_z_state())) return true; |
| 30735 | |||
| 30736 | ✗ | if(dir==left || dir==right) | |
| 30737 | { | ||
| 30738 | ✗ | wx+=16; | |
| 30739 | |||
| 30740 | ✗ | if(_walkflag(x+wx,y+wy,0,get_standing_z_state())) return true; | |
| 30741 | ✗ | } | |
| 30742 | |||
| 30743 | ✗ | return false; | |
| 30744 | 6941 | } | |
| 30745 | |||
| 30746 | // The following are only used for Hero damage. Damage is in quarter hearts. | ||
| 30747 | 9566 | int32_t enemy_dp(int32_t index) | |
| 30748 | { | ||
| 30749 | 9566 | return (((enemy*)guys.spr(index))->dp)*(game->get_ene_dmgmult()); | |
| 30750 | } | ||
| 30751 | |||
| 30752 | 5650 | int32_t ewpn_dp(int32_t index) | |
| 30753 | { | ||
| 30754 | 5650 | return (((weapon*)Ewpns.spr(index))->power)*(game->get_ene_dmgmult()); | |
| 30755 | } | ||
| 30756 | |||
| 30757 | 71 | int32_t lwpn_dp(int32_t index) | |
| 30758 | { | ||
| 30759 | 71 | return (((weapon*)Lwpns.spr(index))->power)*(game->get_ene_dmgmult()); | |
| 30760 | } | ||
| 30761 | |||
| 30762 | 143105043 | bool checkbunny(int32_t itemid) | |
| 30763 | { | ||
| 30764 |
3/4✓ Branch 0 taken 143008047 times.
✓ Branch 1 taken 96996 times.
✓ Branch 2 taken 96996 times.
✗ Branch 3 not taken.
|
143105043 | return !Hero.BunnyClock() || (itemid > 0 && itemsbuf[itemid].flags&item_bunny_enabled); |
| 30765 | } | ||
| 30766 | |||
| 30767 | 17150444 | bool usesSwordJinx(int32_t itemid) | |
| 30768 | { | ||
| 30769 | 17150444 | itemdata const& it = itemsbuf[itemid]; | |
| 30770 | 17150444 | bool ret = (it.type==itype_sword); | |
| 30771 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 17150444 times.
|
17150444 | if(it.flags & item_flip_jinx) return !ret; |
| 30772 | 17150444 | return ret; | |
| 30773 | 17150444 | } | |
| 30774 | 42148132 | bool checkitem_jinx(int32_t itemid) | |
| 30775 | { | ||
| 30776 | 42148132 | itemdata const& it = itemsbuf[itemid]; | |
| 30777 |
2/2✓ Branch 0 taken 4150 times.
✓ Branch 1 taken 42143982 times.
|
42148132 | if(it.flags & item_jinx_immune) return true; |
| 30778 |
2/2✓ Branch 0 taken 32482761 times.
✓ Branch 1 taken 9661221 times.
|
42143982 | if (it.type == itype_shield){ |
| 30779 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32482761 times.
|
32482761 | if(HeroShieldClk() != 0) return false; |
| 30780 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 32482761 times.
|
32482761 | if(it.flags & !item_flag9) //Active Shields should also check sword/item jinx flags |
| 30781 | { | ||
| 30782 | ✗ | if (usesSwordJinx(itemid)) return HeroSwordClk() == 0; | |
| 30783 | ✗ | return HeroItemClk() == 0; | |
| 30784 | } | ||
| 30785 | 32482761 | return true; | |
| 30786 | |||
| 30787 | } | ||
| 30788 |
2/2✓ Branch 0 taken 8801390 times.
✓ Branch 1 taken 859831 times.
|
9661221 | if(usesSwordJinx(itemid)) return HeroSwordClk() == 0; |
| 30789 | 859831 | return HeroItemClk() == 0; | |
| 30790 | 42148132 | } | |
| 30791 | |||
| 30792 | 2 | void stopCaneOfByrna() | |
| 30793 | { | ||
| 30794 |
2/2✓ Branch 0 taken 40 times.
✓ Branch 1 taken 2 times.
|
42 | for (int32_t i = 0; i < Lwpns.Count(); i++) |
| 30795 | { | ||
| 30796 | 40 | weapon* w = ((weapon*)Lwpns.spr(i)); | |
| 30797 |
3/4✓ Branch 0 taken 2 times.
✓ Branch 1 taken 38 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
|
40 | if (w->id == wCByrna && !w->weapon_dying_frame) |
| 30798 | 2 | w->dead = 1; | |
| 30799 | 40 | } | |
| 30800 | 2 | } | |
| 30801 | |||
| 30802 | //Check if there are no beams, kill sfx, and reset last_cane_of_byrna_item_id | ||
| 30803 | 14834553 | void HeroClass::cleanupByrna() | |
| 30804 | { | ||
| 30805 |
2/2✓ Branch 0 taken 14834476 times.
✓ Branch 1 taken 77 times.
|
14834553 | if ( last_cane_of_byrna_item_id > -1 ) |
| 30806 | { | ||
| 30807 |
2/2✓ Branch 0 taken 2 times.
✓ Branch 1 taken 75 times.
|
77 | if ( !(Lwpns.idCount(wCByrna)) ) |
| 30808 | { | ||
| 30809 | 2 | stop_sfx(itemsbuf[last_cane_of_byrna_item_id].usesound); | |
| 30810 | 2 | last_cane_of_byrna_item_id = -1; | |
| 30811 | 2 | } | |
| 30812 | 77 | } | |
| 30813 | 14834553 | } | |
| 30814 | |||
| 30815 | // Used to find out if an item family is attached to one of the buttons currently pressed. | ||
| 30816 | 4608610 | bool isWpnPressed(int32_t itype) | |
| 30817 | { | ||
| 30818 |
4/4✓ Branch 0 taken 540837 times.
✓ Branch 1 taken 4067773 times.
✓ Branch 2 taken 469758 times.
✓ Branch 3 taken 71079 times.
|
4608610 | if ((itype == getItemFamily(itemsbuf, Bwpn)) && getInput(btnB, INPUT_DRUNK | INPUT_HERO_ACTION)) return true; |
| 30819 |
4/4✓ Branch 0 taken 1671437 times.
✓ Branch 1 taken 2866094 times.
✓ Branch 2 taken 680936 times.
✓ Branch 3 taken 990501 times.
|
4537531 | if ((itype == getItemFamily(itemsbuf, Awpn)) && getInput(btnA, INPUT_DRUNK | INPUT_HERO_ACTION)) return true; |
| 30820 |
4/4✓ Branch 0 taken 1430 times.
✓ Branch 1 taken 3545600 times.
✓ Branch 2 taken 566 times.
✓ Branch 3 taken 864 times.
|
3547030 | if ((itype == getItemFamily(itemsbuf, Xwpn)) && getInput(btnEx1, INPUT_DRUNK | INPUT_HERO_ACTION)) return true; |
| 30821 |
4/4✓ Branch 0 taken 62 times.
✓ Branch 1 taken 3546104 times.
✓ Branch 2 taken 35 times.
✓ Branch 3 taken 27 times.
|
3546166 | if ((itype == getItemFamily(itemsbuf, Ywpn)) && getInput(btnEx2, INPUT_DRUNK | INPUT_HERO_ACTION)) return true; |
| 30822 | 3546131 | return false; | |
| 30823 | 4608610 | } | |
| 30824 | |||
| 30825 | 14247167 | int32_t getWpnPressed(int32_t itype) | |
| 30826 | { | ||
| 30827 |
4/4✓ Branch 0 taken 403543 times.
✓ Branch 1 taken 13843624 times.
✓ Branch 2 taken 394816 times.
✓ Branch 3 taken 8727 times.
|
14247167 | if ((itype == getItemFamily(itemsbuf, Bwpn)) && getInput(btnB, INPUT_DRUNK | INPUT_HERO_ACTION)) return Bwpn & 0xFFF; |
| 30828 |
4/4✓ Branch 0 taken 33678 times.
✓ Branch 1 taken 14204762 times.
✓ Branch 2 taken 152 times.
✓ Branch 3 taken 33526 times.
|
14238440 | if ((itype == getItemFamily(itemsbuf, Awpn)) && getInput(btnA, INPUT_DRUNK | INPUT_HERO_ACTION)) return Awpn & 0xFFF; |
| 30829 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 14204914 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
14204914 | if ((itype == getItemFamily(itemsbuf, Xwpn)) && getInput(btnEx1, INPUT_DRUNK | INPUT_HERO_ACTION)) return Xwpn & 0xFFF; |
| 30830 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 14204914 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
14204914 | if ((itype == getItemFamily(itemsbuf, Ywpn)) && getInput(btnEx2, INPUT_DRUNK | INPUT_HERO_ACTION)) return Ywpn & 0xFFF; |
| 30831 | |||
| 30832 | 14204914 | return -1; | |
| 30833 | 14247167 | } | |
| 30834 | |||
| 30835 | 14837094 | int32_t getRocsPressed() | |
| 30836 | { | ||
| 30837 | 14837094 | int32_t jumpid = current_item_id(itype_rocs,true,true); | |
| 30838 | |||
| 30839 |
2/2✓ Branch 0 taken 402236 times.
✓ Branch 1 taken 14434858 times.
|
14837094 | if(unsigned(jumpid) >= MAXITEMS) jumpid = -1; |
| 30840 | |||
| 30841 |
2/2✓ Branch 0 taken 14434858 times.
✓ Branch 1 taken 402236 times.
|
14837094 | if (jumpid != -1) |
| 30842 | { | ||
| 30843 | 402236 | itemdata const& itm = itemsbuf[jumpid]; | |
| 30844 | |||
| 30845 | 402236 | byte intbtn = byte(itm.misc2&0xFF); | |
| 30846 |
1/2✓ Branch 0 taken 402236 times.
✗ Branch 1 not taken.
|
402236 | if (getIntBtnInput(intbtn, INPUT_DRUNK | INPUT_PEEK)) |
| 30847 | ✗ | return jumpid; //not pressed | |
| 30848 | 402236 | } | |
| 30849 | |||
| 30850 |
4/4✓ Branch 0 taken 124019 times.
✓ Branch 1 taken 14713075 times.
✓ Branch 2 taken 117932 times.
✓ Branch 3 taken 6087 times.
|
14837094 | if ((itype_rocs == getItemFamily(itemsbuf, Bwpn)) && getInput(btnB, INPUT_DRUNK | INPUT_HERO_ACTION)) |
| 30851 | 6087 | return Bwpn; | |
| 30852 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 14831007 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
14831007 | if ((itype_rocs == getItemFamily(itemsbuf, Awpn)) && getInput(btnA, INPUT_DRUNK | INPUT_HERO_ACTION)) |
| 30853 | ✗ | return Awpn; | |
| 30854 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 14831007 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
14831007 | if ((itype_rocs == getItemFamily(itemsbuf, Xwpn)) && getInput(btnEx1, INPUT_DRUNK | INPUT_HERO_ACTION)) |
| 30855 | ✗ | return Xwpn; | |
| 30856 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 14831007 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
14831007 | if ((itype_rocs == getItemFamily(itemsbuf, Ywpn)) && getInput(btnEx2, INPUT_DRUNK | INPUT_HERO_ACTION)) |
| 30857 | ✗ | return Ywpn; | |
| 30858 | |||
| 30859 | 14831007 | return -1; | |
| 30860 | 14837094 | } | |
| 30861 | |||
| 30862 | ✗ | bool isItmPressed(int32_t itmid) | |
| 30863 | { | ||
| 30864 | ✗ | if (itmid == (NEG_OR_MASK(Bwpn, 0xFFF)) && getInput(btnB, INPUT_DRUNK | INPUT_HERO_ACTION)) return true; | |
| 30865 | ✗ | if (itmid == (NEG_OR_MASK(Awpn, 0xFFF)) && getInput(btnA, INPUT_DRUNK | INPUT_HERO_ACTION)) return true; | |
| 30866 | ✗ | if (itmid == (NEG_OR_MASK(Xwpn, 0xFFF)) && getInput(btnEx1, INPUT_DRUNK | INPUT_HERO_ACTION)) return true; | |
| 30867 | ✗ | if (itmid == (NEG_OR_MASK(Ywpn, 0xFFF)) && getInput(btnEx2, INPUT_DRUNK | INPUT_HERO_ACTION)) return true; | |
| 30868 | ✗ | return false; | |
| 30869 | ✗ | } | |
| 30870 | |||
| 30871 | //helper function | ||
| 30872 | 24539 | static void selectNextBTNWpn(int32_t type, word& wpos, int32_t& BTNwpn, | |
| 30873 | int32_t& directItemBTN, word f1 = 255, word f2 = 255, word f3 = 255) | ||
| 30874 | { | ||
| 30875 |
1/2✓ Branch 0 taken 24539 times.
✗ Branch 1 not taken.
|
24539 | if(!new_subscreen_active) |
| 30876 | ✗ | return; | |
| 30877 | 24539 | byte pgn = wpos&0xFF, pos = wpos>>8; | |
| 30878 | 24539 | bool empty = pgn==255; | |
| 30879 |
3/4✓ Branch 0 taken 9898 times.
✓ Branch 1 taken 14641 times.
✓ Branch 2 taken 9898 times.
✗ Branch 3 not taken.
|
24539 | if(empty && get_qr(qr_NO_BUTTON_VERIFY)) return; //intentional nothingness |
| 30880 |
2/2✓ Branch 0 taken 9898 times.
✓ Branch 1 taken 14641 times.
|
24539 | SubscrPage* pg = new_subscreen_active->get_page(pgn==255?new_subscreen_active->curpage:pgn); |
| 30881 |
1/2✓ Branch 0 taken 24539 times.
✗ Branch 1 not taken.
|
24539 | if(!pg) |
| 30882 | ✗ | return; | |
| 30883 |
4/6✓ Branch 0 taken 22497 times.
✓ Branch 1 taken 2042 times.
✓ Branch 2 taken 2042 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 2042 times.
|
24539 | auto fp1 = ((f1&0xFF)==255) ? 255 : ((empty || (f1&0xFF)==(wpos&0xFF)) ? f1 : 255); |
| 30884 |
4/6✓ Branch 0 taken 24535 times.
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 4 times.
|
24539 | auto fp2 = ((f2&0xFF)==255) ? 255 : ((empty || (f2&0xFF)==(wpos&0xFF)) ? f2 : 255); |
| 30885 |
4/6✓ Branch 0 taken 24535 times.
✓ Branch 1 taken 4 times.
✓ Branch 2 taken 4 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 4 times.
|
24539 | auto fp3 = ((f3&0xFF)==255) ? 255 : ((empty || (f3&0xFF)==(wpos&0xFF)) ? f3 : 255); |
| 30886 | 24539 | auto ret = pg->movepos_legacy(type, wpos, fp1, fp2, fp3); | |
| 30887 |
2/2✓ Branch 0 taken 9898 times.
✓ Branch 1 taken 14641 times.
|
24539 | if((ret&0xFF) == 0xFF) |
| 30888 | 9898 | BTNwpn = -1; | |
| 30889 | 14641 | else BTNwpn = pg->get_item_pos(ret>>8); | |
| 30890 |
2/2✓ Branch 0 taken 14641 times.
✓ Branch 1 taken 9898 times.
|
24539 | directItemBTN = NEG_OR_MASK(BTNwpn,0xFFF); |
| 30891 | 24539 | wpos = ret; | |
| 30892 | 24539 | } | |
| 30893 | 5661 | void selectNextAWpn(int32_t type) | |
| 30894 | { | ||
| 30895 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5661 times.
|
5661 | if(!get_qr(qr_SELECTAWPN)) |
| 30896 | ✗ | return; | |
| 30897 |
2/4✓ Branch 0 taken 5661 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 5661 times.
|
5661 | selectNextBTNWpn(type, game->awpn, Awpn, directItemA, COND_BWPN, COND_XWPN, COND_YWPN); |
| 30898 | 5661 | } | |
| 30899 | |||
| 30900 | 18878 | void selectNextBWpn(int32_t type) | |
| 30901 | { | ||
| 30902 |
1/2✓ Branch 0 taken 18878 times.
✗ Branch 1 not taken.
|
18878 | if(!new_subscreen_active) |
| 30903 | ✗ | return; | |
| 30904 |
6/6✓ Branch 0 taken 12897 times.
✓ Branch 1 taken 5981 times.
✓ Branch 2 taken 18874 times.
✓ Branch 3 taken 4 times.
✓ Branch 4 taken 4 times.
✓ Branch 5 taken 18874 times.
|
18878 | selectNextBTNWpn(type, game->bwpn, Bwpn, directItemB, COND_AWPN, COND_XWPN, COND_YWPN); |
| 30905 | 18878 | } | |
| 30906 | |||
| 30907 | ✗ | void selectNextXWpn(int32_t type) | |
| 30908 | { | ||
| 30909 | ✗ | if(!get_qr(qr_SET_XBUTTON_ITEMS)) return; | |
| 30910 | ✗ | if(!new_subscreen_active) | |
| 30911 | ✗ | return; | |
| 30912 | ✗ | selectNextBTNWpn(type, game->xwpn, Xwpn, directItemX, COND_BWPN, COND_AWPN, COND_YWPN); | |
| 30913 | ✗ | } | |
| 30914 | |||
| 30915 | ✗ | void selectNextYWpn(int32_t type) | |
| 30916 | { | ||
| 30917 | ✗ | if(!get_qr(qr_SET_YBUTTON_ITEMS)) return; | |
| 30918 | ✗ | if(!new_subscreen_active) | |
| 30919 | ✗ | return; | |
| 30920 | ✗ | selectNextBTNWpn(type, game->ywpn, Ywpn, directItemY, COND_BWPN, COND_XWPN, COND_AWPN); | |
| 30921 | ✗ | } | |
| 30922 | |||
| 30923 | //helper function | ||
| 30924 | 35178487 | static void verifyWpn(word& wpos, int32_t& BTNwpn, int32_t& directItemBTN, word f1 = 255, word f2 = 255, word f3 = 255) | |
| 30925 | { | ||
| 30926 |
2/2✓ Branch 0 taken 35170016 times.
✓ Branch 1 taken 8471 times.
|
35178487 | if(!new_subscreen_active) |
| 30927 | 8471 | return; | |
| 30928 | 35170016 | byte pgn = wpos&0xFF, pos = wpos>>8; | |
| 30929 | 35170016 | bool empty = pgn==255; | |
| 30930 |
4/4✓ Branch 0 taken 2610015 times.
✓ Branch 1 taken 32560001 times.
✓ Branch 2 taken 1036890 times.
✓ Branch 3 taken 1573125 times.
|
35170016 | if(empty && get_qr(qr_NO_BUTTON_VERIFY)) return; //intentional nothingness |
| 30931 |
2/2✓ Branch 0 taken 1036890 times.
✓ Branch 1 taken 32560001 times.
|
33596891 | SubscrPage* pg = new_subscreen_active->get_page(pgn==255?new_subscreen_active->curpage:pgn); |
| 30932 |
1/2✓ Branch 0 taken 33596891 times.
✗ Branch 1 not taken.
|
33596891 | if(!pg) |
| 30933 | ✗ | return; | |
| 30934 |
5/6✓ Branch 0 taken 22846839 times.
✓ Branch 1 taken 10750052 times.
✓ Branch 2 taken 10691106 times.
✓ Branch 3 taken 58946 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 10691106 times.
|
33596891 | auto fp1 = ((f1&0xFF)==255) ? 255 : ((empty || (f1&0xFF)==(wpos&0xFF)) ? f1 : 255); |
| 30935 |
5/6✓ Branch 0 taken 27599302 times.
✓ Branch 1 taken 5997589 times.
✓ Branch 2 taken 5996981 times.
✓ Branch 3 taken 608 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 5996981 times.
|
33596891 | auto fp2 = ((f2&0xFF)==255) ? 255 : ((empty || (f2&0xFF)==(wpos&0xFF)) ? f2 : 255); |
| 30936 |
5/6✓ Branch 0 taken 28403659 times.
✓ Branch 1 taken 5193232 times.
✓ Branch 2 taken 5193194 times.
✓ Branch 3 taken 38 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 5193194 times.
|
33596891 | auto fp3 = ((f3&0xFF)==255) ? 255 : ((empty || (f3&0xFF)==(wpos&0xFF)) ? f3 : 255); |
| 30937 | 33596891 | wpos = pg->movepos_legacy(SEL_VERIFY_RIGHT, wpos, fp1, fp2, fp3); | |
| 30938 |
2/2✓ Branch 0 taken 1036718 times.
✓ Branch 1 taken 32560173 times.
|
33596891 | if((wpos&0xFF) == 0xFF) |
| 30939 | 1036718 | BTNwpn = -1; | |
| 30940 | 32560173 | else BTNwpn = pg->get_item_pos(wpos>>8); | |
| 30941 |
2/2✓ Branch 0 taken 32285233 times.
✓ Branch 1 taken 1311658 times.
|
33596891 | directItemBTN = NEG_OR_MASK(BTNwpn,0xFFF); |
| 30942 | 35178487 | } | |
| 30943 | |||
| 30944 | 25848933 | void verifyAWpn() | |
| 30945 | { | ||
| 30946 |
2/2✓ Branch 0 taken 22739 times.
✓ Branch 1 taken 25826194 times.
|
25848933 | if (game->forced_awpn != -1) |
| 30947 | 22739 | return; | |
| 30948 |
2/2✓ Branch 0 taken 3020077 times.
✓ Branch 1 taken 22806117 times.
|
25826194 | if(!get_qr(qr_SELECTAWPN)) |
| 30949 | { | ||
| 30950 | 22806117 | Awpn = selectSword(); | |
| 30951 | 22806117 | game->awpn = 255; | |
| 30952 | 22806117 | } | |
| 30953 | else | ||
| 30954 | { | ||
| 30955 |
4/4✓ Branch 0 taken 2469807 times.
✓ Branch 1 taken 550270 times.
✓ Branch 2 taken 550270 times.
✓ Branch 3 taken 2469807 times.
|
3020077 | verifyWpn(game->awpn, Awpn, directItemA, COND_BWPN, COND_XWPN, COND_YWPN); |
| 30956 | } | ||
| 30957 | 25848933 | } | |
| 30958 | |||
| 30959 | 25842347 | void verifyBWpn() | |
| 30960 | { | ||
| 30961 |
2/2✓ Branch 0 taken 22733 times.
✓ Branch 1 taken 25819614 times.
|
25842347 | if (game->forced_bwpn != -1) |
| 30962 | 22733 | return; | |
| 30963 |
6/6✓ Branch 0 taken 3019030 times.
✓ Branch 1 taken 22800584 times.
✓ Branch 2 taken 3169398 times.
✓ Branch 3 taken 22650216 times.
✓ Branch 4 taken 3169398 times.
✓ Branch 5 taken 22650216 times.
|
25819614 | verifyWpn(game->bwpn, Bwpn, directItemB, COND_AWPN, COND_XWPN, COND_YWPN); |
| 30964 | 25842347 | } | |
| 30965 | |||
| 30966 | 25842347 | void verifyXWpn() | |
| 30967 | { | ||
| 30968 |
2/2✓ Branch 0 taken 3753 times.
✓ Branch 1 taken 25838594 times.
|
25842347 | if (game->forced_xwpn != -1) |
| 30969 | 3753 | return; | |
| 30970 |
2/2✓ Branch 0 taken 3169398 times.
✓ Branch 1 taken 22669196 times.
|
25838594 | if(!get_qr(qr_SET_XBUTTON_ITEMS)) |
| 30971 | 22669196 | return; | |
| 30972 |
3/4✓ Branch 0 taken 2619821 times.
✓ Branch 1 taken 549577 times.
✓ Branch 2 taken 3169398 times.
✗ Branch 3 not taken.
|
3169398 | verifyWpn(game->xwpn, Xwpn, directItemX, COND_BWPN, COND_AWPN, COND_YWPN); |
| 30973 | 25842347 | } | |
| 30974 | |||
| 30975 | 25842347 | void verifyYWpn() | |
| 30976 | { | ||
| 30977 |
2/2✓ Branch 0 taken 3753 times.
✓ Branch 1 taken 25838594 times.
|
25842347 | if (game->forced_ywpn != -1) |
| 30978 | 3753 | return; | |
| 30979 |
2/2✓ Branch 0 taken 3169398 times.
✓ Branch 1 taken 22669196 times.
|
25838594 | if(!get_qr(qr_SET_YBUTTON_ITEMS)) |
| 30980 | 22669196 | return; | |
| 30981 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 3169398 times.
✓ Branch 2 taken 549577 times.
✓ Branch 3 taken 2619821 times.
|
3169398 | verifyWpn(game->ywpn, Ywpn, directItemY, COND_BWPN, COND_XWPN, COND_AWPN); |
| 30982 | 25842347 | } | |
| 30983 | |||
| 30984 | 25842347 | void verifyBothWeapons() | |
| 30985 | { | ||
| 30986 | 25842347 | verifyAWpn(); | |
| 30987 | 25842347 | verifyBWpn(); | |
| 30988 | 25842347 | verifyXWpn(); | |
| 30989 | 25842347 | verifyYWpn(); | |
| 30990 | 25842347 | } | |
| 30991 | |||
| 30992 | // Select the sword for the A button if the 'select A button weapon' quest rule isn't set. | ||
| 30993 | 22806528 | int32_t selectSword() | |
| 30994 | { | ||
| 30995 | 22806528 | return current_item_id(itype_sword); | |
| 30996 | } | ||
| 30997 | |||
| 30998 | // Adding code here for allowing hardcoding a button to a specific itemclass. | ||
| 30999 | ✗ | int32_t selectItemclass(int32_t itemclass) | |
| 31000 | { | ||
| 31001 | ✗ | int32_t ret = current_item_id(itemclass); | |
| 31002 | |||
| 31003 | ✗ | if(ret == -1) | |
| 31004 | ✗ | ret = 0; | |
| 31005 | |||
| 31006 | ✗ | return ret; | |
| 31007 | } | ||
| 31008 | |||
| 31009 | // Used for the 'Pickup Hearts' item pickup condition. | ||
| 31010 | 304 | bool canget(int32_t id) | |
| 31011 | { | ||
| 31012 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 304 times.
|
304 | return id>=0 && (game->get_maxlife()>=(itemsbuf[id].pickup_hearts*game->get_hp_per_heart())); |
| 31013 | } | ||
| 31014 | |||
| 31015 | 63 | void dospecialmoney(mapscr* scr, int32_t index) | |
| 31016 | { | ||
| 31017 |
2/2✓ Branch 0 taken 44 times.
✓ Branch 1 taken 19 times.
|
63 | if (cur_screen >= 128) |
| 31018 | 19 | scr = special_warp_return_scr; | |
| 31019 | |||
| 31020 | 63 | int32_t priceindex = ((item*)items.spr(index))->PriceIndex; | |
| 31021 | |||
| 31022 |
4/7✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
✓ Branch 2 taken 20 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 15 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 12 times.
|
63 | switch (scr->room) |
| 31023 | { | ||
| 31024 | case rINFO: // pay for info | ||
| 31025 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
|
16 | if(prices[priceindex]!=100000 ) // 100000 is a placeholder price for free items |
| 31026 | { | ||
| 31027 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
|
16 | if(!current_item_power(itype_wallet)) |
| 31028 | { | ||
| 31029 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 16 times.
|
16 | if (game->get_spendable_rupies() < abs(prices[priceindex])) |
| 31030 | ✗ | return; | |
| 31031 | 16 | int32_t tmpprice = -abs(prices[priceindex]); | |
| 31032 | 16 | int32_t total = game->get_drupy()-tmpprice; | |
| 31033 | 16 | total = vbound(total, 0, game->get_maxcounter(1)); //Never overflow! Overflow here causes subscreen bugs! -Z | |
| 31034 | 16 | game->set_drupy(game->get_drupy()-total); | |
| 31035 | //game->change_drupy(-abs(prices[priceindex])); | ||
| 31036 | 16 | } | |
| 31037 |
1/2✓ Branch 0 taken 16 times.
✗ Branch 1 not taken.
|
16 | if ( current_item_power(itype_wallet)>0 ) |
| 31038 | { | ||
| 31039 | ✗ | game->change_drupy(0); | |
| 31040 | ✗ | } | |
| 31041 | 16 | } | |
| 31042 | 16 | rectfill(msg_bg_display_buf, 0, 0, msg_bg_display_buf->w, 80, 0); | |
| 31043 | 16 | rectfill(msg_txt_display_buf, 0, 0, msg_txt_display_buf->w, 80, 0); | |
| 31044 | 16 | donewmsg(scr, QMisc.info[scr->catchall].str[priceindex]); | |
| 31045 | 16 | clear_bitmap(pricesdisplaybuf); | |
| 31046 | 16 | set_clip_state(pricesdisplaybuf, 1); | |
| 31047 | 16 | items.del(0); | |
| 31048 | |||
| 31049 |
2/2✓ Branch 0 taken 48 times.
✓ Branch 1 taken 16 times.
|
64 | for(int32_t i=0; i<items.Count(); i++) |
| 31050 | 48 | ((item*)items.spr(i))->pickup=ipDUMMY; | |
| 31051 | |||
| 31052 | // Prevent the prices from being displayed anymore | ||
| 31053 |
2/2✓ Branch 0 taken 48 times.
✓ Branch 1 taken 16 times.
|
64 | for(int32_t i=0; i<3; i++) |
| 31054 | { | ||
| 31055 | 48 | prices[i] = 0; | |
| 31056 | 48 | } | |
| 31057 | |||
| 31058 | 16 | break; | |
| 31059 | |||
| 31060 | case rMONEY: // secret money | ||
| 31061 | { | ||
| 31062 | 20 | ((item*)items.spr(0))->pickup = ipDUMMY; | |
| 31063 | |||
| 31064 | 20 | prices[0] = scr->catchall; | |
| 31065 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 20 times.
|
20 | if (!current_item_power(itype_wallet)) |
| 31066 | 20 | game->change_drupy(prices[0]); | |
| 31067 | //game->set_drupy(game->get_drupy()+price); may be needed everywhere | ||
| 31068 | |||
| 31069 | 20 | putprices(false); | |
| 31070 |
2/2✓ Branch 0 taken 19 times.
✓ Branch 1 taken 1 times.
|
20 | setmapflag(scr, (cur_screen < 128 && get_qr(qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM); |
| 31071 | 20 | break; | |
| 31072 | } | ||
| 31073 | |||
| 31074 | case rGAMBLE: // gamble | ||
| 31075 | { | ||
| 31076 | ✗ | if(game->get_spendable_rupies()<10 && !current_item_power(itype_wallet)) return; //Why 10? | |
| 31077 | |||
| 31078 | ✗ | unsigned si=(zc_oldrand()%24)*3; | |
| 31079 | |||
| 31080 | ✗ | for(int32_t i=0; i<3; i++) | |
| 31081 | ✗ | prices[i]=gambledat[si++]; | |
| 31082 | |||
| 31083 | ✗ | game->set_drupy(game->get_drupy()+prices[priceindex]); | |
| 31084 | ✗ | putprices(true); | |
| 31085 | |||
| 31086 | ✗ | for(int32_t i=1; i<4; i++) | |
| 31087 | ✗ | ((item*)items.spr(i))->pickup=ipDUMMY; | |
| 31088 | } | ||
| 31089 | ✗ | break; | |
| 31090 | |||
| 31091 | case rBOMBS: | ||
| 31092 | { | ||
| 31093 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 15 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
15 | if(game->get_spendable_rupies()<scr->catchall && !current_item_power(itype_wallet)) |
| 31094 | ✗ | return; | |
| 31095 | |||
| 31096 | 15 | int32_t price = -scr->catchall; | |
| 31097 | 15 | int32_t wmedal = current_item_id(itype_wealthmedal); | |
| 31098 |
1/2✓ Branch 0 taken 15 times.
✗ Branch 1 not taken.
|
15 | if(wmedal >= 0) |
| 31099 | { | ||
| 31100 | ✗ | if(itemsbuf[wmedal].flags & item_flag1) | |
| 31101 | ✗ | price*=(itemsbuf[wmedal].misc1/100.0); | |
| 31102 | else | ||
| 31103 | ✗ | price+=itemsbuf[wmedal].misc1; | |
| 31104 | ✗ | } | |
| 31105 | |||
| 31106 | 15 | int32_t total = game->get_drupy()-price; | |
| 31107 | 15 | total = vbound(total, 0, game->get_maxcounter(1)); //Never overflow! Overflow here causes subscreen bugs! -Z | |
| 31108 | 15 | game->set_drupy(game->get_drupy()-total); | |
| 31109 | //game->set_drupy(game->get_drupy()+price); | ||
| 31110 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 15 times.
|
15 | setmapflag(scr, (cur_screen < 128 && get_qr(qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM); |
| 31111 | 15 | game->change_maxbombs(4); | |
| 31112 | 15 | game->set_bombs(game->get_maxbombs()); | |
| 31113 | { | ||
| 31114 | 15 | int32_t div = zinit.bomb_ratio; | |
| 31115 | |||
| 31116 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 15 times.
|
15 | if(div > 0) |
| 31117 | 15 | game->change_maxcounter(4/div, 6); | |
| 31118 | } | ||
| 31119 | |||
| 31120 | //also give Hero an actual Bomb item | ||
| 31121 |
2/2✓ Branch 0 taken 3840 times.
✓ Branch 1 taken 15 times.
|
3855 | for(int32_t i=0; i<MAXITEMS; i++) |
| 31122 | { | ||
| 31123 |
4/4✓ Branch 0 taken 17 times.
✓ Branch 1 taken 3823 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 15 times.
|
3840 | if(itemsbuf[i].type == itype_bomb && itemsbuf[i].level == 1) |
| 31124 | 15 | getitem(i, true, true); | |
| 31125 | 3840 | } | |
| 31126 | |||
| 31127 | 15 | ((item*)items.spr(index))->pickup=ipDUMMY+ipFADE; | |
| 31128 | 15 | fadeclk=66; | |
| 31129 | 15 | dismissmsg(); | |
| 31130 | 15 | clear_bitmap(pricesdisplaybuf); | |
| 31131 | 15 | set_clip_state(pricesdisplaybuf, 1); | |
| 31132 | 15 | verifyBothWeapons(); | |
| 31133 | 15 | break; | |
| 31134 | } | ||
| 31135 | |||
| 31136 | case rARROWS: | ||
| 31137 | { | ||
| 31138 | ✗ | if(game->get_spendable_rupies()<scr->catchall && !current_item_power(itype_wallet)) | |
| 31139 | ✗ | return; | |
| 31140 | |||
| 31141 | ✗ | int32_t price = -scr->catchall; | |
| 31142 | ✗ | int32_t wmedal = current_item_id(itype_wealthmedal); | |
| 31143 | ✗ | if(wmedal >= 0) | |
| 31144 | { | ||
| 31145 | ✗ | if(itemsbuf[wmedal].flags & item_flag1) | |
| 31146 | ✗ | price*=(itemsbuf[wmedal].misc1/100.0); | |
| 31147 | else | ||
| 31148 | ✗ | price+=itemsbuf[wmedal].misc1; | |
| 31149 | ✗ | } | |
| 31150 | |||
| 31151 | ✗ | int32_t total = game->get_drupy()-price; | |
| 31152 | ✗ | total = vbound(total, 0, game->get_maxcounter(1)); //Never overflow! Overflow here causes subscreen bugs! -Z | |
| 31153 | ✗ | game->set_drupy(game->get_drupy()-total); | |
| 31154 | |||
| 31155 | //game->set_drupy(game->get_drupy()+price); | ||
| 31156 | ✗ | setmapflag(scr, (cur_screen < 128 && get_qr(qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM); | |
| 31157 | ✗ | game->change_maxarrows(10); | |
| 31158 | ✗ | game->set_arrows(game->get_maxarrows()); | |
| 31159 | ✗ | ((item*)items.spr(index))->pickup=ipDUMMY+ipFADE; | |
| 31160 | ✗ | fadeclk=66; | |
| 31161 | ✗ | dismissmsg(); | |
| 31162 | ✗ | clear_bitmap(pricesdisplaybuf); | |
| 31163 | ✗ | set_clip_state(pricesdisplaybuf, 1); | |
| 31164 | ✗ | verifyBothWeapons(); | |
| 31165 | ✗ | break; | |
| 31166 | } | ||
| 31167 | |||
| 31168 | case rSWINDLE: | ||
| 31169 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
|
12 | if(items.spr(index)->id==iRupy) |
| 31170 | { | ||
| 31171 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
12 | if(game->get_spendable_rupies()<scr->catchall && !current_item_power(itype_wallet)) |
| 31172 | ✗ | return; | |
| 31173 | 12 | int32_t tmpprice = -scr->catchall; | |
| 31174 | 12 | int32_t total = game->get_drupy()-tmpprice; | |
| 31175 | 12 | total = vbound(total, 0, game->get_maxcounter(1)); //Never overflow! Overflow here causes subscreen bugs! -Z | |
| 31176 | 12 | game->set_drupy(game->get_drupy()-total); | |
| 31177 | 12 | } | |
| 31178 | else | ||
| 31179 | { | ||
| 31180 | ✗ | if(game->get_maxlife()<=game->get_hp_per_heart()) | |
| 31181 | ✗ | return; | |
| 31182 | |||
| 31183 | ✗ | game->set_life(zc_max(game->get_life()-game->get_hp_per_heart(),0)); | |
| 31184 | ✗ | game->set_maxlife(zc_max(game->get_maxlife()-game->get_hp_per_heart(),(game->get_hp_per_heart()))); | |
| 31185 | } | ||
| 31186 | |||
| 31187 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 12 times.
|
12 | setmapflag(scr, (cur_screen < 128 && get_qr(qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM); |
| 31188 | 12 | ((item*)items.spr(0))->pickup=ipDUMMY+ipFADE; | |
| 31189 | 12 | ((item*)items.spr(1))->pickup=ipDUMMY+ipFADE; | |
| 31190 | 12 | fadeclk=66; | |
| 31191 | 12 | dismissmsg(); | |
| 31192 | 12 | clear_bitmap(pricesdisplaybuf); | |
| 31193 | 12 | set_clip_state(pricesdisplaybuf, 1); | |
| 31194 | 12 | break; | |
| 31195 | } | ||
| 31196 | 63 | } | |
| 31197 | |||
| 31198 | 25722 | void getitem(int32_t id, bool nosound, bool doRunPassive) | |
| 31199 | { | ||
| 31200 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 25722 times.
|
25722 | if(unsigned(id) >= MAXITEMS) |
| 31201 | ✗ | return; | |
| 31202 | |||
| 31203 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 25722 times.
|
25722 | if (replay_is_active()) |
| 31204 |
1/2✓ Branch 0 taken 25722 times.
✗ Branch 1 not taken.
|
25722 | replay_step_comment(fmt::format("getitem {}", item_string[id])); |
| 31205 | |||
| 31206 |
2/2✓ Branch 0 taken 23589 times.
✓ Branch 1 taken 2133 times.
|
25722 | if(get_qr(qr_SCC_ITEM_COMBINES_ITEMS)) |
| 31207 | { | ||
| 31208 | 2133 | int32_t nextitem = -1; | |
| 31209 | 2133 | do | |
| 31210 | { | ||
| 31211 | 2133 | nextitem = -1; | |
| 31212 |
3/4✓ Branch 0 taken 3 times.
✓ Branch 1 taken 2130 times.
✓ Branch 2 taken 3 times.
✗ Branch 3 not taken.
|
2133 | if((itemsbuf[id].flags & item_combine) && game->get_item(id)) |
| 31213 | // Item upgrade routine. | ||
| 31214 | { | ||
| 31215 | |||
| 31216 | ✗ | for(int32_t i=0; i<MAXITEMS; i++) | |
| 31217 | { | ||
| 31218 | // Find the item which is as close to this item's fam_type as possible. | ||
| 31219 | ✗ | if(itemsbuf[i].type==itemsbuf[id].type && itemsbuf[i].level>itemsbuf[id].level | |
| 31220 | ✗ | && (nextitem>-1 ? itemsbuf[i].level<=itemsbuf[nextitem].level : true)) | |
| 31221 | { | ||
| 31222 | ✗ | nextitem = i; | |
| 31223 | ✗ | } | |
| 31224 | ✗ | } | |
| 31225 | |||
| 31226 | ✗ | if(nextitem>-1) | |
| 31227 | { | ||
| 31228 | ✗ | id = nextitem; | |
| 31229 | ✗ | if(!get_qr(qr_ITEMCOMBINE_CONTINUOUS)) | |
| 31230 | ✗ | break; //no looping | |
| 31231 | ✗ | } | |
| 31232 | ✗ | } | |
| 31233 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2133 times.
|
2133 | } while(nextitem > -1); |
| 31234 | 2133 | } | |
| 31235 | |||
| 31236 | 25722 | itemdata const& idat = itemsbuf[id&0xFF]; | |
| 31237 | |||
| 31238 | 51444 | bool equipment = idat.flags & | |
| 31239 | 25722 | ((idat.type == itype_triforcepiece) ? item_flag8 : item_gamedata); | |
| 31240 | |||
| 31241 |
2/2✓ Branch 0 taken 21452 times.
✓ Branch 1 taken 4270 times.
|
25722 | if(equipment) |
| 31242 | { | ||
| 31243 | // Fix boomerang sounds. | ||
| 31244 | 4270 | int32_t itemid = current_item_id(idat.type); | |
| 31245 | |||
| 31246 |
4/6✓ Branch 0 taken 1752 times.
✓ Branch 1 taken 2518 times.
✓ Branch 2 taken 1668 times.
✓ Branch 3 taken 84 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
4270 | if(itemid>=0 && (idat.type == itype_brang || idat.type == itype_divineprotection |
| 31247 |
5/6✓ Branch 0 taken 1668 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 1634 times.
✓ Branch 3 taken 34 times.
✓ Branch 4 taken 1633 times.
✓ Branch 5 taken 1 times.
|
1668 | || idat.type == itype_hookshot || idat.type == itype_switchhook || idat.type == itype_cbyrna) |
| 31248 | 1752 | && sfx_allocated(itemsbuf[itemid].usesound) | |
| 31249 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1752 times.
|
1752 | && idat.usesound != itemsbuf[itemid].usesound) |
| 31250 | { | ||
| 31251 | ✗ | stop_sfx(itemsbuf[itemid].usesound); | |
| 31252 | ✗ | cont_sfx(idat.usesound); | |
| 31253 | ✗ | } | |
| 31254 | |||
| 31255 | 4270 | int32_t curitm = current_item_id(idat.type); | |
| 31256 |
0/2✗ Branch 0 not taken.
✗ Branch 1 not taken.
|
4270 | if(!get_qr(qr_KEEPOLD_APPLIES_RETROACTIVELY) |
| 31257 |
4/4✓ Branch 0 taken 6 times.
✓ Branch 1 taken 4264 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 5 times.
|
4270 | || curitm < 0 || (itemsbuf[curitm].level <= idat.level) |
| 31258 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | || (itemsbuf[curitm].flags & item_keep_old)) |
| 31259 | { | ||
| 31260 | 4270 | game->set_item(id,true); | |
| 31261 | 4270 | passiveitem_script(id, doRunPassive); | |
| 31262 | 4270 | } | |
| 31263 | |||
| 31264 |
2/2✓ Branch 0 taken 949 times.
✓ Branch 1 taken 3321 times.
|
4270 | if(!(idat.flags & item_keep_old)) |
| 31265 | { | ||
| 31266 |
4/4✓ Branch 0 taken 1143 times.
✓ Branch 1 taken 2178 times.
✓ Branch 2 taken 39 times.
✓ Branch 3 taken 1104 times.
|
3321 | if(!get_qr(qr_BROKEN_KEEPOLD_FLAG) || current_item(idat.type)<idat.level) |
| 31267 | { | ||
| 31268 | 2217 | removeLowerLevelItemsOfFamily(game,itemsbuf,idat.type, idat.level); | |
| 31269 | 2217 | } | |
| 31270 | 3321 | } | |
| 31271 | |||
| 31272 | // NES consistency: replace all flying boomerangs with the current boomerang. | ||
| 31273 |
2/2✓ Branch 0 taken 4114 times.
✓ Branch 1 taken 156 times.
|
4270 | if(idat.type==itype_brang) |
| 31274 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 156 times.
|
157 | for(int32_t i=0; i<Lwpns.Count(); i++) |
| 31275 | { | ||
| 31276 | 1 | weapon *w = ((weapon*)Lwpns.spr(i)); | |
| 31277 | |||
| 31278 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | if(w->id==wBrang) |
| 31279 | { | ||
| 31280 | ✗ | w->LOADGFX(idat.wpn); | |
| 31281 | ✗ | } | |
| 31282 | 157 | } | |
| 31283 | 4270 | } | |
| 31284 | |||
| 31285 |
2/2✓ Branch 0 taken 4867 times.
✓ Branch 1 taken 20855 times.
|
25722 | if(idat.count!=-1) |
| 31286 | { | ||
| 31287 |
2/2✓ Branch 0 taken 20093 times.
✓ Branch 1 taken 762 times.
|
20855 | if(idat.setmax) |
| 31288 | { | ||
| 31289 | // Bomb bags are a special case; they may be set not to increase super bombs | ||
| 31290 |
5/6✓ Branch 0 taken 122 times.
✓ Branch 1 taken 640 times.
✓ Branch 2 taken 122 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 118 times.
✓ Branch 5 taken 4 times.
|
762 | if(idat.type==itype_bombbag && idat.count==2 && (idat.flags&16)==0) |
| 31291 | { | ||
| 31292 | 4 | int32_t max = game->get_maxbombs(); | |
| 31293 | |||
| 31294 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 4 times.
|
4 | if(max<idat.max) max=idat.max; |
| 31295 | |||
| 31296 |
1/2✓ Branch 0 taken 4 times.
✗ Branch 1 not taken.
|
4 | game->set_maxbombs(zc_min(game->get_maxbombs()+idat.setmax,max), false); |
| 31297 | 4 | } | |
| 31298 | else | ||
| 31299 | { | ||
| 31300 | 758 | int32_t max = game->get_maxcounter(idat.count); | |
| 31301 | |||
| 31302 |
2/2✓ Branch 0 taken 304 times.
✓ Branch 1 taken 454 times.
|
758 | if(max<idat.max) max=idat.max; |
| 31303 | |||
| 31304 |
2/2✓ Branch 0 taken 312 times.
✓ Branch 1 taken 446 times.
|
758 | game->set_maxcounter(zc_min(game->get_maxcounter(idat.count)+idat.setmax,max), idat.count); |
| 31305 | } | ||
| 31306 | 762 | } | |
| 31307 | |||
| 31308 | // Amount is an uint16_t, but the range is -9999 to 16383 | ||
| 31309 | // -1 is actually 16385 ... -9999 is 26383, and 0x8000 means use the drain counter | ||
| 31310 |
2/2✓ Branch 0 taken 540 times.
✓ Branch 1 taken 20315 times.
|
20855 | if(idat.amount&0x3FFF) |
| 31311 | { | ||
| 31312 |
2/2✓ Branch 0 taken 11509 times.
✓ Branch 1 taken 8806 times.
|
20315 | if(idat.amount&0x8000) |
| 31313 | 23018 | game->set_dcounter( | |
| 31314 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 11508 times.
|
11509 | game->get_dcounter(idat.count)+((idat.amount&0x4000)?-(idat.amount&0x3FFF):idat.amount&0x3FFF), idat.count); |
| 31315 | else | ||
| 31316 | { | ||
| 31317 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 8806 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
8806 | if(idat.amount>=16385 && game->get_counter(0)<=idat.amount-16384) |
| 31318 | ✗ | game->set_counter(0, idat.count); | |
| 31319 | else | ||
| 31320 | // This is too confusing to try and change... | ||
| 31321 |
4/6✗ Branch 0 not taken.
✓ Branch 1 taken 8806 times.
✓ Branch 2 taken 4286 times.
✓ Branch 3 taken 4520 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 4286 times.
|
8806 | game->set_counter(zc_min(game->get_counter(idat.count)+((idat.amount&0x4000)?-(idat.amount&0x3FFF):idat.amount&0x3FFF),game->get_maxcounter(idat.count)), idat.count); |
| 31322 | } | ||
| 31323 | 20315 | } | |
| 31324 | 20855 | } | |
| 31325 | |||
| 31326 |
2/2✓ Branch 0 taken 25721 times.
✓ Branch 1 taken 1 times.
|
25722 | if(idat.pickup_litems) |
| 31327 | { | ||
| 31328 | 1 | auto lvl = idat.pickup_litem_level; | |
| 31329 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | if(lvl < 0) |
| 31330 | 1 | lvl = dlevel; | |
| 31331 | 1 | game->lvlitems[lvl] |= idat.pickup_litems; | |
| 31332 | 1 | } | |
| 31333 | |||
| 31334 |
4/4✓ Branch 0 taken 25684 times.
✓ Branch 1 taken 38 times.
✓ Branch 2 taken 2761 times.
✓ Branch 3 taken 22923 times.
|
25722 | if(idat.playsound&&!nosound) |
| 31335 | { | ||
| 31336 | 22923 | sfx(idat.playsound); | |
| 31337 | 22923 | } | |
| 31338 | |||
| 31339 | //add lower-level items | ||
| 31340 |
2/2✓ Branch 0 taken 25631 times.
✓ Branch 1 taken 91 times.
|
25722 | if(idat.flags&item_gain_old) |
| 31341 | { | ||
| 31342 |
2/2✓ Branch 0 taken 113 times.
✓ Branch 1 taken 91 times.
|
204 | for(int32_t i=idat.level-1; i>0; i--) |
| 31343 | { | ||
| 31344 | 113 | int32_t potid = getItemID(itemsbuf, idat.type, i); | |
| 31345 | |||
| 31346 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 113 times.
|
113 | if(potid != -1) |
| 31347 | { | ||
| 31348 | 113 | game->set_item(potid, true); | |
| 31349 | 113 | } | |
| 31350 | 113 | } | |
| 31351 | 91 | } | |
| 31352 | |||
| 31353 |
12/14✓ Branch 0 taken 177 times.
✓ Branch 1 taken 23744 times.
✓ Branch 2 taken 7 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 475 times.
✓ Branch 6 taken 147 times.
✓ Branch 7 taken 5 times.
✓ Branch 8 taken 107 times.
✓ Branch 9 taken 94 times.
✓ Branch 10 taken 77 times.
✓ Branch 11 taken 728 times.
✓ Branch 12 taken 137 times.
✓ Branch 13 taken 24 times.
|
25722 | switch(idat.type) |
| 31354 | { | ||
| 31355 | case itype_itmbundle: | ||
| 31356 | { | ||
| 31357 |
1/2✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
|
7 | if(!itembundle_safe(id & 0xFF)) |
| 31358 | ✗ | break; | |
| 31359 | 42 | int ids[10] = {idat.misc1, idat.misc2, idat.misc3, idat.misc4, idat.misc5, | |
| 31360 | 35 | idat.misc6, idat.misc7, idat.misc8, idat.misc9, idat.misc10}; | |
| 31361 | 7 | bool pscript = (idat.flags & item_flag1); | |
| 31362 |
2/2✓ Branch 0 taken 70 times.
✓ Branch 1 taken 7 times.
|
77 | for(auto q = 0; q < 10; ++q) |
| 31363 | { | ||
| 31364 |
2/2✓ Branch 0 taken 7 times.
✓ Branch 1 taken 63 times.
|
70 | if(unsigned(ids[q]) >= MAXITEMS) continue; |
| 31365 |
2/2✓ Branch 0 taken 53 times.
✓ Branch 1 taken 10 times.
|
63 | if(pscript) |
| 31366 | 10 | collectitem_script(ids[q]); | |
| 31367 | |||
| 31368 | 63 | getitem(ids[q], true, true); | |
| 31369 | 63 | } | |
| 31370 | } | ||
| 31371 | 7 | break; | |
| 31372 | |||
| 31373 | case itype_progressive_itm: | ||
| 31374 | { | ||
| 31375 | ✗ | int32_t newid = get_progressive_item(id); | |
| 31376 | ✗ | if(newid > -1) | |
| 31377 | ✗ | getitem(newid, nosound, true); | |
| 31378 | } | ||
| 31379 | ✗ | break; | |
| 31380 | |||
| 31381 | case itype_bottlefill: | ||
| 31382 | { | ||
| 31383 | ✗ | if(idat.misc1) | |
| 31384 | { | ||
| 31385 | ✗ | game->fillBottle(idat.misc1); | |
| 31386 | ✗ | } | |
| 31387 | } | ||
| 31388 | ✗ | break; | |
| 31389 | |||
| 31390 | case itype_clock: | ||
| 31391 | { | ||
| 31392 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 475 times.
|
475 | if(idat.flags & item_flag1) //Active use, not passive |
| 31393 | ✗ | break; | |
| 31394 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 475 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
475 | if((idat.flags & item_flag2) && clockclk) //"Can't activate while clock active" |
| 31395 | ✗ | break; | |
| 31396 | 475 | setClock(watch=true); | |
| 31397 | |||
| 31398 | 475 | clock_zoras.clear(); | |
| 31399 | |||
| 31400 | 475 | clockclk=idat.misc1; | |
| 31401 | 475 | sfx(idat.usesound); | |
| 31402 | } | ||
| 31403 | 475 | break; | |
| 31404 | |||
| 31405 | case itype_lkey: | ||
| 31406 | { | ||
| 31407 | 147 | auto lvl = dlevel; | |
| 31408 |
1/2✓ Branch 0 taken 147 times.
✗ Branch 1 not taken.
|
147 | if(idat.flags & item_flag1) // custom level |
| 31409 | ✗ | lvl = vbound(idat.misc1, 0, MAXLEVELS-1); | |
| 31410 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 147 times.
|
147 | if(game->lvlkeys[lvl]<255) |
| 31411 | 147 | game->lvlkeys[lvl]++; | |
| 31412 | 147 | break; | |
| 31413 | } | ||
| 31414 | |||
| 31415 | case itype_ring: | ||
| 31416 | case itype_magicring: | ||
| 31417 |
6/6✓ Branch 0 taken 22 times.
✓ Branch 1 taken 155 times.
✓ Branch 2 taken 8 times.
✓ Branch 3 taken 14 times.
✓ Branch 4 taken 6 times.
✓ Branch 5 taken 2 times.
|
177 | if((get_qr(qr_OVERWORLDTUNIC) != 0) || (cur_screen<128 || dlevel)) |
| 31418 | { | ||
| 31419 | 175 | ringcolor(false); | |
| 31420 | 175 | } | |
| 31421 | 177 | break; | |
| 31422 | |||
| 31423 | case itype_whispring: | ||
| 31424 | { | ||
| 31425 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 5 times.
|
5 | if(idat.flags & item_flag1) |
| 31426 | { | ||
| 31427 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if(HeroSwordClk()==-1) setSwordClk(150); // Let's not bother applying the divisor. |
| 31428 | |||
| 31429 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if(HeroItemClk()==-1) setItemClk(150); // Let's not bother applying the divisor. |
| 31430 | |||
| 31431 |
1/2✓ Branch 0 taken 5 times.
✗ Branch 1 not taken.
|
5 | if(HeroItemClk()== 1) setShieldClk(150); // Let's not bother applying the divisor. |
| 31432 | 5 | } | |
| 31433 | |||
| 31434 |
2/2✓ Branch 0 taken 3 times.
✓ Branch 1 taken 2 times.
|
5 | if(idat.power==0) |
| 31435 | { | ||
| 31436 | 2 | setSwordClk(0); | |
| 31437 | 2 | setItemClk(0); | |
| 31438 | 2 | setShieldClk(0); | |
| 31439 | 2 | } | |
| 31440 | |||
| 31441 | 5 | break; | |
| 31442 | } | ||
| 31443 | |||
| 31444 | |||
| 31445 | case itype_map: | ||
| 31446 | 107 | game->lvlitems[dlevel]|=(1 << li_map); | |
| 31447 | 107 | break; | |
| 31448 | |||
| 31449 | case itype_compass: | ||
| 31450 | 94 | game->lvlitems[dlevel]|=(1 << li_compass); | |
| 31451 | 94 | break; | |
| 31452 | |||
| 31453 | case itype_bosskey: | ||
| 31454 | 77 | game->lvlitems[dlevel]|=(1 << li_boss_key); | |
| 31455 | 77 | break; | |
| 31456 | |||
| 31457 | case itype_fairy: | ||
| 31458 | |||
| 31459 |
4/6✗ Branch 0 not taken.
✓ Branch 1 taken 728 times.
✓ Branch 2 taken 205 times.
✓ Branch 3 taken 523 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 205 times.
|
728 | game->set_life(zc_min(game->get_life()+(idat.flags&item_flag1 ?(int32_t)(game->get_maxlife()*(idat.misc1/100.0)):((idat.misc1*game->get_hp_per_heart()))),game->get_maxlife())); |
| 31460 |
4/6✗ Branch 0 not taken.
✓ Branch 1 taken 728 times.
✓ Branch 2 taken 115 times.
✓ Branch 3 taken 613 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 115 times.
|
728 | game->set_magic(zc_min(game->get_magic()+(idat.flags&item_flag2 ?(int32_t)(game->get_maxmagic()*(idat.misc2/100.0)):((idat.misc2*game->get_mp_per_block()))),game->get_maxmagic())); |
| 31461 | 728 | break; | |
| 31462 | |||
| 31463 | case itype_heartpiece: | ||
| 31464 | 137 | game->change_HCpieces(1); | |
| 31465 | |||
| 31466 |
2/2✓ Branch 0 taken 107 times.
✓ Branch 1 taken 30 times.
|
137 | if(game->get_HCpieces()<game->get_hcp_per_hc()) |
| 31467 | 107 | break; | |
| 31468 | |||
| 31469 | 30 | game->set_HCpieces(0); | |
| 31470 | |||
| 31471 | 30 | getitem(heart_container_id()); | |
| 31472 | 30 | break; | |
| 31473 | |||
| 31474 | case itype_killem: | ||
| 31475 | { | ||
| 31476 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 24 times.
|
24 | if(idat.flags & item_flag1) //Active use, not passive |
| 31477 | ✗ | break; | |
| 31478 | 24 | kill_em_all(); | |
| 31479 | 24 | sfx(idat.usesound); | |
| 31480 | } | ||
| 31481 | 24 | break; | |
| 31482 | } | ||
| 31483 | |||
| 31484 | 25722 | flushItemCache(); | |
| 31485 | 25722 | update_subscreens(); | |
| 31486 | 25722 | refresh_subscr_items(); | |
| 31487 | 25722 | verifyBothWeapons(); | |
| 31488 | 25722 | } | |
| 31489 | |||
| 31490 | 14 | void takeitem(int32_t id) | |
| 31491 | { | ||
| 31492 | 14 | game->set_item(id, false); | |
| 31493 | 14 | itemdata const& idat = itemsbuf[id]; | |
| 31494 | |||
| 31495 | /* Lower the counters! */ | ||
| 31496 |
1/2✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
|
14 | if(idat.count!=-1) |
| 31497 | { | ||
| 31498 | ✗ | if(idat.setmax) | |
| 31499 | { | ||
| 31500 | ✗ | game->set_maxcounter(game->get_maxcounter(idat.count)-idat.setmax, idat.count); | |
| 31501 | ✗ | } | |
| 31502 | |||
| 31503 | ✗ | if(idat.amount&0x3FFF) | |
| 31504 | { | ||
| 31505 | ✗ | if(idat.amount&0x8000) | |
| 31506 | ✗ | game->set_dcounter(game->get_dcounter(idat.count)-((idat.amount&0x4000)?-(idat.amount&0x3FFF):idat.amount&0x3FFF), idat.count); | |
| 31507 | ✗ | else game->set_counter(game->get_counter(idat.count)-((idat.amount&0x4000)?-(idat.amount&0x3FFF):idat.amount&0x3FFF), idat.count); | |
| 31508 | ✗ | } | |
| 31509 | ✗ | } | |
| 31510 | |||
| 31511 |
1/10✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
|
14 | switch(itemsbuf[id&0xFF].type) |
| 31512 | { | ||
| 31513 | // NES consistency: replace all flying boomerangs with the current boomerang. | ||
| 31514 | case itype_brang: | ||
| 31515 | ✗ | if(current_item(itype_brang)) for(int32_t i=0; i<Lwpns.Count(); i++) | |
| 31516 | { | ||
| 31517 | ✗ | weapon *w = ((weapon*)Lwpns.spr(i)); | |
| 31518 | |||
| 31519 | ✗ | if(w->id==wBrang) | |
| 31520 | { | ||
| 31521 | ✗ | w->LOADGFX(itemsbuf[current_item_id(itype_brang)].wpn); | |
| 31522 | ✗ | } | |
| 31523 | ✗ | } | |
| 31524 | |||
| 31525 | ✗ | break; | |
| 31526 | |||
| 31527 | case itype_itmbundle: | ||
| 31528 | { | ||
| 31529 | ✗ | if(!itembundle_safe(id)) | |
| 31530 | ✗ | break; | |
| 31531 | ✗ | int ids[10] = {idat.misc1, idat.misc2, idat.misc3, idat.misc4, idat.misc5, | |
| 31532 | ✗ | idat.misc6, idat.misc7, idat.misc8, idat.misc9, idat.misc10}; | |
| 31533 | ✗ | for(auto q = 0; q < 10; ++q) | |
| 31534 | { | ||
| 31535 | ✗ | if(unsigned(ids[q]) >= MAXITEMS) continue; | |
| 31536 | ✗ | takeitem(ids[q]); | |
| 31537 | ✗ | } | |
| 31538 | } | ||
| 31539 | ✗ | break; | |
| 31540 | |||
| 31541 | case itype_progressive_itm: | ||
| 31542 | { | ||
| 31543 | ✗ | int32_t newid = get_progressive_item(id, true); | |
| 31544 | ✗ | if(newid > -1) | |
| 31545 | ✗ | takeitem(newid); | |
| 31546 | } | ||
| 31547 | ✗ | break; | |
| 31548 | |||
| 31549 | case itype_heartpiece: | ||
| 31550 | ✗ | if(game->get_maxlife()>game->get_hp_per_heart()) | |
| 31551 | { | ||
| 31552 | ✗ | if(game->get_HCpieces()==0) | |
| 31553 | { | ||
| 31554 | ✗ | game->set_HCpieces(game->get_hcp_per_hc()); | |
| 31555 | ✗ | takeitem(iHeartC); | |
| 31556 | ✗ | } | |
| 31557 | |||
| 31558 | ✗ | game->change_HCpieces(-1); | |
| 31559 | ✗ | } | |
| 31560 | ✗ | break; | |
| 31561 | |||
| 31562 | case itype_map: | ||
| 31563 | ✗ | game->lvlitems[dlevel]&=~(1 << li_map); | |
| 31564 | ✗ | break; | |
| 31565 | |||
| 31566 | case itype_compass: | ||
| 31567 | ✗ | game->lvlitems[dlevel]&=~(1 << li_compass); | |
| 31568 | ✗ | break; | |
| 31569 | |||
| 31570 | case itype_bosskey: | ||
| 31571 | ✗ | game->lvlitems[dlevel]&=~(1 << li_boss_key); | |
| 31572 | ✗ | break; | |
| 31573 | |||
| 31574 | case itype_lkey: | ||
| 31575 | { | ||
| 31576 | ✗ | auto lvl = dlevel; | |
| 31577 | ✗ | if(idat.flags & item_flag1) // custom level | |
| 31578 | ✗ | lvl = vbound(idat.misc1, 0, MAXLEVELS-1); | |
| 31579 | ✗ | if(game->lvlkeys[lvl]) | |
| 31580 | ✗ | game->lvlkeys[lvl]--; | |
| 31581 | ✗ | break; | |
| 31582 | } | ||
| 31583 | |||
| 31584 | case itype_ring: | ||
| 31585 | ✗ | if((get_qr(qr_OVERWORLDTUNIC) != 0) || (cur_screen<128 || dlevel)) | |
| 31586 | { | ||
| 31587 | ✗ | ringcolor(false); | |
| 31588 | ✗ | } | |
| 31589 | ✗ | break; | |
| 31590 | } | ||
| 31591 | 14 | } | |
| 31592 | |||
| 31593 | 15043 | void post_item_collect() | |
| 31594 | { | ||
| 31595 | 15043 | std::vector<int32_t> &ev = FFCore.eventData; | |
| 31596 | 15043 | ev.clear(); | |
| 31597 | |||
| 31598 | 15043 | throwGenScriptEvent(GENSCR_EVENT_POST_COLLECT_ITEM); | |
| 31599 | 15043 | } | |
| 31600 | |||
| 31601 | 15299 | void HeroClass::handle_triforce(mapscr* scr, int32_t id) | |
| 31602 | { | ||
| 31603 |
1/2✓ Branch 0 taken 15299 times.
✗ Branch 1 not taken.
|
15299 | if(unsigned(id) >= MAXITEMS) |
| 31604 | ✗ | return; | |
| 31605 | 15299 | itemdata const& itm = itemsbuf[id]; | |
| 31606 |
3/3✓ Branch 0 taken 15173 times.
✓ Branch 1 taken 7 times.
✓ Branch 2 taken 119 times.
|
15299 | switch(itm.type) |
| 31607 | { | ||
| 31608 | case itype_itmbundle: | ||
| 31609 | { | ||
| 31610 |
1/2✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
|
7 | if(!itembundle_safe(id, true)) // skip error because it will always have already printed earlier this frame in 'getitem' |
| 31611 | ✗ | break; | |
| 31612 | 42 | int ids[10] = {itm.misc1, itm.misc2, itm.misc3, itm.misc4, itm.misc5, | |
| 31613 | 35 | itm.misc6, itm.misc7, itm.misc8, itm.misc9, itm.misc10}; | |
| 31614 |
2/2✓ Branch 0 taken 70 times.
✓ Branch 1 taken 7 times.
|
77 | for(auto q = 0; q < 10; ++q) |
| 31615 | { | ||
| 31616 |
2/2✓ Branch 0 taken 7 times.
✓ Branch 1 taken 63 times.
|
70 | if(unsigned(ids[q]) >= MAXITEMS) continue; |
| 31617 | 63 | handle_triforce(scr, ids[q]); | |
| 31618 | 63 | } | |
| 31619 | } | ||
| 31620 | 7 | break; | |
| 31621 | case itype_triforcepiece: | ||
| 31622 | { | ||
| 31623 |
2/2✓ Branch 0 taken 19 times.
✓ Branch 1 taken 100 times.
|
119 | if(itm.misc2>0) |
| 31624 | 100 | getTriforce(id); //small | |
| 31625 | 19 | else getBigTri(scr, id); //big | |
| 31626 | } | ||
| 31627 | 119 | break; | |
| 31628 | } | ||
| 31629 | 15299 | } | |
| 31630 | |||
| 31631 | // Attempt to pick up an item. (-1 = check items touching Hero.) | ||
| 31632 | // Returns true if the item was collected and removed from "items" spritelist. | ||
| 31633 | 14811241 | bool HeroClass::checkitems(int32_t index) | |
| 31634 | { | ||
| 31635 |
2/2✓ Branch 0 taken 1889 times.
✓ Branch 1 taken 14809352 times.
|
14811241 | if(index==-1) |
| 31636 | { | ||
| 31637 |
2/2✓ Branch 0 taken 3235199 times.
✓ Branch 1 taken 14809352 times.
|
18044551 | for (int i = 0; i < items.Count(); i++) |
| 31638 | { | ||
| 31639 | 3235199 | item* itm = (item*)items.spr(i); | |
| 31640 |
2/2✓ Branch 0 taken 3234853 times.
✓ Branch 1 taken 346 times.
|
3235199 | if (itm->get_forcegrab()) |
| 31641 | { | ||
| 31642 | // Wait for currently held item animation to finish. | ||
| 31643 | // Also wait for any ongoing message to finish. Otherwise an item created from the | ||
| 31644 | // CollectItem SCC will close the message box at the end of the string, ignoring any | ||
| 31645 | // subsequent linked messages. Instead, collect the item only after all messages are | ||
| 31646 | // done. | ||
| 31647 | // I tried applying this check for even non-forcegrab items, but it didn't work out: | ||
| 31648 | // https://discord.com/channels/876899628556091432/1277878877057978460/1435172573611561083 | ||
| 31649 |
5/6✓ Branch 0 taken 340 times.
✓ Branch 1 taken 6 times.
✓ Branch 2 taken 80 times.
✓ Branch 3 taken 260 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 80 times.
|
346 | if ((itm->pickup & ipHOLDUP) && (is_holding_item() || linkedmsgclk)) |
| 31650 | 260 | continue; | |
| 31651 | |||
| 31652 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 86 times.
|
86 | if (checkitems(i)) |
| 31653 | 86 | i--; | |
| 31654 | 86 | } | |
| 31655 | 3234939 | } | |
| 31656 |
4/6✓ Branch 0 taken 9737625 times.
✓ Branch 1 taken 5071727 times.
✓ Branch 2 taken 9737625 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 9737625 times.
|
14809352 | if(diagonalMovement || NO_GRIDLOCK) |
| 31657 | { | ||
| 31658 | 5071727 | index=items.hit(x,y+(bigHitbox?0:8)-fakez,z,6,6,1); | |
| 31659 | 5071727 | } | |
| 31660 | 9737625 | else index=items.hit(x,y+(bigHitbox?0:8)-fakez,z,1,1,1); | |
| 31661 | 14809352 | } | |
| 31662 | |||
| 31663 |
2/2✓ Branch 0 taken 127639 times.
✓ Branch 1 taken 14683602 times.
|
14811241 | if(index==-1) |
| 31664 | 14683602 | return false; | |
| 31665 | |||
| 31666 | 127639 | item* ptr = (item*)items.spr(index); | |
| 31667 | 127639 | int32_t pickup = ptr->pickup; | |
| 31668 | 127639 | int8_t exstate = ptr->pickupexstate; | |
| 31669 | 127639 | int32_t PriceIndex = ptr->PriceIndex; | |
| 31670 | 127639 | int32_t id2 = ptr->id; | |
| 31671 | 127639 | int32_t holdid = ptr->id; | |
| 31672 | 127639 | int32_t pstr = ptr->pstring; | |
| 31673 | 127639 | int32_t pstr_flags = ptr->pickup_string_flags; | |
| 31674 | 127639 | int32_t linked_parent = ptr->linked_parent; | |
| 31675 | // `screen_spawned` is probably same as `heroscr`, but could not be if the item moved around. | ||
| 31676 | 127639 | int32_t item_screen = ptr->screen_spawned; | |
| 31677 | 127639 | mapscr* item_scr = get_scr_maybe(cur_map, item_screen); | |
| 31678 | |||
| 31679 | // I haven't observed this happening, but there are crash reports showing that an | ||
| 31680 | // item sprite does not have a screen_spawned for the current screens. | ||
| 31681 | // Only guess is that `set_forcegrab` kept the item around from the previous screen. | ||
| 31682 | // https://zeldaclassic.sentry.io/share/issue/c13f5a3c5079463fb6901cfea26c695a/ | ||
| 31683 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 127639 times.
|
127639 | if (!item_scr) |
| 31684 | { | ||
| 31685 | ✗ | item_screen = get_screen_for_world_xy(ptr->x, ptr->y); | |
| 31686 | ✗ | item_scr = get_scr(item_screen); | |
| 31687 | ✗ | } | |
| 31688 | |||
| 31689 | // For items grabbed while in a special screen. | ||
| 31690 |
2/2✓ Branch 0 taken 126074 times.
✓ Branch 1 taken 1565 times.
|
127639 | if (cur_screen >= 128) |
| 31691 | 1565 | item_scr = special_warp_return_scr; | |
| 31692 | |||
| 31693 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 127639 times.
|
127639 | if(ptr->fallclk > 0) return false; //Don't pick up a falling item |
| 31694 | |||
| 31695 |
1/2✓ Branch 0 taken 127639 times.
✗ Branch 1 not taken.
|
127639 | if(itemsbuf[id2].type == itype_progressive_itm) |
| 31696 | { | ||
| 31697 | ✗ | int32_t newid = get_progressive_item(id2); | |
| 31698 | ✗ | if(newid > -1) | |
| 31699 | { | ||
| 31700 | ✗ | id2 = newid; | |
| 31701 | ✗ | holdid = newid; | |
| 31702 | ✗ | pstr = itemsbuf[newid].pstring; | |
| 31703 | ✗ | pstr_flags = itemsbuf[newid].pickup_string_flags; | |
| 31704 | ✗ | } | |
| 31705 | ✗ | } | |
| 31706 | |||
| 31707 |
2/2✓ Branch 0 taken 126613 times.
✓ Branch 1 taken 1026 times.
|
127639 | bool bottledummy = (pickup&ipCHECK) && item_scr->room == rBOTTLESHOP; |
| 31708 | |||
| 31709 |
2/2✓ Branch 0 taken 49 times.
✓ Branch 1 taken 127590 times.
|
127639 | if(bottledummy) //Dummy bullshit! |
| 31710 | { | ||
| 31711 |
1/2✓ Branch 0 taken 49 times.
✗ Branch 1 not taken.
|
49 | if(!game->hasBottle(0)) |
| 31712 | ✗ | return false; | |
| 31713 |
2/2✓ Branch 0 taken 48 times.
✓ Branch 1 taken 1 times.
|
49 | if(prices[PriceIndex]!=100000) // 100000 is a placeholder price for free items |
| 31714 | { | ||
| 31715 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | if(!current_item_power(itype_wallet)) |
| 31716 | { | ||
| 31717 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | if( game->get_spendable_rupies()<abs(prices[PriceIndex]) ) return false; |
| 31718 | 1 | int32_t tmpprice = -abs(prices[PriceIndex]); | |
| 31719 | //game->change_drupy(-abs(prices[priceindex])); | ||
| 31720 | 1 | int32_t total = game->get_drupy()-tmpprice; | |
| 31721 | 1 | total = vbound(total, 0, game->get_maxcounter(1)); //Never overflow! Overflow here causes subscreen bugs! -Z | |
| 31722 | 1 | game->set_drupy(game->get_drupy()-total); | |
| 31723 | 1 | } | |
| 31724 | else //infinite wallet | ||
| 31725 | { | ||
| 31726 | ✗ | game->change_drupy(0); | |
| 31727 | } | ||
| 31728 | 1 | } | |
| 31729 | 49 | boughtsomething=true; | |
| 31730 | //make the other shop items untouchable after | ||
| 31731 | //you buy something | ||
| 31732 | |||
| 31733 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 49 times.
|
53 | for(int32_t i=0; i<items.Count(); i++) |
| 31734 | { | ||
| 31735 |
4/4✓ Branch 0 taken 3 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 1 times.
✓ Branch 3 taken 2 times.
|
4 | if(((item*)items.spr(i))->PriceIndex >-1 && i!=index) |
| 31736 | 2 | ((item*)items.spr(i))->pickup=ipDUMMY+ipFADE; | |
| 31737 | 4 | } | |
| 31738 | |||
| 31739 | 49 | int32_t slot = game->fillBottle(QMisc.bottle_shop_types[item_scr->catchall].fill[PriceIndex]); | |
| 31740 | 49 | id2 = find_bottle_for_slot(slot); | |
| 31741 | 49 | ptr->id = id2; | |
| 31742 | 49 | holdid = id2; | |
| 31743 | 49 | pstr = 0; | |
| 31744 | 49 | pickup |= ipHOLDUP; | |
| 31745 | 49 | } | |
| 31746 | else | ||
| 31747 | { | ||
| 31748 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 127590 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
127590 | if(itemsbuf[id2].type == itype_bottlefill && !game->hasBottle(0)) |
| 31749 | ✗ | return false; //No picking these up unless you have a bottle to fill! | |
| 31750 | |||
| 31751 |
5/6✓ Branch 0 taken 122176 times.
✓ Branch 1 taken 5414 times.
✓ Branch 2 taken 110102 times.
✓ Branch 3 taken 12074 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 110102 times.
|
127590 | if(((pickup&ipTIMER) && (ptr->clk2 < game->get_item_spawn_flicker()))&& !(pickup & ipCANGRAB)) |
| 31752 |
2/2✓ Branch 0 taken 109896 times.
✓ Branch 1 taken 206 times.
|
110102 | if(ptr->id!=iFairyMoving) |
| 31753 | // wait for it to stop flashing, doesn't check for other items yet | ||
| 31754 | 109896 | return false; | |
| 31755 | |||
| 31756 |
2/2✓ Branch 0 taken 17630 times.
✓ Branch 1 taken 64 times.
|
17694 | if(pickup&ipENEMY) // item was being carried by enemy |
| 31757 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 64 times.
|
128 | if(more_carried_items(item_screen)<=1) // 1 includes this own item. |
| 31758 | 64 | screen_item_set_state(item_screen, ScreenItemState::None); | |
| 31759 | |||
| 31760 |
2/2✓ Branch 0 taken 1703 times.
✓ Branch 1 taken 15991 times.
|
17694 | if(pickup&ipDUMMY) // dummy item (usually a rupee) |
| 31761 | { | ||
| 31762 |
2/2✓ Branch 0 taken 1640 times.
✓ Branch 1 taken 63 times.
|
1703 | if(pickup&ipMONEY) |
| 31763 | 63 | dospecialmoney(item_scr, index); | |
| 31764 | |||
| 31765 | 1703 | return false; | |
| 31766 | } | ||
| 31767 | |||
| 31768 |
3/4✓ Branch 0 taken 95 times.
✓ Branch 1 taken 15896 times.
✓ Branch 2 taken 95 times.
✗ Branch 3 not taken.
|
15991 | if(get_qr(qr_HEARTSREQUIREDFIX) && !canget(id2)) |
| 31769 | ✗ | return false; | |
| 31770 | |||
| 31771 | 15991 | int32_t nextitem = -1; | |
| 31772 | 15991 | do | |
| 31773 | { | ||
| 31774 | 15995 | nextitem = -1; | |
| 31775 |
4/4✓ Branch 0 taken 30 times.
✓ Branch 1 taken 15965 times.
✓ Branch 2 taken 12 times.
✓ Branch 3 taken 18 times.
|
15995 | if((itemsbuf[id2].flags & item_combine) && game->get_item(id2)) |
| 31776 | // Item upgrade routine. | ||
| 31777 | { | ||
| 31778 | |||
| 31779 |
2/2✓ Branch 0 taken 4608 times.
✓ Branch 1 taken 18 times.
|
4626 | for(int32_t i=0; i<MAXITEMS; i++) |
| 31780 | { | ||
| 31781 | // Find the item which is as close to this item's fam_type as possible. | ||
| 31782 |
4/4✓ Branch 0 taken 43 times.
✓ Branch 1 taken 4565 times.
✓ Branch 2 taken 5 times.
✓ Branch 3 taken 18 times.
|
4608 | if(itemsbuf[i].type==itemsbuf[id2].type && itemsbuf[i].level>itemsbuf[id2].level |
| 31783 |
3/4✓ Branch 0 taken 20 times.
✓ Branch 1 taken 23 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 5 times.
|
43 | && (nextitem>-1 ? itemsbuf[i].level<=itemsbuf[nextitem].level : true)) |
| 31784 | { | ||
| 31785 | 18 | nextitem = i; | |
| 31786 | 18 | } | |
| 31787 | 4608 | } | |
| 31788 | |||
| 31789 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 18 times.
|
18 | if(nextitem>-1) |
| 31790 | { | ||
| 31791 | 18 | id2 = nextitem; | |
| 31792 |
2/2✓ Branch 0 taken 14 times.
✓ Branch 1 taken 4 times.
|
18 | if(get_qr(qr_ITEMCOMBINE_NEW_PSTR)) |
| 31793 | { | ||
| 31794 | 4 | pstr = itemsbuf[id2].pstring; | |
| 31795 | 4 | pstr_flags = itemsbuf[id2].pickup_string_flags; | |
| 31796 | 4 | } | |
| 31797 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 14 times.
|
18 | if(!get_qr(qr_ITEMCOMBINE_CONTINUOUS)) |
| 31798 | 14 | break; //no looping | |
| 31799 | 4 | } | |
| 31800 | 4 | } | |
| 31801 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 15977 times.
|
15981 | } while(nextitem > -1); |
| 31802 | |||
| 31803 |
2/2✓ Branch 0 taken 14966 times.
✓ Branch 1 taken 1025 times.
|
15991 | if(pickup&ipCHECK) // check restrictions |
| 31804 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 709 times.
✓ Branch 2 taken 209 times.
✓ Branch 3 taken 107 times.
|
1025 | switch(item_scr->room) |
| 31805 | { | ||
| 31806 | case rSP_ITEM: // special item | ||
| 31807 |
2/2✓ Branch 0 taken 146 times.
✓ Branch 1 taken 63 times.
|
209 | if(!canget(id2)) // These ones always need the Hearts Required check |
| 31808 | 63 | return false; | |
| 31809 | |||
| 31810 | 146 | break; | |
| 31811 | |||
| 31812 | case rP_SHOP: // potion shop | ||
| 31813 |
2/2✓ Branch 0 taken 93 times.
✓ Branch 1 taken 14 times.
|
107 | if(msg_active) |
| 31814 | 93 | return false; | |
| 31815 | [[fallthrough]]; | ||
| 31816 | case rSHOP: // shop | ||
| 31817 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 723 times.
|
723 | if(prices[PriceIndex]!=100000) // 100000 is a placeholder price for free items |
| 31818 | { | ||
| 31819 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 723 times.
|
723 | if(!current_item_power(itype_wallet)) |
| 31820 | { | ||
| 31821 |
2/2✓ Branch 0 taken 600 times.
✓ Branch 1 taken 123 times.
|
723 | if( game->get_spendable_rupies()<abs(prices[PriceIndex]) ) return false; |
| 31822 | 123 | int32_t tmpprice = -abs(prices[PriceIndex]); | |
| 31823 | //game->change_drupy(-abs(prices[priceindex])); | ||
| 31824 | 123 | int32_t total = game->get_drupy()-tmpprice; | |
| 31825 | 123 | total = vbound(total, 0, game->get_maxcounter(1)); //Never overflow! Overflow here causes subscreen bugs! -Z | |
| 31826 | 123 | game->set_drupy(game->get_drupy()-total); | |
| 31827 | 123 | } | |
| 31828 | else //infinite wallet | ||
| 31829 | { | ||
| 31830 | ✗ | game->change_drupy(0); | |
| 31831 | } | ||
| 31832 | 123 | } | |
| 31833 | 123 | boughtsomething=true; | |
| 31834 | //make the other shop items untouchable after | ||
| 31835 | //you buy something | ||
| 31836 | 123 | int32_t count = 0; | |
| 31837 | |||
| 31838 |
2/2✓ Branch 0 taken 369 times.
✓ Branch 1 taken 123 times.
|
492 | for(int32_t i=0; i<3; i++) |
| 31839 | { | ||
| 31840 |
2/2✓ Branch 0 taken 45 times.
✓ Branch 1 taken 324 times.
|
369 | if(QMisc.shop[item_scr->catchall].hasitem[i] != 0) |
| 31841 | { | ||
| 31842 | 324 | ++count; | |
| 31843 | 324 | } | |
| 31844 | 369 | } | |
| 31845 | |||
| 31846 |
2/2✓ Branch 0 taken 450 times.
✓ Branch 1 taken 123 times.
|
573 | for(int32_t i=0; i<items.Count(); i++) |
| 31847 | { | ||
| 31848 |
4/4✓ Branch 0 taken 324 times.
✓ Branch 1 taken 126 times.
✓ Branch 2 taken 123 times.
✓ Branch 3 taken 201 times.
|
450 | if(((item*)items.spr(i))->PriceIndex >-1 && i!=index) |
| 31849 | 201 | ((item*)items.spr(i))->pickup=ipDUMMY+ipFADE; | |
| 31850 | 450 | } | |
| 31851 | |||
| 31852 | 123 | break; | |
| 31853 | 269 | } | |
| 31854 | |||
| 31855 | //EVENT | ||
| 31856 | { | ||
| 31857 | 15235 | std::vector<int32_t> &ev = FFCore.eventData; | |
| 31858 | 15235 | ev.clear(); | |
| 31859 | 15235 | ev.push_back(id2*10000); | |
| 31860 | 15235 | ev.push_back(pickup*10000); | |
| 31861 | 15235 | ev.push_back(pstr*10000); | |
| 31862 | 15235 | ev.push_back(pstr_flags*10000); | |
| 31863 | 15235 | ev.push_back(0); | |
| 31864 | 15235 | ev.push_back(ptr->getUID()); | |
| 31865 | 15235 | ev.push_back(GENEVT_ICTYPE_COLLECT*10000); | |
| 31866 | 15235 | ev.push_back(0); | |
| 31867 | |||
| 31868 | 15235 | throwGenScriptEvent(GENSCR_EVENT_COLLECT_ITEM); | |
| 31869 | 15235 | bool nullify = ev[4] != 0; | |
| 31870 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 15235 times.
|
15235 | if(nullify) return false; |
| 31871 | 15235 | id2 = ev[0]/10000; | |
| 31872 | 15235 | pickup = (pickup&(ipCHECK|ipDUMMY)) | (ev[1]/10000); | |
| 31873 | 15235 | pstr = ev[2] / 10000; | |
| 31874 | 15235 | pstr_flags = ev[3] / 10000; | |
| 31875 | } | ||
| 31876 | |||
| 31877 |
2/2✓ Branch 0 taken 1645 times.
✓ Branch 1 taken 13590 times.
|
15235 | if(pickup&ipONETIME) // set mITEM for one-time-only items |
| 31878 | { | ||
| 31879 | 1645 | setmapflag(item_scr, mITEM); | |
| 31880 | |||
| 31881 | //Okay so having old source files is a godsend. You wanna know why? | ||
| 31882 | //Because the issue here was never to so with the wrong flag being set; no it's always been setting the right flag. | ||
| 31883 | //The problem here is that guy rooms were always checking for getmapflag, which used to have an internal check for the default. | ||
| 31884 | //The default would be mITEM if cur_screen was under 128 (AKA not in a cave), and mSPECIALITEM if in a cave. | ||
| 31885 | //However, now the check just always defaults to mSPECIALITEM, which causes this bug. | ||
| 31886 | //This means that this section of code is no longer a bunch of eggshells, cause none of these overcomplicated compats actually solved shit lmao - Dimi | ||
| 31887 | |||
| 31888 | /* | ||
| 31889 | // WARNING - Item pickups are very volatile due to crazy compatability hacks, eg., supporting | ||
| 31890 | // broken behavior from early ZC versions. If you change things here please comment on its purpose. | ||
| 31891 | |||
| 31892 | // some old quests need picking up a screen item to also disable the BELOW flag (for hunger rooms, etc) | ||
| 31893 | // What is etc?! We need to check for every valid state here. ~Gleeok | ||
| 31894 | if(get_qr(qr_ITEMPICKUPSETSBELOW)) | ||
| 31895 | { | ||
| 31896 | // Most older quests need one-time-pickups to not remove special items, etc. | ||
| 31897 | if(origin_scr->room==rGRUMBLE) | ||
| 31898 | { | ||
| 31899 | setmapflag(mSPECIALITEM); | ||
| 31900 | } | ||
| 31901 | } | ||
| 31902 | */ | ||
| 31903 | 1645 | } | |
| 31904 |
2/2✓ Branch 0 taken 12805 times.
✓ Branch 1 taken 785 times.
|
13590 | else if(pickup&ipONETIME2) // set mSPECIALITEM flag for other one-time-only items |
| 31905 |
2/2✓ Branch 0 taken 262 times.
✓ Branch 1 taken 523 times.
|
785 | setmapflag(item_scr, (cur_screen < 128 && get_qr(qr_ITEMPICKUPSETSBELOW)) ? mITEM : mSPECIALITEM); |
| 31906 | |||
| 31907 |
3/4✓ Branch 0 taken 3 times.
✓ Branch 1 taken 15232 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 3 times.
|
15235 | if(exstate > -1 && exstate < 32) |
| 31908 | { | ||
| 31909 | 3 | setxmapflag(item_screen, 1<<exstate); | |
| 31910 | 3 | } | |
| 31911 | |||
| 31912 |
2/2✓ Branch 0 taken 15234 times.
✓ Branch 1 taken 1 times.
|
15235 | if(pickup&ipSECRETS) // Trigger secrets if this item has the secret pickup |
| 31913 | { | ||
| 31914 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | if (item_scr->flags9&fITEMSECRETPERM) setmapflag(item_scr, mSECRET); |
| 31915 | 1 | trigger_secrets_for_screen(TriggerSource::ItemsSecret, item_scr, false); | |
| 31916 | 1 | } | |
| 31917 | |||
| 31918 | 15235 | collectitem_script(id2); | |
| 31919 | 15235 | getitem(id2, ptr->noSound, true); | |
| 31920 | } | ||
| 31921 | |||
| 31922 |
2/2✓ Branch 0 taken 1711 times.
✓ Branch 1 taken 13573 times.
|
15284 | if(pickup&ipHOLDUP) |
| 31923 | { | ||
| 31924 | 1711 | attackclk=0; | |
| 31925 | 1711 | reset_swordcharge(); | |
| 31926 | |||
| 31927 |
3/4✓ Branch 0 taken 1646 times.
✓ Branch 1 taken 65 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 1646 times.
|
1711 | if(action!=swimming && !IsSideSwim()) |
| 31928 | 1646 | reset_hookshot(); | |
| 31929 | |||
| 31930 |
2/2✓ Branch 0 taken 1313 times.
✓ Branch 1 taken 280 times.
|
1711 | if(msg_onscreen) |
| 31931 | { | ||
| 31932 | 280 | dismissmsg(); | |
| 31933 | 280 | } | |
| 31934 | |||
| 31935 | 1593 | clear_bitmap(pricesdisplaybuf); | |
| 31936 | |||
| 31937 |
7/8✓ Branch 0 taken 288 times.
✓ Branch 1 taken 1305 times.
✓ Branch 2 taken 198 times.
✓ Branch 3 taken 90 times.
✓ Branch 4 taken 198 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 96 times.
✓ Branch 7 taken 262 times.
|
1646 | if(get_qr(qr_OLDPICKUP) || ((item_scr->room==rSP_ITEM || item_scr->room==rRP_HC || item_scr->room==rTAKEONE) && (pickup&ipONETIME2)) || |
| 31938 |
4/4✓ Branch 0 taken 53 times.
✓ Branch 1 taken 209 times.
✓ Branch 2 taken 52 times.
✓ Branch 3 taken 1 times.
|
262 | (get_qr(qr_SHOP_ITEMS_VANISH) && (item_scr->room==rBOTTLESHOP || item_scr->room==rSHOP) && (pickup&ipCHECK))) |
| 31939 | { | ||
| 31940 | 1454 | fadeclk=66; | |
| 31941 | 1454 | } | |
| 31942 | |||
| 31943 |
5/6✓ Branch 0 taken 22 times.
✓ Branch 1 taken 1641 times.
✓ Branch 2 taken 22 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 10 times.
✓ Branch 5 taken 12 times.
|
1663 | if(id2!=iBombs || action==swimming || get_qr(qr_BOMBHOLDFIX)) |
| 31944 | { | ||
| 31945 | // don't hold up bombs unless swimming or the bomb hold fix quest rule is on | ||
| 31946 |
2/2✓ Branch 0 taken 17 times.
✓ Branch 1 taken 1634 times.
|
1651 | if(action==swimming) |
| 31947 | { | ||
| 31948 | 17 | action=waterhold1; FFCore.setHeroAction(waterhold1); | |
| 31949 | 17 | } | |
| 31950 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1634 times.
|
1634 | else if(IsSideSwim()) |
| 31951 | { | ||
| 31952 | ✗ | action=sidewaterhold1; FFCore.setHeroAction(sidewaterhold1); | |
| 31953 | ✗ | } | |
| 31954 | else | ||
| 31955 | { | ||
| 31956 | 1634 | action=landhold1; FFCore.setHeroAction(landhold1); | |
| 31957 | } | ||
| 31958 | |||
| 31959 |
2/2✓ Branch 0 taken 1288 times.
✓ Branch 1 taken 363 times.
|
1651 | if(ptr->twohand) |
| 31960 | { | ||
| 31961 |
2/2✓ Branch 0 taken 6 times.
✓ Branch 1 taken 357 times.
|
363 | if(action==waterhold1) |
| 31962 | { | ||
| 31963 | 6 | action=waterhold2; FFCore.setHeroAction(waterhold2); | |
| 31964 | 6 | } | |
| 31965 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 357 times.
|
357 | else if(action==sidewaterhold1) |
| 31966 | { | ||
| 31967 | ✗ | action=sidewaterhold2; FFCore.setHeroAction(sidewaterhold2); | |
| 31968 | ✗ | } | |
| 31969 | else | ||
| 31970 | { | ||
| 31971 | 357 | action=landhold2; FFCore.setHeroAction(landhold2); | |
| 31972 | } | ||
| 31973 | 363 | } | |
| 31974 | |||
| 31975 | 1651 | holdclk=130; | |
| 31976 | |||
| 31977 | //restart music | ||
| 31978 |
2/2✓ Branch 0 taken 1541 times.
✓ Branch 1 taken 110 times.
|
1651 | if(get_qr(qr_HOLDNOSTOPMUSIC) == 0) |
| 31979 | 110 | music_stop(); | |
| 31980 | |||
| 31981 | 1651 | holditem=holdid; // NES consistency: when combining blue potions, hold up the blue potion. | |
| 31982 | 1651 | freeze_guys=true; | |
| 31983 | //show the info string | ||
| 31984 | |||
| 31985 | |||
| 31986 | //if (pstr > 0 ) //&& itemsbuf[index].pstring < msg_count && ( ( itemsbuf[index].pickup_string_flags&itemdataPSTRING_ALWAYS || itemsbuf[index].pickup_string_flags&itemdataPSTRING_IP_HOLDUP ) ) ) | ||
| 31987 | |||
| 31988 | 1651 | int32_t shop_pstr = 0; | |
| 31989 |
2/2✓ Branch 0 taken 142 times.
✓ Branch 1 taken 1509 times.
|
1651 | if (PriceIndex > -1) |
| 31990 | { | ||
| 31991 |
3/3✓ Branch 0 taken 32 times.
✓ Branch 1 taken 109 times.
✓ Branch 2 taken 1 times.
|
142 | switch(item_scr->room) |
| 31992 | { | ||
| 31993 | case rSHOP: | ||
| 31994 | 109 | shop_pstr = QMisc.shop[item_scr->catchall].str[PriceIndex]; | |
| 31995 | 109 | break; | |
| 31996 | case rBOTTLESHOP: | ||
| 31997 | 1 | shop_pstr = QMisc.bottle_shop_types[item_scr->catchall].str[PriceIndex]; | |
| 31998 | 1 | break; | |
| 31999 | } | ||
| 32000 | 142 | } | |
| 32001 |
5/6✓ Branch 0 taken 92 times.
✓ Branch 1 taken 1559 times.
✓ Branch 2 taken 92 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✓ Branch 5 taken 1558 times.
|
1651 | if ( (pstr > 0 && pstr < msg_count) || (shop_pstr > 0 && shop_pstr < msg_count) ) |
| 32002 | { | ||
| 32003 |
10/12✓ Branch 0 taken 92 times.
✓ Branch 1 taken 1 times.
✓ Branch 2 taken 92 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 84 times.
✓ Branch 5 taken 8 times.
✓ Branch 6 taken 84 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 4 times.
✓ Branch 9 taken 80 times.
✓ Branch 10 taken 38 times.
✓ Branch 11 taken 42 times.
|
93 | if ( (pstr > 0 && pstr < msg_count) && ( ( ( (pstr_flags&itemdataPSTRING_ALWAYS) || (pstr_flags&itemdataPSTRING_NOMARK) || ((pstr_flags&itemdataPSTRING_IP_HOLDUP) && replay_compat_held_items_only_held_always_bug()) || (!(FFCore.GetItemMessagePlayed(id2))) ) ) ) ) |
| 32004 | { | ||
| 32005 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 54 times.
|
54 | if ( (!(pstr_flags&itemdataPSTRING_NOMARK)) ) FFCore.SetItemMessagePlayed(id2); |
| 32006 | 54 | } | |
| 32007 | 39 | else pstr = 0; | |
| 32008 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 92 times.
|
93 | if(shop_pstr) |
| 32009 | { | ||
| 32010 | 1 | donewmsg(item_scr, shop_pstr); | |
| 32011 | 1 | enqueued_str = pstr; | |
| 32012 | 1 | } | |
| 32013 |
2/2✓ Branch 0 taken 38 times.
✓ Branch 1 taken 54 times.
|
92 | else if(pstr) |
| 32014 | { | ||
| 32015 | 54 | donewmsg(item_scr, pstr); | |
| 32016 | 54 | } | |
| 32017 | 93 | } | |
| 32018 | |||
| 32019 | 1651 | } | |
| 32020 | |||
| 32021 |
4/4✓ Branch 0 taken 108 times.
✓ Branch 1 taken 1555 times.
✓ Branch 2 taken 104 times.
✓ Branch 3 taken 4 times.
|
1663 | if(itemsbuf[id2].type!=itype_triforcepiece || !(itemsbuf[id2].flags & item_gamedata)) |
| 32022 | { | ||
| 32023 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1559 times.
|
1559 | if (!ptr->noHoldSound) sfx(item_scr->holdupsfx); |
| 32024 | 1559 | } | |
| 32025 | |||
| 32026 | 1663 | ptr->set_forcegrab(false); | |
| 32027 | 1663 | items.del(index); | |
| 32028 | |||
| 32029 |
2/2✓ Branch 0 taken 646 times.
✓ Branch 1 taken 1663 times.
|
2309 | for(int32_t i=0; i<Lwpns.Count(); i++) |
| 32030 | { | ||
| 32031 | 646 | weapon *w = (weapon*)Lwpns.spr(i); | |
| 32032 | |||
| 32033 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 646 times.
|
646 | if(w->dragging==index) |
| 32034 | { | ||
| 32035 | ✗ | w->dragging=-1; | |
| 32036 | ✗ | } | |
| 32037 |
1/2✓ Branch 0 taken 646 times.
✗ Branch 1 not taken.
|
646 | else if(w->dragging>index) |
| 32038 | { | ||
| 32039 | ✗ | w->dragging-=1; | |
| 32040 | ✗ | } | |
| 32041 | 646 | } | |
| 32042 | |||
| 32043 | // clear up shop stuff | ||
| 32044 |
4/4✓ Branch 0 taken 974 times.
✓ Branch 1 taken 689 times.
✓ Branch 2 taken 838 times.
✓ Branch 3 taken 136 times.
|
1663 | if((isdungeon()==0)&&(index!=0)) |
| 32045 | { | ||
| 32046 |
2/2✓ Branch 0 taken 53 times.
✓ Branch 1 taken 83 times.
|
136 | if(boughtsomething) |
| 32047 | { | ||
| 32048 | 83 | fadeclk=66; | |
| 32049 | |||
| 32050 |
3/4✓ Branch 0 taken 80 times.
✓ Branch 1 taken 3 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 80 times.
|
83 | if(((item*)items.spr(0))->id == iRupy && ((item*)items.spr(0))->pickup & ipDUMMY) |
| 32051 | { | ||
| 32052 | 80 | items.del(0); | |
| 32053 | |||
| 32054 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 80 times.
|
80 | for(int32_t i=0; i<Lwpns.Count(); i++) |
| 32055 | { | ||
| 32056 | ✗ | weapon *w = (weapon*)Lwpns.spr(i); | |
| 32057 | |||
| 32058 | ✗ | if(w->dragging==0) | |
| 32059 | { | ||
| 32060 | ✗ | w->dragging=-1; | |
| 32061 | ✗ | } | |
| 32062 | ✗ | else if(w->dragging>0) | |
| 32063 | { | ||
| 32064 | ✗ | w->dragging-=1; | |
| 32065 | ✗ | } | |
| 32066 | ✗ | } | |
| 32067 | 80 | } | |
| 32068 | 83 | } | |
| 32069 | |||
| 32070 |
1/2✓ Branch 0 taken 136 times.
✗ Branch 1 not taken.
|
136 | if(msg_onscreen) |
| 32071 | { | ||
| 32072 | ✗ | dismissmsg(); | |
| 32073 | ✗ | } | |
| 32074 | |||
| 32075 | 136 | clear_bitmap(pricesdisplaybuf); | |
| 32076 | 136 | set_clip_state(pricesdisplaybuf, 1); | |
| 32077 | 136 | } | |
| 32078 | |||
| 32079 | // items.del(index); | ||
| 32080 | 1663 | } | |
| 32081 | else | ||
| 32082 | { | ||
| 32083 | 13573 | ptr->set_forcegrab(false); | |
| 32084 | 13573 | items.del(index); | |
| 32085 | |||
| 32086 |
2/2✓ Branch 0 taken 12167 times.
✓ Branch 1 taken 13573 times.
|
25740 | for(int32_t i=0; i<Lwpns.Count(); i++) |
| 32087 | { | ||
| 32088 | 12167 | weapon *w = (weapon*)Lwpns.spr(i); | |
| 32089 | |||
| 32090 |
2/2✓ Branch 0 taken 496 times.
✓ Branch 1 taken 11671 times.
|
12167 | if(w->dragging==index) |
| 32091 | { | ||
| 32092 | 496 | w->dragging=-1; | |
| 32093 | 496 | } | |
| 32094 |
2/2✓ Branch 0 taken 11667 times.
✓ Branch 1 taken 4 times.
|
11671 | else if(w->dragging>index) |
| 32095 | { | ||
| 32096 | 4 | w->dragging-=1; | |
| 32097 | 4 | } | |
| 32098 | 12167 | } | |
| 32099 | |||
| 32100 |
2/2✓ Branch 0 taken 13560 times.
✓ Branch 1 taken 13 times.
|
13573 | if(msg_onscreen) |
| 32101 | { | ||
| 32102 | 13 | dismissmsg(); | |
| 32103 | 13 | } | |
| 32104 | |||
| 32105 | //general item pickup message | ||
| 32106 | //show the info string | ||
| 32107 | //non-held | ||
| 32108 | //if ( pstr > 0 ) //&& itemsbuf[index].pstring < msg_count && ( ( itemsbuf[index].pickup_string_flags&itemdataPSTRING_ALWAYS || (!(FFCore.GetItemMessagePlayed(index))) ) ) ) | ||
| 32109 |
3/6✓ Branch 0 taken 136 times.
✓ Branch 1 taken 13437 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 136 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
13573 | int32_t shop_pstr = ( item_scr->room == rSHOP && PriceIndex>=0 && QMisc.shop[item_scr->catchall].str[PriceIndex] > 0 ) ? QMisc.shop[item_scr->catchall].str[PriceIndex] : 0; |
| 32110 |
4/6✓ Branch 0 taken 2 times.
✓ Branch 1 taken 13571 times.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 13571 times.
|
13573 | if ( (pstr > 0 && pstr < msg_count) || (shop_pstr > 0 && shop_pstr < msg_count) ) |
| 32111 | { | ||
| 32112 |
7/12✓ Branch 0 taken 2 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 2 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 1 times.
✓ Branch 5 taken 1 times.
✓ Branch 6 taken 1 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 1 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 1 times.
|
2 | if ( (pstr > 0 && pstr < msg_count) && ( (!(pstr_flags&itemdataPSTRING_IP_HOLDUP)) && ( pstr_flags&itemdataPSTRING_NOMARK || pstr_flags&itemdataPSTRING_ALWAYS || (!(FFCore.GetItemMessagePlayed(id2))) ) ) ) |
| 32113 | { | ||
| 32114 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1 times.
|
1 | if ( (!(pstr_flags&itemdataPSTRING_NOMARK)) ) FFCore.SetItemMessagePlayed(id2); |
| 32115 | 1 | } | |
| 32116 | 1 | else pstr = 0; | |
| 32117 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2 times.
|
2 | if(shop_pstr) |
| 32118 | { | ||
| 32119 | ✗ | donewmsg(item_scr, shop_pstr); | |
| 32120 | ✗ | enqueued_str = pstr; | |
| 32121 | ✗ | } | |
| 32122 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 1 times.
|
2 | else if(pstr) |
| 32123 | { | ||
| 32124 | 1 | donewmsg(item_scr, pstr); | |
| 32125 | 1 | } | |
| 32126 | 2 | } | |
| 32127 | |||
| 32128 | |||
| 32129 | 13573 | clear_bitmap(pricesdisplaybuf); | |
| 32130 | 13573 | set_clip_state(pricesdisplaybuf, 1); | |
| 32131 | } | ||
| 32132 | |||
| 32133 |
2/2✓ Branch 0 taken 8 times.
✓ Branch 1 taken 11 times.
|
15255 | if(itemsbuf[id2].type==itype_triforcepiece |
| 32134 |
4/4✓ Branch 0 taken 119 times.
✓ Branch 1 taken 15117 times.
✓ Branch 2 taken 19 times.
✓ Branch 3 taken 100 times.
|
15236 | && itemsbuf[id2].misc2 <= 0 && linked_parent == eeGANON) |
| 32135 | { | ||
| 32136 | 11 | game->lvlitems[dlevel]|=(1 << li_boss_killed); | |
| 32137 | 11 | } | |
| 32138 | 15236 | handle_triforce(item_scr, id2); | |
| 32139 |
2/2✓ Branch 0 taken 1577 times.
✓ Branch 1 taken 13659 times.
|
15236 | if(!holdclk) |
| 32140 | 13659 | post_item_collect(); | |
| 32141 | |||
| 32142 | 15236 | return true; | |
| 32143 | 14811193 | } | |
| 32144 | |||
| 32145 | 310 | void HeroClass::StartRefill(int32_t refillWhat) | |
| 32146 | { | ||
| 32147 |
2/2✓ Branch 0 taken 34 times.
✓ Branch 1 taken 276 times.
|
310 | if(FFCore.quest_format[vZelda] < 0x255) |
| 32148 | { | ||
| 32149 | //Yes, this isn't a QR check. This was implemented before the QRs got bumped up. | ||
| 32150 | //I attempted to change this check to a quest rule, but here's the issue: this affects | ||
| 32151 | //triforces and potions as well, not just fairy flags. This means that having a compat rule | ||
| 32152 | //would result in a rule that is checked by default for every tileset or quest made before | ||
| 32153 | //2.55, one in a place most people won't check. That means that if they were to go to use | ||
| 32154 | //the new potion or triforce flags for jinx curing behavior, they'd find that it doesn't work, | ||
| 32155 | //all because of an obscure compat rule being checked. Most peoples instincts are sadly not | ||
| 32156 | //"go through the compat rules and turn them all off", so this remains a version check instead | ||
| 32157 | //of a qr check. Don't make my mistake and waste time trying to change this in vain. -Deedee | ||
| 32158 | 276 | Start250Refill(refillWhat); | |
| 32159 | 276 | return; | |
| 32160 | } | ||
| 32161 | |||
| 32162 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 34 times.
|
34 | if(!refilling) |
| 32163 | { | ||
| 32164 | 34 | refillclk=21; | |
| 32165 | 34 | stop_sfx(QMisc.miscsfx[sfxLOWHEART]); | |
| 32166 | 34 | sfx(WAV_REFILL,128,true); | |
| 32167 | 34 | refilling=refillWhat; | |
| 32168 | |||
| 32169 |
2/2✓ Branch 0 taken 9 times.
✓ Branch 1 taken 25 times.
|
34 | if(refill_why>=0) // Item index |
| 32170 | { | ||
| 32171 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
|
9 | if(itemsbuf[refill_why].type==itype_potion) |
| 32172 | { | ||
| 32173 | ✗ | if(itemsbuf[refill_why].flags & item_flag3){swordclk=0;verifyAWpn();} | |
| 32174 | ✗ | if(itemsbuf[refill_why].flags & item_flag4)itemclk=0; | |
| 32175 | ✗ | if(itemsbuf[refill_why].flags & item_flag5)shieldjinxclk=0; | |
| 32176 | ✗ | } | |
| 32177 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
|
9 | else if(itemsbuf[refill_why].type==itype_triforcepiece) |
| 32178 | { | ||
| 32179 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
|
9 | if(itemsbuf[refill_why].flags & item_flag3){swordclk=0;verifyAWpn();} |
| 32180 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
|
9 | if(itemsbuf[refill_why].flags & item_flag4)itemclk=0; |
| 32181 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9 times.
|
9 | if(itemsbuf[refill_why].flags & item_flag5)shieldjinxclk=0; |
| 32182 | 9 | } | |
| 32183 | 9 | } | |
| 32184 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 25 times.
|
25 | else if(refill_why==REFILL_FAIRY) |
| 32185 | { | ||
| 32186 |
2/2✓ Branch 0 taken 16 times.
✓ Branch 1 taken 9 times.
|
25 | if(!get_qr(qr_NONBUBBLEFAIRIES)){swordclk=0;verifyAWpn();} |
| 32187 |
2/2✓ Branch 0 taken 18 times.
✓ Branch 1 taken 7 times.
|
25 | if(get_qr(qr_ITEMBUBBLE))itemclk=0; |
| 32188 |
1/2✓ Branch 0 taken 25 times.
✗ Branch 1 not taken.
|
25 | if(get_qr(qr_SHIELDBUBBLE))shieldjinxclk=0; |
| 32189 | 25 | } | |
| 32190 | 34 | } | |
| 32191 | 310 | } | |
| 32192 | |||
| 32193 | 276 | void HeroClass::Start250Refill(int32_t refillWhat) | |
| 32194 | { | ||
| 32195 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 276 times.
|
276 | if(!refilling) |
| 32196 | { | ||
| 32197 | 276 | refillclk=21; | |
| 32198 | 276 | stop_sfx(QMisc.miscsfx[sfxLOWHEART]); | |
| 32199 | 276 | sfx(WAV_REFILL,128,true); | |
| 32200 | 276 | refilling=refillWhat; | |
| 32201 | |||
| 32202 | // For ~2 years <2.55 quests were broken, never restoring anything on fairies. | ||
| 32203 | // https://discord.com/channels/876899628556091432/1275805052006563861 | ||
| 32204 |
2/4✓ Branch 0 taken 276 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 276 times.
|
276 | if (replay_is_active() && replay_version_check(0, 35)) |
| 32205 | { | ||
| 32206 |
2/4✓ Branch 0 taken 276 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 276 times.
✗ Branch 3 not taken.
|
276 | std::string qst = replay_get_meta_str("qst"); |
| 32207 |
9/12✓ Branch 0 taken 276 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 229 times.
✓ Branch 3 taken 47 times.
✓ Branch 4 taken 229 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 201 times.
✓ Branch 7 taken 28 times.
✓ Branch 8 taken 201 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 23 times.
✓ Branch 11 taken 178 times.
|
276 | if (qst == "first_quest_layered.qst" || qst == "nes_remastered.qst" || qst == "demosp253.qst") |
| 32208 | 98 | return; | |
| 32209 |
2/3✗ Branch 0 not taken.
✓ Branch 1 taken 98 times.
✓ Branch 2 taken 178 times.
|
276 | } |
| 32210 | |||
| 32211 |
2/2✓ Branch 0 taken 86 times.
✓ Branch 1 taken 92 times.
|
178 | if(refill_why>=0) // Item index |
| 32212 | { | ||
| 32213 |
4/4✓ Branch 0 taken 15 times.
✓ Branch 1 taken 71 times.
✓ Branch 2 taken 8 times.
✓ Branch 3 taken 7 times.
|
86 | if((itemsbuf[refill_why].type==itype_potion)&&(!get_qr(qr_NONBUBBLEMEDICINE))) |
| 32214 | { | ||
| 32215 | 7 | swordclk=0; | |
| 32216 | 7 | verifyAWpn(); | |
| 32217 |
1/2✓ Branch 0 taken 7 times.
✗ Branch 1 not taken.
|
7 | if(get_qr(qr_ITEMBUBBLE)) itemclk=0; |
| 32218 | 7 | } | |
| 32219 | |||
| 32220 |
4/4✓ Branch 0 taken 71 times.
✓ Branch 1 taken 15 times.
✓ Branch 2 taken 14 times.
✓ Branch 3 taken 57 times.
|
86 | if((itemsbuf[refill_why].type==itype_triforcepiece)&&(!get_qr(qr_NONBUBBLETRIFORCE))) |
| 32221 | { | ||
| 32222 | 57 | swordclk=0; | |
| 32223 | 57 | verifyAWpn(); | |
| 32224 |
2/2✓ Branch 0 taken 56 times.
✓ Branch 1 taken 1 times.
|
57 | if(get_qr(qr_ITEMBUBBLE)) itemclk=0; |
| 32225 | 57 | } | |
| 32226 | 86 | } | |
| 32227 |
3/4✓ Branch 0 taken 92 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 38 times.
✓ Branch 3 taken 54 times.
|
92 | else if((refill_why==REFILL_FAIRY)&&(!get_qr(qr_NONBUBBLEFAIRIES))) |
| 32228 | { | ||
| 32229 | 54 | swordclk=0; | |
| 32230 | 54 | verifyAWpn(); | |
| 32231 |
1/2✓ Branch 0 taken 54 times.
✗ Branch 1 not taken.
|
54 | if(get_qr(qr_ITEMBUBBLE)) itemclk=0; |
| 32232 | 54 | } | |
| 32233 | 178 | } | |
| 32234 | 276 | } | |
| 32235 | |||
| 32236 | 389512 | bool HeroClass::refill() | |
| 32237 | { | ||
| 32238 |
4/4✓ Branch 0 taken 22652 times.
✓ Branch 1 taken 366860 times.
✓ Branch 2 taken 636 times.
✓ Branch 3 taken 22016 times.
|
389512 | if(refilling==REFILL_NONE || refilling==REFILL_FAIRYDONE) |
| 32239 | { | ||
| 32240 | 367496 | return false; | |
| 32241 | } | ||
| 32242 | |||
| 32243 | 22016 | ++refillclk; | |
| 32244 | 22016 | int32_t speed = get_qr(qr_FASTFILL) ? 6 : 22; | |
| 32245 | 22016 | int32_t refill_heart_stop=game->get_maxlife(); | |
| 32246 | 22016 | int32_t refill_magic_stop=game->get_maxmagic(); | |
| 32247 | |||
| 32248 |
4/4✓ Branch 0 taken 10865 times.
✓ Branch 1 taken 11151 times.
✓ Branch 2 taken 4542 times.
✓ Branch 3 taken 6323 times.
|
22016 | if(refill_why>=0 && itemsbuf[refill_why].type==itype_potion) |
| 32249 | { | ||
| 32250 |
2/6✓ Branch 0 taken 6323 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 6323 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
6323 | refill_heart_stop=zc_min(potion_life+(itemsbuf[refill_why].flags & item_flag1 ?int32_t(game->get_maxlife()*(itemsbuf[refill_why].misc1 /100.0)):((itemsbuf[refill_why].misc1 *game->get_hp_per_heart()))),game->get_maxlife()); |
| 32251 |
2/6✓ Branch 0 taken 6323 times.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 6323 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
6323 | refill_magic_stop=zc_min(potion_magic+(itemsbuf[refill_why].flags & item_flag2 ?int32_t(game->get_maxmagic()*(itemsbuf[refill_why].misc2 /100.0)):((itemsbuf[refill_why].misc2 *game->get_mp_per_block()))),game->get_maxmagic()); |
| 32252 | 6323 | } | |
| 32253 | |||
| 32254 |
2/2✓ Branch 0 taken 19435 times.
✓ Branch 1 taken 2581 times.
|
22016 | if(refillclk%speed == 0) |
| 32255 | { | ||
| 32256 | // game->life&=0xFFC; | ||
| 32257 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 1194 times.
✓ Branch 2 taken 3 times.
✓ Branch 3 taken 1384 times.
|
2581 | switch(refill_what) |
| 32258 | { | ||
| 32259 | case REFILL_LIFE: | ||
| 32260 |
2/2✓ Branch 0 taken 55 times.
✓ Branch 1 taken 1139 times.
|
1194 | game->set_life(zc_min(refill_heart_stop, (game->get_life()+game->get_hp_per_heart()/2))); |
| 32261 | |||
| 32262 |
2/2✓ Branch 0 taken 156 times.
✓ Branch 1 taken 1038 times.
|
1194 | if(game->get_life()>=refill_heart_stop) |
| 32263 | { | ||
| 32264 | 156 | game->set_life(refill_heart_stop); | |
| 32265 | //kill_sfx(); //this 1. needs to be pause resme, and 2. needs an item flag. | ||
| 32266 |
2/2✓ Branch 0 taken 39936 times.
✓ Branch 1 taken 156 times.
|
40092 | for ( int32_t q = 0; q < WAV_COUNT; q++ ) |
| 32267 | { | ||
| 32268 |
2/2✓ Branch 0 taken 156 times.
✓ Branch 1 taken 39780 times.
|
39936 | if ( q == (int32_t)hero_scr->oceansfx ) continue; |
| 32269 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 39779 times.
|
39780 | if ( q == (int32_t)hero_scr->bosssfx ) continue; |
| 32270 | 39779 | stop_sfx(q); | |
| 32271 | 39779 | } | |
| 32272 | 156 | sfx(QMisc.miscsfx[sfxREFILL]); | |
| 32273 | 156 | refilling=REFILL_NONE; | |
| 32274 | 156 | return false; | |
| 32275 | } | ||
| 32276 | |||
| 32277 | 1038 | break; | |
| 32278 | |||
| 32279 | case REFILL_MAGIC: | ||
| 32280 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3 times.
|
3 | game->set_magic(zc_min(refill_magic_stop, (game->get_magic()+game->get_mp_per_block()/4))); |
| 32281 | |||
| 32282 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 2 times.
|
3 | if(game->get_magic()>=refill_magic_stop) |
| 32283 | { | ||
| 32284 | 1 | game->set_magic(refill_magic_stop); | |
| 32285 | //kill_sfx(); //this 1. needs to be pause resme, and 2. needs an item flag. | ||
| 32286 |
2/2✓ Branch 0 taken 256 times.
✓ Branch 1 taken 1 times.
|
257 | for ( int32_t q = 0; q < WAV_COUNT; q++ ) |
| 32287 | { | ||
| 32288 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 255 times.
|
256 | if ( q == (int32_t)hero_scr->oceansfx ) continue; |
| 32289 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 255 times.
|
255 | if ( q == (int32_t)hero_scr->bosssfx ) continue; |
| 32290 | 255 | stop_sfx(q); | |
| 32291 | 255 | } | |
| 32292 | 1 | sfx(QMisc.miscsfx[sfxREFILL]); | |
| 32293 | 1 | refilling=REFILL_NONE; | |
| 32294 | 1 | return false; | |
| 32295 | } | ||
| 32296 | |||
| 32297 | 2 | break; | |
| 32298 | |||
| 32299 | case REFILL_ALL: | ||
| 32300 |
2/2✓ Branch 0 taken 138 times.
✓ Branch 1 taken 1246 times.
|
1384 | game->set_life(zc_min(refill_heart_stop, (game->get_life()+game->get_hp_per_heart()/2))); |
| 32301 |
2/2✓ Branch 0 taken 1244 times.
✓ Branch 1 taken 140 times.
|
1384 | game->set_magic(zc_min(refill_magic_stop, (game->get_magic()+game->get_mp_per_block()/4))); |
| 32302 | |||
| 32303 |
4/4✓ Branch 0 taken 203 times.
✓ Branch 1 taken 1181 times.
✓ Branch 2 taken 153 times.
✓ Branch 3 taken 50 times.
|
1384 | if((game->get_life()>=refill_heart_stop)&&(game->get_magic()>=refill_magic_stop)) |
| 32304 | { | ||
| 32305 | 153 | game->set_life(refill_heart_stop); | |
| 32306 | 153 | game->set_magic(refill_magic_stop); | |
| 32307 | //kill_sfx(); //this 1. needs to be pause resme, and 2. needs an item flag. | ||
| 32308 |
2/2✓ Branch 0 taken 39168 times.
✓ Branch 1 taken 153 times.
|
39321 | for ( int32_t q = 0; q < WAV_COUNT; q++ ) |
| 32309 | { | ||
| 32310 |
2/2✓ Branch 0 taken 153 times.
✓ Branch 1 taken 39015 times.
|
39168 | if ( q == (int32_t)hero_scr->oceansfx ) continue; |
| 32311 |
2/2✓ Branch 0 taken 21 times.
✓ Branch 1 taken 38994 times.
|
39015 | if ( q == (int32_t)hero_scr->bosssfx ) continue; |
| 32312 | 38994 | stop_sfx(q); | |
| 32313 | 38994 | } | |
| 32314 | 153 | sfx(QMisc.miscsfx[sfxREFILL]); | |
| 32315 | 153 | refilling=REFILL_NONE; | |
| 32316 | 153 | return false; | |
| 32317 | } | ||
| 32318 | |||
| 32319 | 1231 | break; | |
| 32320 | } | ||
| 32321 | 2271 | } | |
| 32322 | |||
| 32323 | 21706 | return true; | |
| 32324 | 389512 | } | |
| 32325 | |||
| 32326 | 100 | void HeroClass::getTriforce(int32_t id2) | |
| 32327 | { | ||
| 32328 | |||
| 32329 | PALETTE flash_pal; | ||
| 32330 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 100 times.
|
100 | int32_t refill_frame = ( (itemsbuf[id2].misc5 > 0) ? itemsbuf[id2].misc5 : 88 ); |
| 32331 | |||
| 32332 |
2/2✓ Branch 0 taken 25600 times.
✓ Branch 1 taken 100 times.
|
25700 | for(int32_t i=0; i<256; i++) |
| 32333 | { | ||
| 32334 |
2/2✓ Branch 0 taken 15616 times.
✓ Branch 1 taken 9984 times.
|
25600 | flash_pal[i] = get_qr(qr_FADE) ? _RGB(255,255,0) : _RGB(255,255,255); |
| 32335 | 25600 | } | |
| 32336 | |||
| 32337 | |||
| 32338 | |||
| 32339 | //get rid off all sprites but Hero | ||
| 32340 | 100 | guys.clear(); | |
| 32341 | 100 | items.clear(); | |
| 32342 | 100 | Ewpns.clear(); | |
| 32343 | 100 | Lwpns.clear(); | |
| 32344 | 100 | chainlinks.clear(); | |
| 32345 | |||
| 32346 | 100 | kill_subscr_items(); | |
| 32347 | |||
| 32348 | 100 | sfx(itemsbuf[id2].playsound); | |
| 32349 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 100 times.
|
100 | if ( !(itemsbuf[id2].flags & item_flag11) ) music_stop(); |
| 32350 | |||
| 32351 | //If item flag six is enabled, and a sound is set to attributes[2], play that sound. | ||
| 32352 |
1/2✓ Branch 0 taken 100 times.
✗ Branch 1 not taken.
|
100 | if ( (itemsbuf[id2].flags & item_flag14) ) |
| 32353 | { | ||
| 32354 | ✗ | uint8_t playwav = itemsbuf[id2].misc3; | |
| 32355 | ✗ | sfx(playwav); | |
| 32356 | |||
| 32357 | ✗ | } | |
| 32358 | |||
| 32359 | //itemsbuf[id2].flags & item_flag9 : Don't dismiss Messages | ||
| 32360 | //itemsbuf[id2].flags & item_flag10 : Cutscene interrupts action script.. | ||
| 32361 | //itemsbuf[id2].flags & item_flag11 : Don't change music. | ||
| 32362 | //itemsbuf[id2].flags & item_flag12 : Run Collect Script Script On Collection | ||
| 32363 | //itemsbuf[id2].flags & item_flag13 : Run Action Script On Collection | ||
| 32364 | //itemsbuf[id2].flags & item_flag14 : Play second sound (WAV) from Attributes[2] (misc2) | ||
| 32365 | //itemsbuf[id2].flags & item_flag15 : No MIDI | ||
| 32366 | |||
| 32367 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 100 times.
|
100 | if(!(itemsbuf[id2].flags & item_flag15)) //No MIDI flag |
| 32368 | { | ||
| 32369 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 100 times.
|
100 | if(itemsbuf[id2].misc1) |
| 32370 | ✗ | jukebox(itemsbuf[id2].misc1+ZC_MIDI_COUNT-1); | |
| 32371 | else | ||
| 32372 | 100 | try_zcmusic("zelda.nsf",qstpath,5,ZC_MIDI_TRIFORCE,get_emusic_volume()); | |
| 32373 | 100 | } | |
| 32374 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 100 times.
|
100 | if(itemsbuf[id2].flags & item_gamedata) |
| 32375 | { | ||
| 32376 | 100 | game->lvlitems[dlevel]|=(1 << li_mcguffin); | |
| 32377 | 100 | } | |
| 32378 | |||
| 32379 | 100 | int32_t f=0; | |
| 32380 | 100 | int32_t x2=0; | |
| 32381 | 100 | int32_t curtain_x=0; | |
| 32382 | 100 | int32_t c=0; | |
| 32383 | |||
| 32384 | 100 | do | |
| 32385 | { | ||
| 32386 | |||
| 32387 | |||
| 32388 |
1/2✓ Branch 0 taken 52360 times.
✗ Branch 1 not taken.
|
52360 | if ( (itemsbuf[id2].flags & item_flag13) ) //Run action script on collection. |
| 32389 | { | ||
| 32390 | ✗ | if ( itemsbuf[id2].script ) | |
| 32391 | { | ||
| 32392 | ✗ | if ( !FFCore.doscript(ScriptType::Item, id2) ) | |
| 32393 | { | ||
| 32394 | ✗ | int i = id2; | |
| 32395 | ✗ | FFCore.reset_script_engine_data(ScriptType::Item, i); | |
| 32396 | ✗ | ZScriptVersion::RunScript(ScriptType::Item, itemsbuf[id2].script, i); | |
| 32397 | ✗ | FFCore.deallocateAllScriptOwned(ScriptType::Item, i); | |
| 32398 | ✗ | } | |
| 32399 | else | ||
| 32400 | { | ||
| 32401 | ✗ | if ( !(itemsbuf[id2].flags & item_flag10) ) //Cutscene halts the script it resumes after cutscene. | |
| 32402 | ✗ | ZScriptVersion::RunScript(ScriptType::Item, itemsbuf[id2].script, id2); //if flag is off, run the script every frame of the cutscene. | |
| 32403 | } | ||
| 32404 | ✗ | } | |
| 32405 | ✗ | } | |
| 32406 | //if ( itemsbuf[id2].misc2 == 2 ) //No cutscene; what if people used '2' on older quests? | ||
| 32407 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 52360 times.
|
52360 | if ( (itemsbuf[id2].flags & item_flag12) ) //No cutscene |
| 32408 | { | ||
| 32409 | ✗ | return; | |
| 32410 | } | ||
| 32411 | |||
| 32412 |
2/2✓ Branch 0 taken 32594 times.
✓ Branch 1 taken 19766 times.
|
52360 | if(!COOLSCROLL) |
| 32413 | { | ||
| 32414 | 19766 | show_subscreen_items=false; | |
| 32415 | 19766 | } | |
| 32416 | |||
| 32417 |
2/2✓ Branch 0 taken 52260 times.
✓ Branch 1 taken 100 times.
|
52360 | if(f==40) |
| 32418 | { | ||
| 32419 | 100 | actiontype oldaction = action; | |
| 32420 | 100 | ALLOFF((!(itemsbuf[id2].flags & item_flag9)), false); | |
| 32421 | 100 | action=oldaction; // have to reset this flag | |
| 32422 | 100 | FFCore.setHeroAction(oldaction); | |
| 32423 | 100 | } | |
| 32424 | |||
| 32425 | |||
| 32426 |
4/4✓ Branch 0 taken 48360 times.
✓ Branch 1 taken 4000 times.
✓ Branch 2 taken 43560 times.
✓ Branch 3 taken 4800 times.
|
52360 | if(f>=40 && f<88) |
| 32427 | { | ||
| 32428 |
2/2✓ Branch 0 taken 2928 times.
✓ Branch 1 taken 1872 times.
|
4800 | if(get_qr(qr_FADE)) |
| 32429 | { | ||
| 32430 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 2928 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
2928 | if (!flash_reduction_enabled() && (f&7) == 0) |
| 32431 | { | ||
| 32432 | ✗ | fade_interpolate(RAMpal,flash_pal,RAMpal,42,0,CSET(6)-1); | |
| 32433 | ✗ | refreshpal=true; | |
| 32434 | ✗ | } | |
| 32435 | |||
| 32436 |
2/2✓ Branch 0 taken 2196 times.
✓ Branch 1 taken 732 times.
|
2928 | if((f&3)==2) |
| 32437 | { | ||
| 32438 | 732 | loadpalset(0,0); | |
| 32439 | 732 | loadpalset(1,1); | |
| 32440 | 732 | loadpalset(5,5); | |
| 32441 | |||
| 32442 |
2/2✓ Branch 0 taken 720 times.
✓ Branch 1 taken 12 times.
|
732 | if(cur_screen<128) loadlvlpal(DMaps[cur_dmap].color); |
| 32443 | 12 | else loadlvlpal(0xB); // TODO: Cave/Item Cellar distinction? | |
| 32444 | 732 | } | |
| 32445 | 2928 | } | |
| 32446 | else | ||
| 32447 | { | ||
| 32448 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 1872 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
1872 | if(!flash_reduction_enabled() && (f&7) == 0) |
| 32449 | { | ||
| 32450 | ✗ | for(int32_t cs2=2; cs2<5; cs2++) | |
| 32451 | { | ||
| 32452 | ✗ | for(int32_t i=1; i<16; i++) | |
| 32453 | { | ||
| 32454 | ✗ | RAMpal[CSET(cs2)+i]=flash_pal[CSET(cs2)+i]; | |
| 32455 | ✗ | } | |
| 32456 | ✗ | } | |
| 32457 | |||
| 32458 | ✗ | refreshpal=true; | |
| 32459 | ✗ | } | |
| 32460 | |||
| 32461 |
2/2✓ Branch 0 taken 1638 times.
✓ Branch 1 taken 234 times.
|
1872 | if((f&7)==4) |
| 32462 | { | ||
| 32463 |
1/2✓ Branch 0 taken 234 times.
✗ Branch 1 not taken.
|
234 | if(cur_screen<128) loadlvlpal(DMaps[cur_dmap].color); |
| 32464 | ✗ | else loadlvlpal(0xB); | |
| 32465 | |||
| 32466 | 234 | loadpalset(5,5); | |
| 32467 | 234 | } | |
| 32468 | } | ||
| 32469 | 4800 | } | |
| 32470 | |||
| 32471 | |||
| 32472 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 52360 times.
|
52360 | if(itemsbuf[id2].flags & item_gamedata) |
| 32473 | { | ||
| 32474 |
2/2✓ Branch 0 taken 52260 times.
✓ Branch 1 taken 100 times.
|
52360 | if(f==refill_frame) |
| 32475 | { | ||
| 32476 | 100 | refill_what=REFILL_ALL; | |
| 32477 | 100 | refill_why=id2; | |
| 32478 | 100 | StartRefill(REFILL_ALL); | |
| 32479 | 100 | refill(); | |
| 32480 | 100 | } | |
| 32481 | |||
| 32482 |
2/2✓ Branch 0 taken 47900 times.
✓ Branch 1 taken 4460 times.
|
52360 | if(f==(refill_frame+1)) |
| 32483 | { | ||
| 32484 |
2/2✓ Branch 0 taken 100 times.
✓ Branch 1 taken 4360 times.
|
4460 | if(refill()) |
| 32485 | { | ||
| 32486 | 4360 | --f; | |
| 32487 | 4360 | } | |
| 32488 | 4460 | } | |
| 32489 | 52360 | } | |
| 32490 | |||
| 32491 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 52360 times.
|
52360 | if(itemsbuf[id2].flags & item_flag1) // Warp out flag |
| 32492 | { | ||
| 32493 |
4/4✓ Branch 0 taken 27200 times.
✓ Branch 1 taken 25160 times.
✓ Branch 2 taken 19200 times.
✓ Branch 3 taken 8000 times.
|
52360 | if(f>=208 && f<288) |
| 32494 | { | ||
| 32495 | 8000 | ++x2; | |
| 32496 | |||
| 32497 |
3/3✓ Branch 0 taken 3200 times.
✓ Branch 1 taken 3200 times.
✓ Branch 2 taken 1600 times.
|
8000 | switch(++c) |
| 32498 | { | ||
| 32499 | case 5: | ||
| 32500 | 1600 | c=0; | |
| 32501 | [[fallthrough]]; | ||
| 32502 | case 0: | ||
| 32503 | case 2: | ||
| 32504 | case 3: | ||
| 32505 | 4800 | ++x2; | |
| 32506 | 4800 | break; | |
| 32507 | } | ||
| 32508 | 8000 | } | |
| 32509 | |||
| 32510 | 52360 | do_dcounters(); | |
| 32511 | |||
| 32512 |
2/2✓ Branch 0 taken 19200 times.
✓ Branch 1 taken 33160 times.
|
52360 | if(f<288) |
| 32513 | { | ||
| 32514 | 33160 | curtain_x=TRUNCATE_HALF_TILE(x2); | |
| 32515 | 33160 | draw_screen_clip_rect_x1=curtain_x; | |
| 32516 | 33160 | draw_screen_clip_rect_x2=255-curtain_x; | |
| 32517 | 33160 | draw_screen_clip_rect_y1=0; | |
| 32518 | 33160 | draw_screen_clip_rect_y2=231; | |
| 32519 | 33160 | } | |
| 32520 | 52360 | } | |
| 32521 | |||
| 32522 | 52360 | draw_screen(); | |
| 32523 | |||
| 32524 | //Run Triforce Script | ||
| 32525 | 52360 | advanceframe(true); | |
| 32526 | 52360 | ++f; | |
| 32527 |
2/2✓ Branch 0 taken 52260 times.
✓ Branch 1 taken 100 times.
|
104720 | } |
| 32528 | while | ||
| 32529 | ( | ||
| 32530 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 52360 times.
|
52360 | (f < ( (itemsbuf[id2].misc4 > 0) ? itemsbuf[id2].misc4 : 408)) |
| 32531 |
4/6✓ Branch 0 taken 7300 times.
✓ Branch 1 taken 45060 times.
✓ Branch 2 taken 7300 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 7300 times.
|
52360 | || (!(itemsbuf[id2].flags & item_flag15) /*&& !(itemsbuf[id2].flags & item_flag11)*/ && (midi_pos > 0 && !replay_is_active())) |
| 32532 |
2/8✗ Branch 0 not taken.
✗ Branch 1 not taken.
✓ Branch 2 taken 7300 times.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✓ Branch 5 taken 7300 times.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
14600 | || (/*!(itemsbuf[id2].flags & item_flag15) &&*/ !(itemsbuf[id2].flags & item_flag11) && (zcmusic!=NULL) && (zcmusic->position<800 && !replay_is_active()) |
| 32533 | // Music is played at the same speed when fps is uncapped, so in replay mode we need to ignore the music position and instead | ||
| 32534 | // just count frames. 480 is the number of frames it takes for the triforce song in classic_1st.qst to finish playing, but the exact | ||
| 32535 | // value doesn't matter. | ||
| 32536 |
1/4✗ Branch 0 not taken.
✗ Branch 1 not taken.
✗ Branch 2 not taken.
✓ Branch 3 taken 7300 times.
|
7300 | || (replay_is_active() && f < 480) ) |
| 32537 | ); // 800 may not be just right, but it works | ||
| 32538 | |||
| 32539 | 100 | action=none; FFCore.setHeroAction(none); | |
| 32540 | 100 | holdclk=0; | |
| 32541 | 100 | draw_screen_clip_rect_x1=0; | |
| 32542 | 100 | draw_screen_clip_rect_x2=255; | |
| 32543 | 100 | draw_screen_clip_rect_y1=0; | |
| 32544 | 100 | draw_screen_clip_rect_y2=231; | |
| 32545 | 100 | show_subscreen_items=true; | |
| 32546 | |||
| 32547 | //Warp Hero out of item cellars, in 2.10 and earlier quests. -Z ( 16th January, 2019 ) | ||
| 32548 | //Added a QR for this, to Other->2, as `Triforce in Cellar Warps Hero Out`. -Z 15th March, 2019 | ||
| 32549 |
5/6✗ Branch 0 not taken.
✓ Branch 1 taken 100 times.
✓ Branch 2 taken 52 times.
✓ Branch 3 taken 48 times.
✓ Branch 4 taken 51 times.
✓ Branch 5 taken 1 times.
|
100 | if((itemsbuf[id2].flags & item_flag1) && ( get_qr(qr_SIDEVIEWTRIFORCECELLAR) ? ( cur_screen < MAPSCRS192b136 ) : (cur_screen < MAPSCRSNORMAL) ) ) |
| 32550 | { | ||
| 32551 | 99 | sdir=dir; | |
| 32552 | 99 | dowarp(hero_scr, 1, 0); //side warp | |
| 32553 | 99 | } | |
| 32554 | else | ||
| 32555 | { | ||
| 32556 |
1/2✓ Branch 0 taken 1 times.
✗ Branch 1 not taken.
|
1 | if ( !(itemsbuf[id2].flags & item_flag11) ) playLevelMusic(); |
| 32557 | } | ||
| 32558 | 100 | } | |
| 32559 | |||
| 32560 | 30954 | void red_shift() | |
| 32561 | { | ||
| 32562 | 30954 | int32_t tnum=176; | |
| 32563 | |||
| 32564 | // set up the new palette | ||
| 32565 |
2/2✓ Branch 0 taken 990528 times.
✓ Branch 1 taken 30954 times.
|
1021482 | for(int32_t i=CSET(2); i < CSET(4); i++) |
| 32566 | { | ||
| 32567 | 990528 | int32_t r = (i-CSET(2)) << 1; | |
| 32568 | 990528 | RAMpal[i+tnum].r = _rgb_scale_6[r]; | |
| 32569 | 990528 | RAMpal[i+tnum].g = _rgb_scale_6[r >> 3]; | |
| 32570 | 990528 | RAMpal[i+tnum].b = _rgb_scale_6[r >> 4]; | |
| 32571 | 990528 | } | |
| 32572 | |||
| 32573 | // color scale the game screen | ||
| 32574 |
2/2✓ Branch 0 taken 5215368 times.
✓ Branch 1 taken 30954 times.
|
5246322 | for(int32_t y=0; y<viewport.visible_height(show_bottom_8px); y++) |
| 32575 | { | ||
| 32576 |
2/2✓ Branch 0 taken 1335134208 times.
✓ Branch 1 taken 5215368 times.
|
1340349576 | for(int32_t x=0; x<framebuf->w; x++) |
| 32577 | { | ||
| 32578 | 1335134208 | int c = framebuf->line[y+original_playing_field_offset][x]; | |
| 32579 | 1335134208 | int r = RAMpal[c].r / 4; | |
| 32580 | 1335134208 | int g = RAMpal[c].g / 4; | |
| 32581 | 1335134208 | int b = RAMpal[c].b / 4; | |
| 32582 |
2/2✓ Branch 0 taken 1246000051 times.
✓ Branch 1 taken 89134157 times.
|
1335134208 | int v = zc_min(int32_t(r*0.4 + g*0.6 + b*0.4)>>1,31); |
| 32583 |
2/2✓ Branch 0 taken 1334267375 times.
✓ Branch 1 taken 866833 times.
|
1335134208 | putpixel(framebuf, x, y + original_playing_field_offset, c ? (v + tnum+CSET(2)) : 0); |
| 32584 | 1335134208 | } | |
| 32585 | 5215368 | } | |
| 32586 | |||
| 32587 | 30954 | refreshpal = true; | |
| 32588 | 30954 | } | |
| 32589 | |||
| 32590 | 75 | void slide_in_color(int32_t color) | |
| 32591 | { | ||
| 32592 |
2/2✓ Branch 0 taken 375 times.
✓ Branch 1 taken 75 times.
|
450 | for(int32_t i=1; i<16; i+=3) |
| 32593 | { | ||
| 32594 | 375 | RAMpal[CSET(2)+i+2] = RAMpal[CSET(2)+i+1]; | |
| 32595 | 375 | RAMpal[CSET(2)+i+1] = RAMpal[CSET(2)+i]; | |
| 32596 | 375 | RAMpal[CSET(2)+i] = NESpal(color); | |
| 32597 | 375 | } | |
| 32598 | |||
| 32599 | 75 | refreshpal=true; | |
| 32600 | 75 | } | |
| 32601 | |||
| 32602 | |||
| 32603 | 297 | void HeroClass::heroDeathAnimation() | |
| 32604 | { | ||
| 32605 | 297 | int32_t f=0; | |
| 32606 | 297 | int32_t deathclk=0,deathfrm=0; | |
| 32607 | |||
| 32608 | 297 | action=none; FFCore.setHeroAction(dying); //mayhaps a new action of 'gameover'? -Z | |
| 32609 | |||
| 32610 | 297 | kill_sfx(); //call before the onDeath script. | |
| 32611 | |||
| 32612 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 297 times.
|
297 | if(!debug_enabled) |
| 32613 | { | ||
| 32614 | 297 | Paused=false; | |
| 32615 | 297 | } | |
| 32616 | |||
| 32617 | 297 | BITMAP *subscrbmp = create_bitmap_ex(8, framebuf->w, framebuf->h); | |
| 32618 | 297 | clear_bitmap(subscrbmp); | |
| 32619 | //get rid off all sprites but Hero | ||
| 32620 | 297 | guys.clear(); | |
| 32621 | 297 | items.clear(); | |
| 32622 | 297 | Ewpns.clear(); | |
| 32623 | 297 | Lwpns.clear(); | |
| 32624 | 297 | chainlinks.clear(); | |
| 32625 | 297 | decorations.clear(); | |
| 32626 | |||
| 32627 | 297 | kill_subscr_items(); | |
| 32628 | |||
| 32629 | 297 | Playing = false; | |
| 32630 | |||
| 32631 |
1/2✓ Branch 0 taken 297 times.
✗ Branch 1 not taken.
|
297 | game->set_deaths(zc_min(game->get_deaths()+1,USHRT_MAX)); |
| 32632 | 297 | dir=down; | |
| 32633 | 297 | music_stop(); | |
| 32634 | |||
| 32635 | 297 | attackclk=hclk=superman=0; | |
| 32636 | 297 | scriptcoldet = true; | |
| 32637 | |||
| 32638 |
2/2✓ Branch 0 taken 9504 times.
✓ Branch 1 taken 297 times.
|
9801 | for(int32_t i=0; i<32; i++) miscellaneous[i] = 0; |
| 32639 | |||
| 32640 | |||
| 32641 | 297 | playing_field_offset = original_playing_field_offset; // otherwise, red_shift() may go past the bottom of the screen | |
| 32642 | 297 | quakeclk=wavy=0; | |
| 32643 | |||
| 32644 | //in original Z1, Hero marker vanishes at death. | ||
| 32645 | //code in subscr.cpp, put_passive_subscr checks the following value. | ||
| 32646 | //color 255 is a GUI color, so quest makers shouldn't be using this value. | ||
| 32647 | //Also, subscreen is static after death in Z1. | ||
| 32648 | 297 | int32_t tmp_hero_dot = QMisc.colors.hero_dot; | |
| 32649 | 297 | QMisc.colors.hero_dot = 255; | |
| 32650 | |||
| 32651 | 297 | put_passive_subscr(subscrbmp, 0, 0, game->should_show_time(), sspUP); | |
| 32652 | //Don't forget passive subscreen scripts! | ||
| 32653 |
2/2✓ Branch 0 taken 258 times.
✓ Branch 1 taken 39 times.
|
297 | if(get_qr(qr_PASSIVE_SUBSCRIPT_RUNS_WHEN_GAME_IS_FROZEN)) |
| 32654 | { | ||
| 32655 | 39 | script_drawing_commands.Clear(); //We only want draws from this script | |
| 32656 |
2/2✓ Branch 0 taken 24 times.
✓ Branch 1 taken 15 times.
|
39 | if(DMaps[cur_dmap].passive_sub_script != 0) |
| 32657 | 15 | ZScriptVersion::RunScript(ScriptType::ScriptedPassiveSubscreen, DMaps[cur_dmap].passive_sub_script, cur_dmap); | |
| 32658 |
1/6✗ Branch 0 not taken.
✓ Branch 1 taken 39 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
|
39 | if (FFCore.waitdraw(ScriptType::ScriptedPassiveSubscreen) && DMaps[cur_dmap].passive_sub_script != 0 && FFCore.doscript(ScriptType::ScriptedPassiveSubscreen)) |
| 32659 | { | ||
| 32660 | ✗ | ZScriptVersion::RunScript(ScriptType::ScriptedPassiveSubscreen, DMaps[cur_dmap].passive_sub_script, cur_dmap); | |
| 32661 | ✗ | FFCore.waitdraw(ScriptType::ScriptedPassiveSubscreen) = false; | |
| 32662 | ✗ | } | |
| 32663 | 39 | BITMAP* tmp = framebuf; | |
| 32664 | 39 | framebuf = subscrbmp; //Hack; force draws to subscrbmp | |
| 32665 | 39 | do_script_draws(framebuf, origin_scr, 0, playing_field_offset); //Draw the script draws | |
| 32666 | 39 | framebuf = tmp; | |
| 32667 | 39 | script_drawing_commands.Clear(); //Don't let these draws repeat during 'draw_screen()' | |
| 32668 | 39 | } | |
| 32669 | 297 | QMisc.colors.hero_dot = tmp_hero_dot; | |
| 32670 | 297 | bool clearedit = false; | |
| 32671 | 297 | do | |
| 32672 | { | ||
| 32673 |
2/2✓ Branch 0 taken 74990 times.
✓ Branch 1 taken 27341 times.
|
102331 | if(f<254) |
| 32674 | { | ||
| 32675 |
2/2✓ Branch 0 taken 65253 times.
✓ Branch 1 taken 9737 times.
|
74990 | if(f<=32) |
| 32676 | { | ||
| 32677 | 9737 | hclk=(32-f); | |
| 32678 | 9737 | } | |
| 32679 | |||
| 32680 |
4/4✓ Branch 0 taken 56698 times.
✓ Branch 1 taken 18292 times.
✓ Branch 2 taken 34340 times.
✓ Branch 3 taken 22358 times.
|
74990 | if(f>=62 && f<138) |
| 32681 | { | ||
| 32682 |
5/5✓ Branch 0 taken 17651 times.
✓ Branch 1 taken 1177 times.
✓ Branch 2 taken 1177 times.
✓ Branch 3 taken 1177 times.
✓ Branch 4 taken 1176 times.
|
22358 | switch((f-62)%20) |
| 32683 | { | ||
| 32684 | case 0: | ||
| 32685 | 1177 | dir=right; | |
| 32686 | 1177 | break; | |
| 32687 | |||
| 32688 | case 5: | ||
| 32689 | 1177 | dir=up; | |
| 32690 | 1177 | break; | |
| 32691 | |||
| 32692 | case 10: | ||
| 32693 | 1177 | dir=left; | |
| 32694 | 1177 | break; | |
| 32695 | |||
| 32696 | case 15: | ||
| 32697 | 1176 | dir=down; | |
| 32698 | 1176 | break; | |
| 32699 | } | ||
| 32700 | |||
| 32701 | 22358 | herostep(); | |
| 32702 | 22358 | } | |
| 32703 | |||
| 32704 |
4/4✓ Branch 0 taken 17932 times.
✓ Branch 1 taken 57058 times.
✓ Branch 2 taken 13441 times.
✓ Branch 3 taken 4491 times.
|
74990 | if(f>=194 && f<208) |
| 32705 | { | ||
| 32706 |
2/2✓ Branch 0 taken 4198 times.
✓ Branch 1 taken 293 times.
|
4491 | if(f==194) |
| 32707 | { | ||
| 32708 | 293 | action=dying; | |
| 32709 | 293 | FFCore.setHeroAction(dying); | |
| 32710 | 293 | } | |
| 32711 | |||
| 32712 | 4491 | extend = 0; | |
| 32713 | 4491 | cs = wpnsbuf[spr_death].csets&15; | |
| 32714 | 4491 | tile = wpnsbuf[spr_death].tile; | |
| 32715 |
2/2✓ Branch 0 taken 3584 times.
✓ Branch 1 taken 907 times.
|
4491 | if(!get_qr(qr_HARDCODED_ENEMY_ANIMS)) |
| 32716 | { | ||
| 32717 | 907 | tile += deathfrm; | |
| 32718 | 907 | f = 206; | |
| 32719 |
2/2✓ Branch 0 taken 759 times.
✓ Branch 1 taken 148 times.
|
907 | if(++deathclk >= wpnsbuf[spr_death].speed) |
| 32720 | { | ||
| 32721 | 148 | deathclk=0; | |
| 32722 |
2/2✓ Branch 0 taken 111 times.
✓ Branch 1 taken 37 times.
|
148 | if(++deathfrm >= wpnsbuf[spr_death].frames) |
| 32723 | { | ||
| 32724 | 37 | f = 208; | |
| 32725 | 37 | deathfrm = 0; | |
| 32726 | 37 | } | |
| 32727 | 148 | } | |
| 32728 | 907 | } | |
| 32729 |
2/2✓ Branch 0 taken 2702 times.
✓ Branch 1 taken 882 times.
|
3584 | else if(BSZ) |
| 32730 | { | ||
| 32731 | 2702 | tile += (f-194)/3; | |
| 32732 | 2702 | } | |
| 32733 |
2/2✓ Branch 0 taken 630 times.
✓ Branch 1 taken 252 times.
|
882 | else if(f>=204) |
| 32734 | { | ||
| 32735 | 252 | ++tile; | |
| 32736 | 252 | } | |
| 32737 | 4491 | } | |
| 32738 | |||
| 32739 |
2/2✓ Branch 0 taken 74697 times.
✓ Branch 1 taken 293 times.
|
74990 | if(f==208) |
| 32740 | { | ||
| 32741 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 289 times.
|
293 | if ( dontdraw < 2 ) { dontdraw = 1; } |
| 32742 | 293 | } | |
| 32743 |
2/2✓ Branch 0 taken 71180 times.
✓ Branch 1 taken 3810 times.
|
74990 | if(get_qr(qr_FADE)) |
| 32744 | { | ||
| 32745 |
2/2✓ Branch 0 taken 47476 times.
✓ Branch 1 taken 23704 times.
|
71180 | if(f < 170) |
| 32746 | { | ||
| 32747 |
2/2✓ Branch 0 taken 30674 times.
✓ Branch 1 taken 16802 times.
|
47476 | if(f<60) |
| 32748 | { | ||
| 32749 | 16802 | draw_screen(); | |
| 32750 | //reuse our static subscreen | ||
| 32751 | 16802 | set_clip_rect(framebuf, 0, 0, framebuf->w, framebuf->h); | |
| 32752 | 16802 | blit(subscrbmp,framebuf,0,0,0,0,256,original_playing_field_offset); | |
| 32753 | 16802 | } | |
| 32754 | |||
| 32755 |
2/2✓ Branch 0 taken 47196 times.
✓ Branch 1 taken 280 times.
|
47476 | if(f==60) |
| 32756 | { | ||
| 32757 | 280 | red_shift(); | |
| 32758 | 280 | } | |
| 32759 | |||
| 32760 |
3/4✓ Branch 0 taken 30674 times.
✓ Branch 1 taken 16802 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 30674 times.
|
47476 | if(f>=60 && f<=169) |
| 32761 | { | ||
| 32762 | 30674 | draw_screen(); | |
| 32763 | //reuse our static subscreen | ||
| 32764 | 30674 | blit(subscrbmp,framebuf,0,0,0,0,256,original_playing_field_offset); | |
| 32765 | 30674 | red_shift(); | |
| 32766 | 30674 | } | |
| 32767 | |||
| 32768 |
3/4✓ Branch 0 taken 8618 times.
✓ Branch 1 taken 38858 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 8618 times.
|
47476 | if(f>=139 && f<=169)//fade from red to black |
| 32769 | { | ||
| 32770 | 8618 | fade_interpolate(RAMpal,black_palette,RAMpal, (f-138)<<1, 224, 255); | |
| 32771 | 8618 | refreshpal=true; | |
| 32772 | 8618 | } | |
| 32773 | 47476 | } | |
| 32774 | else //f>=170 | ||
| 32775 | { | ||
| 32776 |
2/2✓ Branch 0 taken 23426 times.
✓ Branch 1 taken 278 times.
|
23704 | if(f==170)//make Hero grayish |
| 32777 | { | ||
| 32778 | 278 | fade_interpolate(RAMpal,black_palette,RAMpal,64, 224, 255); | |
| 32779 | |||
| 32780 |
2/2✓ Branch 0 taken 4448 times.
✓ Branch 1 taken 278 times.
|
4726 | for(int32_t i=CSET(6); i < CSET(7); i++) |
| 32781 | { | ||
| 32782 | 4448 | int32_t g = (RAMpal[i].r + RAMpal[i].g + RAMpal[i].b)/3; | |
| 32783 | 4448 | RAMpal[i] = _RGB(g,g,g); | |
| 32784 | 4448 | } | |
| 32785 | |||
| 32786 | 278 | refreshpal = true; | |
| 32787 | 278 | } | |
| 32788 | |||
| 32789 | //draw only hero. otherwise black layers might cover him. | ||
| 32790 | 23704 | rectfill(framebuf,0,original_playing_field_offset,framebuf->w,framebuf->h,0); | |
| 32791 | 23704 | draw(framebuf); | |
| 32792 | 23704 | blit(subscrbmp,framebuf,0,0,0,0,256,original_playing_field_offset); | |
| 32793 | } | ||
| 32794 | 71180 | } | |
| 32795 | else //!qr_FADE | ||
| 32796 | { | ||
| 32797 | 7620 | for_every_base_screen_in_region([&](mapscr* scr, unsigned int region_scr_x, unsigned int region_scr_y) { | |
| 32798 |
2/2✓ Branch 0 taken 3795 times.
✓ Branch 1 taken 15 times.
|
3810 | if(f==58) |
| 32799 | { | ||
| 32800 |
2/2✓ Branch 0 taken 1440 times.
✓ Branch 1 taken 15 times.
|
1455 | for(int32_t i = 0; i < 96; i++) |
| 32801 | 1440 | scr->cset[i] = 3; | |
| 32802 | |||
| 32803 |
2/2✓ Branch 0 taken 90 times.
✓ Branch 1 taken 15 times.
|
105 | for(int32_t j=1; j<=6; j++) |
| 32804 |
2/2✓ Branch 0 taken 88 times.
✓ Branch 1 taken 2 times.
|
92 | if(scr->layermap[j-1]>0) |
| 32805 | { | ||
| 32806 | 2 | mapscr* lyr_scr = get_scr_layer(scr->screen, j); | |
| 32807 |
2/2✓ Branch 0 taken 192 times.
✓ Branch 1 taken 2 times.
|
194 | for(int32_t i=0; i<96; i++) |
| 32808 | 192 | lyr_scr->cset[i] = 3; | |
| 32809 | 2 | } | |
| 32810 | 15 | } | |
| 32811 | |||
| 32812 |
2/2✓ Branch 0 taken 3795 times.
✓ Branch 1 taken 15 times.
|
3810 | if(f==59) |
| 32813 | { | ||
| 32814 |
2/2✓ Branch 0 taken 1200 times.
✓ Branch 1 taken 15 times.
|
1215 | for(int32_t i = 96; i < 176; i++) |
| 32815 | 1200 | scr->cset[i] = 3; | |
| 32816 | |||
| 32817 |
2/2✓ Branch 0 taken 90 times.
✓ Branch 1 taken 15 times.
|
105 | for(int32_t j=1; j<=6; j++) |
| 32818 |
2/2✓ Branch 0 taken 88 times.
✓ Branch 1 taken 2 times.
|
92 | if(scr->layermap[j-1]>0) |
| 32819 | { | ||
| 32820 | 2 | mapscr* lyr_scr = get_scr_layer(scr->screen, j); | |
| 32821 |
2/2✓ Branch 0 taken 160 times.
✓ Branch 1 taken 2 times.
|
162 | for(int32_t i=96; i<176; i++) |
| 32822 | 160 | lyr_scr->cset[i] = 3; | |
| 32823 | 2 | } | |
| 32824 | 15 | } | |
| 32825 | |||
| 32826 |
2/2✓ Branch 0 taken 3795 times.
✓ Branch 1 taken 15 times.
|
3810 | if(f==60) |
| 32827 | { | ||
| 32828 |
2/2✓ Branch 0 taken 2640 times.
✓ Branch 1 taken 15 times.
|
2655 | for(int32_t i=0; i<176; i++) |
| 32829 | { | ||
| 32830 | 2640 | scr->cset[i] = 2; | |
| 32831 | 2640 | } | |
| 32832 | |||
| 32833 |
2/2✓ Branch 0 taken 90 times.
✓ Branch 1 taken 15 times.
|
105 | for(int32_t j=1; j<=6; j++) |
| 32834 |
2/2✓ Branch 0 taken 88 times.
✓ Branch 1 taken 2 times.
|
92 | if(scr->layermap[j-1]>0) |
| 32835 | { | ||
| 32836 | 2 | mapscr* lyr_scr = get_scr_layer(scr->screen, j); | |
| 32837 |
2/2✓ Branch 0 taken 352 times.
✓ Branch 1 taken 2 times.
|
354 | for(int32_t i=0; i<176; i++) |
| 32838 | 352 | lyr_scr->cset[i] = 2; | |
| 32839 | 2 | } | |
| 32840 | 15 | } | |
| 32841 | 3810 | }); | |
| 32842 | |||
| 32843 |
2/2✓ Branch 0 taken 3795 times.
✓ Branch 1 taken 15 times.
|
3810 | if(f==60) |
| 32844 | { | ||
| 32845 |
2/2✓ Branch 0 taken 75 times.
✓ Branch 1 taken 15 times.
|
90 | for(int32_t i=1; i<16; i+=3) |
| 32846 | { | ||
| 32847 | 75 | RAMpal[CSET(2)+i] = NESpal(0x17); | |
| 32848 | 75 | RAMpal[CSET(2)+i+1] = NESpal(0x16); | |
| 32849 | 75 | RAMpal[CSET(2)+i+2] = NESpal(0x26); | |
| 32850 | 75 | } | |
| 32851 | |||
| 32852 | 15 | refreshpal=true; | |
| 32853 | 15 | } | |
| 32854 | |||
| 32855 |
2/2✓ Branch 0 taken 3795 times.
✓ Branch 1 taken 15 times.
|
3810 | if(f==139) |
| 32856 | 15 | slide_in_color(0x06); | |
| 32857 | |||
| 32858 |
2/2✓ Branch 0 taken 3795 times.
✓ Branch 1 taken 15 times.
|
3810 | if(f==149) |
| 32859 | 15 | slide_in_color(0x07); | |
| 32860 | |||
| 32861 |
2/2✓ Branch 0 taken 3795 times.
✓ Branch 1 taken 15 times.
|
3810 | if(f==159) |
| 32862 | 15 | slide_in_color(0x0F); | |
| 32863 | |||
| 32864 |
2/2✓ Branch 0 taken 3795 times.
✓ Branch 1 taken 15 times.
|
3810 | if(f==169) |
| 32865 | { | ||
| 32866 | 15 | slide_in_color(0x0F); | |
| 32867 | 15 | slide_in_color(0x0F); | |
| 32868 | 15 | } | |
| 32869 | |||
| 32870 |
2/2✓ Branch 0 taken 3795 times.
✓ Branch 1 taken 15 times.
|
3810 | if(f==170) |
| 32871 | { | ||
| 32872 |
2/2✓ Branch 0 taken 75 times.
✓ Branch 1 taken 15 times.
|
90 | for(int32_t i=1; i<16; i+=3) |
| 32873 | { | ||
| 32874 | 75 | RAMpal[CSET(6)+i] = NESpal(0x10); | |
| 32875 | 75 | RAMpal[CSET(6)+i+1] = NESpal(0x30); | |
| 32876 | 75 | RAMpal[CSET(6)+i+2] = NESpal(0x00); | |
| 32877 | 75 | refreshpal = true; | |
| 32878 | 75 | } | |
| 32879 | 15 | } | |
| 32880 | |||
| 32881 |
2/2✓ Branch 0 taken 2535 times.
✓ Branch 1 taken 1275 times.
|
3810 | if(f < 169) |
| 32882 | { | ||
| 32883 | 2535 | draw_screen(); | |
| 32884 | //reuse our static subscreen | ||
| 32885 | 2535 | blit(subscrbmp,framebuf,0,0,0,0,256,original_playing_field_offset); | |
| 32886 | 2535 | } | |
| 32887 | else | ||
| 32888 | { | ||
| 32889 | //draw only hero. otherwise black layers might cover him. | ||
| 32890 | 1275 | rectfill(framebuf,0,playing_field_offset,framebuf->w,framebuf->h,0); | |
| 32891 | 1275 | draw(framebuf); | |
| 32892 | 1275 | blit(subscrbmp,framebuf,0,0,0,0,256,original_playing_field_offset); | |
| 32893 | } | ||
| 32894 | } | ||
| 32895 | 74990 | } | |
| 32896 | |||
| 32897 |
2/2✓ Branch 0 taken 26513 times.
✓ Branch 1 taken 828 times.
|
27341 | else if(f<350)//draw 'GAME OVER' text |
| 32898 | { | ||
| 32899 |
3/4✓ Branch 0 taken 2 times.
✓ Branch 1 taken 26511 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 2 times.
|
26513 | if(get_qr(qr_INSTANT_RESPAWN) && !get_qr(qr_INSTANT_CONTINUE)) |
| 32900 | { | ||
| 32901 | 2 | Quit = qRELOAD; | |
| 32902 | 2 | skipcont = 1; | |
| 32903 | 2 | clear_bitmap(framebuf); | |
| 32904 | 2 | blit(subscrbmp,framebuf,0,0,0,0,256,passive_subscreen_height); | |
| 32905 | 2 | } | |
| 32906 |
3/4✓ Branch 0 taken 26511 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 26496 times.
✓ Branch 3 taken 15 times.
|
26511 | else if(!get_qr(qr_INSTANT_RESPAWN) && get_qr(qr_INSTANT_CONTINUE)) |
| 32907 | { | ||
| 32908 | 15 | Quit = qCONT; | |
| 32909 | 15 | skipcont = 1; | |
| 32910 | 15 | clear_bitmap(framebuf); | |
| 32911 | 15 | blit(subscrbmp,framebuf,0,0,0,0,256,passive_subscreen_height); | |
| 32912 | 15 | } | |
| 32913 | else | ||
| 32914 | { | ||
| 32915 | 26496 | clear_info_bmp(); | |
| 32916 | 26496 | clear_to_color(framebuf,SaveScreenSettings[SAVESC_BACKGROUND]); | |
| 32917 | 26496 | blit(subscrbmp,framebuf,0,0,0,0,256,passive_subscreen_height); | |
| 32918 | 26496 | textout_ex(framebuf,get_zc_font(font_zfont),"GAME OVER",96,playing_field_offset+80,SaveScreenSettings[SAVESC_TEXT],-1); | |
| 32919 | } | ||
| 32920 | 26513 | } | |
| 32921 | else | ||
| 32922 | { | ||
| 32923 | 828 | clear_bitmap(framebuf); | |
| 32924 | } | ||
| 32925 | |||
| 32926 | //SFX... put them all here | ||
| 32927 |
4/4✓ Branch 0 taken 101483 times.
✓ Branch 1 taken 297 times.
✓ Branch 2 taken 295 times.
✓ Branch 3 taken 256 times.
|
102331 | switch(f) |
| 32928 | { | ||
| 32929 | case 0: | ||
| 32930 | 297 | sfx(getHurtSFX(),pan(x)); | |
| 32931 | 297 | break; | |
| 32932 | //Death sound. | ||
| 32933 | case 60: | ||
| 32934 | 295 | sfx(WAV_SPIRAL); | |
| 32935 | 295 | break; | |
| 32936 | //Message sound. | ||
| 32937 | case 194: | ||
| 32938 | 256 | sfx(WAV_MSG); | |
| 32939 | 256 | break; | |
| 32940 | } | ||
| 32941 | //adv: | ||
| 32942 | 102331 | clear_darkroom_bitmaps(); | |
| 32943 | 102331 | advanceframe(true); | |
| 32944 | 102331 | ++f; | |
| 32945 |
2/2✓ Branch 0 taken 102034 times.
✓ Branch 1 taken 297 times.
|
204662 | } |
| 32946 |
2/2✓ Branch 0 taken 276 times.
✓ Branch 1 taken 102055 times.
|
102331 | while(f<353 && !Quit); |
| 32947 | |||
| 32948 | 297 | destroy_bitmap(subscrbmp); | |
| 32949 | 297 | action=none; FFCore.setHeroAction(none); | |
| 32950 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 293 times.
|
297 | if ( dontdraw < 2 ) { dontdraw=0; } |
| 32951 | 297 | } | |
| 32952 | |||
| 32953 | 17 | void HeroClass::ganon_intro() | |
| 32954 | { | ||
| 32955 | 17 | mapscr* scr = hero_scr; | |
| 32956 | 17 | int screen = scr->screen; | |
| 32957 | 77 | auto [offx, offy] = translate_screen_coordinates_to_world(screen); | |
| 32958 | |||
| 32959 | /* | ||
| 32960 | ************************ | ||
| 32961 | * GANON INTRO SEQUENCE * | ||
| 32962 | ************************ | ||
| 32963 | -25 DOT updates | ||
| 32964 | -24 HERO in | ||
| 32965 | 0 TRIFORCE overhead - code begins at this point (f == 0) | ||
| 32966 | 47 GANON in | ||
| 32967 | 58 LIGHT step | ||
| 32968 | 68 LIGHT step | ||
| 32969 | 78 LIGHT step | ||
| 32970 | 255 TRIFORCE out | ||
| 32971 | 256 TRIFORCE in | ||
| 32972 | 270 TRIFORCE out | ||
| 32973 | 271 GANON out, HERO face up | ||
| 32974 | */ | ||
| 32975 | 17 | loaded_guys=true; | |
| 32976 | 51 | loaditem(scr, offx, offy); | |
| 32977 | |||
| 32978 |
2/2✓ Branch 0 taken 4 times.
✓ Branch 1 taken 13 times.
|
17 | if(game->lvlitems[dlevel]&(1 << li_boss_killed)) |
| 32979 | { | ||
| 32980 | 4 | return; | |
| 32981 | } | ||
| 32982 | |||
| 32983 | 13 | dir=down; | |
| 32984 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 13 times.
|
13 | if ( !isSideViewHero() ) |
| 32985 | { | ||
| 32986 | 13 | fall = 0; //Fix midair glitch on holding triforce. -Z | |
| 32987 | 13 | fakefall = 0; | |
| 32988 | 13 | z = 0; | |
| 32989 | 13 | fakez = 0; | |
| 32990 | 13 | } | |
| 32991 | 13 | action=landhold2; FFCore.setHeroAction(landhold2); | |
| 32992 | 13 | holditem=getItemID(itemsbuf,itype_triforcepiece, 1); | |
| 32993 | //not good, as this only returns the highest level that Hero possesses. -DD | ||
| 32994 | //getHighestLevelOfFamily(game, itemsbuf, itype_triforcepiece, false)); | ||
| 32995 | |||
| 32996 |
4/4✓ Branch 0 taken 13 times.
✓ Branch 1 taken 3133 times.
✓ Branch 2 taken 3133 times.
✓ Branch 3 taken 13 times.
|
3146 | for(int32_t f=0; f<271 && !Quit; f++) |
| 32997 | { | ||
| 32998 |
2/2✓ Branch 0 taken 3120 times.
✓ Branch 1 taken 13 times.
|
3133 | if(f==47) |
| 32999 | { | ||
| 33000 | 13 | music_stop(); | |
| 33001 | 13 | stop_sfx(WAV_ROAR); | |
| 33002 | 13 | sfx(WAV_GASP); | |
| 33003 | 13 | sfx(WAV_GANON); | |
| 33004 | 13 | int32_t Id=0; | |
| 33005 | |||
| 33006 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1027 times.
|
1027 | for(int32_t i=0; i<eMAXGUYS; i++) |
| 33007 | { | ||
| 33008 |
2/2✓ Branch 0 taken 1014 times.
✓ Branch 1 taken 13 times.
|
1027 | if(guysbuf[i].flags&guy_ganon) |
| 33009 | { | ||
| 33010 | 13 | Id=i; | |
| 33011 | 13 | break; | |
| 33012 | } | ||
| 33013 | 1014 | } | |
| 33014 | |||
| 33015 |
2/2✓ Branch 0 taken 10 times.
✓ Branch 1 taken 3 times.
|
13 | if(current_item(itype_ring)) |
| 33016 | { | ||
| 33017 | 30 | addenemy(screen,offx+160,offy+96,Id,0); | |
| 33018 | 10 | } | |
| 33019 | else | ||
| 33020 | { | ||
| 33021 | 9 | addenemy(screen,offx+80,offy+32,Id,0); | |
| 33022 | } | ||
| 33023 | 13 | } | |
| 33024 | |||
| 33025 |
2/2✓ Branch 0 taken 3120 times.
✓ Branch 1 taken 13 times.
|
3133 | if(f==48) |
| 33026 | { | ||
| 33027 | 13 | lighting(true,true); // Hmm. -L | |
| 33028 | 13 | f += 30; | |
| 33029 | 13 | } | |
| 33030 | |||
| 33031 | //NES Z1, the triforce vanishes for one frame in two cases | ||
| 33032 | //while still showing Hero's two-handed overhead sprite. | ||
| 33033 | //This should be a Quest Rule for NES Accuracy. -Z | ||
| 33034 |
4/4✓ Branch 0 taken 3120 times.
✓ Branch 1 taken 13 times.
✓ Branch 2 taken 13 times.
✓ Branch 3 taken 3107 times.
|
3133 | if(f==255 || f==270) |
| 33035 | { | ||
| 33036 | 26 | holditem=-1; | |
| 33037 | 26 | } | |
| 33038 | |||
| 33039 |
2/2✓ Branch 0 taken 3120 times.
✓ Branch 1 taken 13 times.
|
3133 | if(f==256) |
| 33040 | { | ||
| 33041 | 13 | holditem=getItemID(itemsbuf,itype_triforcepiece,1); | |
| 33042 | 13 | } | |
| 33043 | |||
| 33044 | 3133 | draw_screen(); | |
| 33045 | 3133 | advanceframe(true); | |
| 33046 | |||
| 33047 |
1/2✓ Branch 0 taken 3133 times.
✗ Branch 1 not taken.
|
3133 | if(rSbtn()) |
| 33048 | { | ||
| 33049 | ✗ | conveyclk=3; | |
| 33050 | ✗ | int32_t tmp_subscr_clk = frame; | |
| 33051 | ✗ | dosubscr(); | |
| 33052 | ✗ | newscr_clk += frame - tmp_subscr_clk; | |
| 33053 | ✗ | } | |
| 33054 | |||
| 33055 | 3133 | } | |
| 33056 | |||
| 33057 | 13 | action=none; FFCore.setHeroAction(none); | |
| 33058 | 13 | dir=up; | |
| 33059 | |||
| 33060 |
3/4✗ Branch 0 not taken.
✓ Branch 1 taken 13 times.
✓ Branch 2 taken 2 times.
✓ Branch 3 taken 11 times.
|
13 | if((!getmapflag(screen, mSPECIALITEM) || (scr->flags9&fBELOWRETURN)) && (tunes[MAXMIDIS-1].data)) |
| 33061 | 2 | jukebox(MAXMIDIS-1); | |
| 33062 | else | ||
| 33063 | 11 | playLevelMusic(); | |
| 33064 | |||
| 33065 | 13 | currcset=DMaps[cur_dmap].color; | |
| 33066 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 13 times.
|
13 | if (get_qr(qr_GANONINTRO) ) |
| 33067 | { | ||
| 33068 | 13 | dointro(); | |
| 33069 | //Yes, I checked. This is literally in 2.10 (minus this if statement of course). | ||
| 33070 | //I have no clue why it's here; Literally the only difference between dointro in 2.10 and dointro in this version is an 'else' that sets introclk and intropos to 74. | ||
| 33071 | //I have no idea what was going through the original devs heads and I'm extremely worried I'm missing something, cause at first glance this looks like | ||
| 33072 | //a hack solution to an underlying bug, but no! There's just a fucking dointro() call in older versions and I don't know *why*. -Deedee | ||
| 33073 | 13 | } | |
| 33074 | |||
| 33075 | 13 | cont_sfx(WAV_ROAR); | |
| 33076 | 17 | } | |
| 33077 | |||
| 33078 | 10 | void HeroClass::win_game() | |
| 33079 | { | ||
| 33080 |
2/4✓ Branch 0 taken 10 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 10 times.
✗ Branch 3 not taken.
|
10 | replay_step_comment("win_game"); |
| 33081 | 10 | Playing=Paused=false; | |
| 33082 | 10 | action=won; FFCore.setHeroAction(won); | |
| 33083 | 10 | Quit=qWON; | |
| 33084 | 10 | hclk=0; | |
| 33085 | 10 | x = 136; | |
| 33086 |
2/2✓ Branch 0 taken 1 times.
✓ Branch 1 taken 9 times.
|
10 | y = (isdungeon() && cur_screen<128) ? 75 : 73; |
| 33087 | 10 | z = fakez = fall = fakefall = spins = 0; | |
| 33088 | 10 | dir=left; | |
| 33089 | 10 | } | |
| 33090 | |||
| 33091 | 41956 | void HeroClass::reset_swordcharge() | |
| 33092 | { | ||
| 33093 | 41956 | charging=spins=tapping=0; | |
| 33094 | 41956 | } | |
| 33095 | |||
| 33096 | 144814 | void HeroClass::reset_hookshot() | |
| 33097 | { | ||
| 33098 |
10/12✓ Branch 0 taken 93947 times.
✓ Branch 1 taken 50867 times.
✓ Branch 2 taken 93933 times.
✓ Branch 3 taken 14 times.
✓ Branch 4 taken 93831 times.
✓ Branch 5 taken 102 times.
✓ Branch 6 taken 93824 times.
✓ Branch 7 taken 7 times.
✓ Branch 8 taken 93824 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 93824 times.
|
144814 | if(action!=walking && action!=rafting && action!=landhold1 && action!=landhold2 && action!=sidewaterhold1 && action!=sidewaterhold2) |
| 33099 | { | ||
| 33100 | 93824 | action=none; FFCore.setHeroAction(none); | |
| 33101 | 93824 | } | |
| 33102 | |||
| 33103 | 144814 | hookshot_frozen=false; | |
| 33104 | 144814 | hookshot_used=false; | |
| 33105 | 144814 | pull_hero=false; | |
| 33106 | 144814 | hs_fix=false; | |
| 33107 | 144814 | switchhookclk = switchhookmaxtime = switchhookstyle = switchhookarg = 0; | |
| 33108 | 144814 | switch_hooked = false; | |
| 33109 |
2/2✓ Branch 0 taken 144809 times.
✓ Branch 1 taken 5 times.
|
144814 | if(switching_object) |
| 33110 | 5 | switching_object->switch_hooked = false; | |
| 33111 | 144814 | switching_object = NULL; | |
| 33112 | 144814 | hooked_comborpos = rpos_t::None; | |
| 33113 | 144814 | switchhook_cost_item = -1; | |
| 33114 | 144814 | hooked_layerbits = 0; | |
| 33115 |
2/2✓ Branch 0 taken 1013698 times.
✓ Branch 1 taken 144814 times.
|
1158512 | for(auto q = 0; q < 7; ++q) |
| 33116 | 1013698 | hooked_undercombos[q] = -1; | |
| 33117 | 144814 | Lwpns.del(Lwpns.idFirst(wHSHandle)); | |
| 33118 | 144814 | Lwpns.del(Lwpns.idFirst(wHookshot)); | |
| 33119 | 144814 | chainlinks.clear(); | |
| 33120 |
2/2✓ Branch 0 taken 37772 times.
✓ Branch 1 taken 107042 times.
|
144814 | int32_t index=directWpn>-1 ? directWpn : current_item_id(hs_switcher ? itype_switchhook : itype_hookshot); |
| 33121 | 144814 | hs_switcher = false; | |
| 33122 | |||
| 33123 |
2/2✓ Branch 0 taken 96563 times.
✓ Branch 1 taken 48251 times.
|
144814 | if(index>=0) |
| 33124 | { | ||
| 33125 | 48251 | stop_sfx(itemsbuf[index].usesound); | |
| 33126 | 48251 | } | |
| 33127 | |||
| 33128 | 144814 | hs_xdist=0; | |
| 33129 | 144814 | hs_ydist=0; | |
| 33130 | 144814 | } | |
| 33131 | |||
| 33132 | 57881 | void HeroClass::set_dive(int32_t newdive) | |
| 33133 | { | ||
| 33134 |
2/2✓ Branch 0 taken 9850 times.
✓ Branch 1 taken 48031 times.
|
57881 | if (newdive > 0) |
| 33135 | { | ||
| 33136 | 9850 | auto flippers_id = current_item_id(itype_flippers); | |
| 33137 | 9850 | zfix targ_z = -1; | |
| 33138 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 9850 times.
|
9850 | if (flippers_id >= 0) |
| 33139 | 9850 | targ_z = -(itemsbuf[flippers_id].level); | |
| 33140 |
2/2✓ Branch 0 taken 9593 times.
✓ Branch 1 taken 257 times.
|
9850 | if (standing_on_z > targ_z) |
| 33141 | 257 | standing_on_z = targ_z; | |
| 33142 | 9850 | } | |
| 33143 | else | ||
| 33144 | { | ||
| 33145 |
2/2✓ Branch 0 taken 257 times.
✓ Branch 1 taken 47774 times.
|
48031 | if (standing_on_z < 0) |
| 33146 | 257 | standing_on_z = 0; | |
| 33147 | } | ||
| 33148 | 57881 | diveclk = newdive; | |
| 33149 | 57881 | } | |
| 33150 | |||
| 33151 | |||
| 33152 | 18989628 | bool HeroClass::can_deploy_ladder() | |
| 33153 | { | ||
| 33154 |
2/2✓ Branch 0 taken 7099759 times.
✓ Branch 1 taken 11889869 times.
|
33962380 | bool ladderallowed = ((!get_qr(qr_LADDERANYWHERE) && (hero_scr->flags&fLADDER)) || isdungeon() |
| 33155 |
4/4✓ Branch 0 taken 3479355 times.
✓ Branch 1 taken 14972752 times.
✓ Branch 2 taken 4778804 times.
✓ Branch 3 taken 10193948 times.
|
11889869 | || (get_qr(qr_LADDERANYWHERE) && !(hero_scr->flags&fLADDER))); |
| 33156 |
11/12✓ Branch 0 taken 7743754 times.
✓ Branch 1 taken 17808112 times.
✓ Branch 2 taken 4083719 times.
✓ Branch 3 taken 3660035 times.
✓ Branch 4 taken 4083352 times.
✓ Branch 5 taken 367 times.
✓ Branch 6 taken 4082647 times.
✓ Branch 7 taken 705 times.
✓ Branch 8 taken 4082647 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 4082529 times.
✓ Branch 11 taken 118 times.
|
29634395 | return (current_item_id(itype_ladder)>-1 && ladderallowed && !ilswim && z==0 && fakez==0 && !hoverclk && |
| 33157 |
2/2✓ Branch 0 taken 4061718 times.
✓ Branch 1 taken 20811 times.
|
4082529 | (!isSideViewHero() || on_sideview_solid_oldpos(this))); |
| 33158 | } | ||
| 33159 | |||
| 33160 | 9612416 | void HeroClass::reset_ladder() | |
| 33161 | { | ||
| 33162 |
3/4✓ Branch 0 taken 9609407 times.
✓ Branch 1 taken 3009 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 9609407 times.
|
9612416 | if (ladderx || laddery) |
| 33163 | { | ||
| 33164 | 3009 | ladderx = laddery = 0; | |
| 33165 | |||
| 33166 |
1/2✓ Branch 0 taken 3009 times.
✗ Branch 1 not taken.
|
3009 | if (is_autowalking()) |
| 33167 | { | ||
| 33168 | ✗ | if (check_pitslide() != -1) | |
| 33169 | ✗ | try_hover(); | |
| 33170 | ✗ | } | |
| 33171 | 3009 | } | |
| 33172 | 9612416 | } | |
| 33173 | |||
| 33174 | bool is_conveyor(int32_t type); | ||
| 33175 | int32_t get_conveyor(int32_t x, int32_t y); | ||
| 33176 | |||
| 33177 | 15896023 | void HeroClass::check_conveyor() | |
| 33178 | { | ||
| 33179 | 15896023 | ++newconveyorclk; | |
| 33180 | |||
| 33181 |
2/2✓ Branch 0 taken 15892647 times.
✓ Branch 1 taken 3376 times.
|
15896023 | if (is_conveyor_stunned > 0) |
| 33182 | 3376 | --is_conveyor_stunned; | |
| 33183 |
2/2✓ Branch 0 taken 15892343 times.
✓ Branch 1 taken 3680 times.
|
15896023 | if (is_on_conveyor > 0) |
| 33184 | { | ||
| 33185 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 3680 times.
|
3680 | if(!--is_on_conveyor) |
| 33186 | 3680 | conv_forcedir = -1; | |
| 33187 | 3680 | } | |
| 33188 | |||
| 33189 |
15/18✓ Branch 0 taken 534174 times.
✓ Branch 1 taken 15361849 times.
✓ Branch 2 taken 14831028 times.
✓ Branch 3 taken 530821 times.
✓ Branch 4 taken 14831028 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 14823572 times.
✓ Branch 7 taken 7456 times.
✓ Branch 8 taken 14823572 times.
✗ Branch 9 not taken.
✓ Branch 10 taken 14823060 times.
✓ Branch 11 taken 512 times.
✓ Branch 12 taken 14815095 times.
✓ Branch 13 taken 7965 times.
✓ Branch 14 taken 14797794 times.
✓ Branch 15 taken 17301 times.
✗ Branch 16 not taken.
✓ Branch 17 taken 14797794 times.
|
15896023 | if((!get_qr(qr_BROKEN_CONVEYORS) && action==rafting) || action==casting||action==sideswimcasting||action==drowning || action==sidedrowning||action==lavadrowning||inlikelike||pull_hero||is_autowalking()) |
| 33190 | { | ||
| 33191 | 1098229 | is_conveyor_stunned = 0; | |
| 33192 | 1098229 | return; | |
| 33193 | } | ||
| 33194 | |||
| 33195 | 14797794 | WalkflagInfo info; | |
| 33196 | int32_t xoff,yoff; | ||
| 33197 | 14797794 | zfix deltax(0), deltay(0); | |
| 33198 | 14797794 | int32_t cmbid = get_conveyor(x+7,y+(bigHitbox?8:12)); | |
| 33199 |
2/2✓ Branch 0 taken 19607 times.
✓ Branch 1 taken 14778187 times.
|
14797794 | if(cmbid < 0) |
| 33200 | { | ||
| 33201 |
2/2✓ Branch 0 taken 9874374 times.
✓ Branch 1 taken 4903813 times.
|
14778187 | if (conveyclk <= 0) |
| 33202 | { | ||
| 33203 |
2/2✓ Branch 0 taken 4902873 times.
✓ Branch 1 taken 940 times.
|
4903813 | if(is_on_conveyor < 0) |
| 33204 | { | ||
| 33205 | 940 | is_on_conveyor = 0; | |
| 33206 | 940 | conv_forcedir = -1; | |
| 33207 | 940 | is_conveyor_stunned = 0; | |
| 33208 | 940 | } | |
| 33209 | 4903813 | } | |
| 33210 | 14778187 | return; | |
| 33211 | } | ||
| 33212 | 19607 | newcombo const* cmb = &combobuf[cmbid]; | |
| 33213 | 19607 | rpos_t rpos = COMBOPOS_REGION(x+7,y+(bigHitbox?8:12)); | |
| 33214 | 19607 | bool custom_spd = (cmb->usrflags&cflag2); | |
| 33215 |
6/6✓ Branch 0 taken 19452 times.
✓ Branch 1 taken 155 times.
✓ Branch 2 taken 155 times.
✓ Branch 3 taken 19452 times.
✓ Branch 4 taken 138 times.
✓ Branch 5 taken 17 times.
|
19607 | if((z>0||fakez>0) && !((hero_scr->flags2&fAIRCOMBOS)||(cmb->usrflags&cflag7))) |
| 33216 | { | ||
| 33217 | 17 | is_on_conveyor = 0; | |
| 33218 | 17 | conv_forcedir = -1; | |
| 33219 | 17 | is_conveyor_stunned = 0; | |
| 33220 | 17 | return; | |
| 33221 | } | ||
| 33222 |
3/4✓ Branch 0 taken 15910 times.
✓ Branch 1 taken 3680 times.
✓ Branch 2 taken 15910 times.
✗ Branch 3 not taken.
|
19590 | if(custom_spd || conveyclk<=0) //!DIMITODO: let player be on multiple conveyors at once |
| 33223 | { | ||
| 33224 | 19590 | int32_t ctype=cmb->type; | |
| 33225 |
4/4✓ Branch 0 taken 3680 times.
✓ Branch 1 taken 15910 times.
✓ Branch 2 taken 250 times.
✓ Branch 3 taken 3430 times.
|
19590 | auto rate = custom_spd ? zc_max(cmb->attribytes[0], 1) : 3; |
| 33226 |
3/4✓ Branch 0 taken 3680 times.
✓ Branch 1 taken 15910 times.
✓ Branch 2 taken 3680 times.
✗ Branch 3 not taken.
|
19590 | if(custom_spd && (newconveyorclk % rate)) return; |
| 33227 |
3/4✓ Branch 0 taken 3271 times.
✓ Branch 1 taken 16319 times.
✓ Branch 2 taken 3271 times.
✗ Branch 3 not taken.
|
19590 | if((cmb->usrflags&cflag5) && HasHeavyBoots()) |
| 33228 | ✗ | return; | |
| 33229 | 19590 | is_on_conveyor = 0; | |
| 33230 | 19590 | conv_forcedir = -1; | |
| 33231 | 19590 | is_conveyor_stunned = 0; | |
| 33232 | |||
| 33233 | 19590 | deltax=combo_class_buf[ctype].conveyor_x_speed; | |
| 33234 | 19590 | deltay=combo_class_buf[ctype].conveyor_y_speed; | |
| 33235 | |||
| 33236 |
3/4✓ Branch 0 taken 19590 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 15910 times.
✓ Branch 3 taken 3680 times.
|
19590 | if (is_conveyor(ctype) && custom_spd) |
| 33237 | { | ||
| 33238 | 3680 | deltax = zslongToFix(cmb->attributes[0]); | |
| 33239 | 3680 | deltay = zslongToFix(cmb->attributes[1]); | |
| 33240 | 3680 | } | |
| 33241 | |||
| 33242 |
3/8✓ Branch 0 taken 8897 times.
✓ Branch 1 taken 10693 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 8897 times.
✗ Branch 4 not taken.
✗ Branch 5 not taken.
✗ Branch 6 not taken.
✗ Branch 7 not taken.
|
19590 | if((deltax==0&&deltay==0)&&(isSideViewHero() && on_sideview_solid_oldpos(this))) |
| 33243 | { | ||
| 33244 | ✗ | cmbid = MAPCOMBO(x+8,y+16); | |
| 33245 | ✗ | cmb = &combobuf[cmbid]; | |
| 33246 | ✗ | custom_spd = cmb->usrflags&cflag2; | |
| 33247 | ✗ | ctype=(cmb->type); | |
| 33248 | ✗ | rate = custom_spd ? zc_max(cmb->attribytes[0], 1) : 3; | |
| 33249 | ✗ | deltax=combo_class_buf[ctype].conveyor_x_speed; | |
| 33250 | ✗ | deltay=combo_class_buf[ctype].conveyor_y_speed; | |
| 33251 | ✗ | if ((deltax != 0 || deltay != 0) && custom_spd) | |
| 33252 | { | ||
| 33253 | ✗ | deltax = zslongToFix(cmb->attributes[0]); | |
| 33254 | ✗ | deltay = zslongToFix(cmb->attributes[1]); | |
| 33255 | ✗ | } | |
| 33256 | ✗ | } | |
| 33257 | |||
| 33258 |
3/4✓ Branch 0 taken 8897 times.
✓ Branch 1 taken 10693 times.
✗ Branch 2 not taken.
✓ Branch 3 taken 8897 times.
|
19590 | if(deltax!=0||deltay!=0) |
| 33259 | { | ||
| 33260 |
2/2✓ Branch 0 taken 3680 times.
✓ Branch 1 taken 15910 times.
|
19590 | is_on_conveyor = custom_spd ? rate : -1; |
| 33261 | 19590 | } | |
| 33262 | ✗ | else return; | |
| 33263 | |||
| 33264 |
2/2✓ Branch 0 taken 19431 times.
✓ Branch 1 taken 159 times.
|
19590 | bool forcewalk = (cmb->usrflags&cflag6) && get_qr(qr_NEW_HERO_MOVEMENT2); |
| 33265 |
2/2✓ Branch 0 taken 159 times.
✓ Branch 1 taken 19431 times.
|
19590 | if(forcewalk) |
| 33266 | { | ||
| 33267 | 159 | is_conveyor_stunned = rate; | |
| 33268 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 159 times.
|
159 | if(cmb->usrflags&cflag3) |
| 33269 | { | ||
| 33270 |
2/2✓ Branch 0 taken 109 times.
✓ Branch 1 taken 50 times.
|
159 | if(abs(deltax) > abs(deltay)) |
| 33271 | 109 | conv_forcedir = dir = (deltax > 0) ? right : left; | |
| 33272 | 50 | else conv_forcedir = dir = (deltay > 0) ? down : up; | |
| 33273 | 159 | } | |
| 33274 | 159 | convey_forcex = deltax; | |
| 33275 | 159 | convey_forcey = deltay; | |
| 33276 | 159 | } | |
| 33277 | else | ||
| 33278 | { | ||
| 33279 | 19431 | bool movedx = false, movedy = false; | |
| 33280 |
2/2✓ Branch 0 taken 15910 times.
✓ Branch 1 taken 3521 times.
|
19431 | if(cmb->usrflags&cflag4) //Smart corners |
| 33281 | { | ||
| 33282 |
2/2✓ Branch 0 taken 1149 times.
✓ Branch 1 taken 2372 times.
|
3521 | if(deltay<0) |
| 33283 | { | ||
| 33284 | 1149 | info = walkflag(x,y+8-(bigHitbox*8)-2,2,up); | |
| 33285 | 1149 | execute(info); | |
| 33286 | |||
| 33287 |
2/2✓ Branch 0 taken 51 times.
✓ Branch 1 taken 1098 times.
|
1149 | if(!info.isUnwalkable()) |
| 33288 | { | ||
| 33289 | 1098 | movedy = true; | |
| 33290 | 1098 | zfix step(0); | |
| 33291 | |||
| 33292 |
7/12✓ Branch 0 taken 1017 times.
✓ Branch 1 taken 81 times.
✓ Branch 2 taken 174 times.
✓ Branch 3 taken 924 times.
✓ Branch 4 taken 30 times.
✓ Branch 5 taken 144 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 30 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
1098 | if ((getInput(btnRight, INPUT_DRUNK | INPUT_HERO_ACTION) || getInput(btnLeft, INPUT_DRUNK | INPUT_HERO_ACTION)) && dir != left && dir != right && !(diagonalMovement || NO_GRIDLOCK)) |
| 33293 | { | ||
| 33294 | ✗ | while(step<(abs(deltay)*(isSideViewHero()?2:1))) | |
| 33295 | { | ||
| 33296 | ✗ | yoff=int32_t(y-step)&7; | |
| 33297 | |||
| 33298 | ✗ | if(!yoff) break; | |
| 33299 | |||
| 33300 | ✗ | step++; | |
| 33301 | } | ||
| 33302 | ✗ | } | |
| 33303 | else | ||
| 33304 | { | ||
| 33305 | 1098 | step=abs(deltay); | |
| 33306 | } | ||
| 33307 | |||
| 33308 | 1098 | y=y-step; | |
| 33309 | 1098 | hs_starty-=step.getInt(); | |
| 33310 | |||
| 33311 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1098 times.
|
1098 | for(int32_t j=0; j<chainlinks.Count(); j++) |
| 33312 | { | ||
| 33313 | ✗ | chainlinks.spr(j)->y-=step; | |
| 33314 | ✗ | } | |
| 33315 | |||
| 33316 |
1/2✓ Branch 0 taken 1098 times.
✗ Branch 1 not taken.
|
1098 | if(Lwpns.idFirst(wHookshot)>-1) |
| 33317 | { | ||
| 33318 | ✗ | Lwpns.spr(Lwpns.idFirst(wHookshot))->y-=step; | |
| 33319 | ✗ | } | |
| 33320 | |||
| 33321 |
1/2✓ Branch 0 taken 1098 times.
✗ Branch 1 not taken.
|
1098 | if(Lwpns.idFirst(wHSHandle)>-1) |
| 33322 | { | ||
| 33323 | ✗ | Lwpns.spr(Lwpns.idFirst(wHSHandle))->y-=step; | |
| 33324 | ✗ | } | |
| 33325 | 1098 | } | |
| 33326 | 1149 | } | |
| 33327 |
2/2✓ Branch 0 taken 1945 times.
✓ Branch 1 taken 427 times.
|
2372 | else if(deltay>0) |
| 33328 | { | ||
| 33329 | 427 | info = walkflag(x,y+15+2,2,down); | |
| 33330 | 427 | execute(info); | |
| 33331 | |||
| 33332 |
2/2✓ Branch 0 taken 5 times.
✓ Branch 1 taken 422 times.
|
427 | if(!info.isUnwalkable()) |
| 33333 | { | ||
| 33334 | 422 | movedy = true; | |
| 33335 | 422 | zfix step(0); | |
| 33336 | |||
| 33337 |
7/12✓ Branch 0 taken 311 times.
✓ Branch 1 taken 111 times.
✓ Branch 2 taken 111 times.
✓ Branch 3 taken 311 times.
✓ Branch 4 taken 9 times.
✓ Branch 5 taken 102 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 9 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
422 | if ((getInput(btnRight, INPUT_DRUNK | INPUT_HERO_ACTION) || getInput(btnLeft, INPUT_DRUNK | INPUT_HERO_ACTION)) && dir != left && dir != right && !(diagonalMovement || NO_GRIDLOCK)) |
| 33338 | { | ||
| 33339 | ✗ | while(step<abs(deltay)) | |
| 33340 | { | ||
| 33341 | ✗ | yoff=int32_t(y+step)&7; | |
| 33342 | |||
| 33343 | ✗ | if(!yoff) break; | |
| 33344 | |||
| 33345 | ✗ | step++; | |
| 33346 | } | ||
| 33347 | ✗ | } | |
| 33348 | else | ||
| 33349 | { | ||
| 33350 | 422 | step=abs(deltay); | |
| 33351 | } | ||
| 33352 | |||
| 33353 | 422 | y=y+step; | |
| 33354 | 422 | hs_starty+=step.getInt(); | |
| 33355 | |||
| 33356 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 422 times.
|
422 | for(int32_t j=0; j<chainlinks.Count(); j++) |
| 33357 | { | ||
| 33358 | ✗ | chainlinks.spr(j)->y+=step; | |
| 33359 | ✗ | } | |
| 33360 | |||
| 33361 |
1/2✓ Branch 0 taken 422 times.
✗ Branch 1 not taken.
|
422 | if(Lwpns.idFirst(wHookshot)>-1) |
| 33362 | { | ||
| 33363 | ✗ | Lwpns.spr(Lwpns.idFirst(wHookshot))->y+=step; | |
| 33364 | ✗ | } | |
| 33365 | |||
| 33366 |
1/2✓ Branch 0 taken 422 times.
✗ Branch 1 not taken.
|
422 | if(Lwpns.idFirst(wHSHandle)>-1) |
| 33367 | { | ||
| 33368 | ✗ | Lwpns.spr(Lwpns.idFirst(wHSHandle))->y+=step; | |
| 33369 | ✗ | } | |
| 33370 | 422 | } | |
| 33371 | 427 | } | |
| 33372 | |||
| 33373 |
2/2✓ Branch 0 taken 532 times.
✓ Branch 1 taken 2989 times.
|
3521 | if(deltax<0) |
| 33374 | { | ||
| 33375 | 532 | info = walkflag(x-int32_t(lsteps[x.getInt()&7]),y+8-(bigHitbox ? 8 : 0),1,left); | |
| 33376 | 532 | execute(info); | |
| 33377 | |||
| 33378 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 532 times.
|
532 | if(!info.isUnwalkable()) |
| 33379 | { | ||
| 33380 | 532 | movedx = true; | |
| 33381 | 532 | zfix step(0); | |
| 33382 | |||
| 33383 |
7/12✓ Branch 0 taken 498 times.
✓ Branch 1 taken 34 times.
✓ Branch 2 taken 10 times.
✓ Branch 3 taken 522 times.
✓ Branch 4 taken 9 times.
✓ Branch 5 taken 1 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 9 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
532 | if ((getInput(btnUp, INPUT_DRUNK | INPUT_HERO_ACTION) || getInput(btnDown, INPUT_DRUNK | INPUT_HERO_ACTION)) && dir != up && dir != down && !(diagonalMovement || NO_GRIDLOCK)) |
| 33384 | { | ||
| 33385 | ✗ | while(step<abs(deltax)) | |
| 33386 | { | ||
| 33387 | ✗ | xoff=int32_t(x-step)&7; | |
| 33388 | |||
| 33389 | ✗ | if(!xoff) break; | |
| 33390 | |||
| 33391 | ✗ | step++; | |
| 33392 | } | ||
| 33393 | ✗ | } | |
| 33394 | else | ||
| 33395 | { | ||
| 33396 | 532 | step=abs(deltax); | |
| 33397 | } | ||
| 33398 | |||
| 33399 | 532 | x=x-step; | |
| 33400 | 532 | hs_startx-=step.getInt(); | |
| 33401 | |||
| 33402 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 532 times.
|
532 | for(int32_t j=0; j<chainlinks.Count(); j++) |
| 33403 | { | ||
| 33404 | ✗ | chainlinks.spr(j)->x-=step; | |
| 33405 | ✗ | } | |
| 33406 | |||
| 33407 |
1/2✓ Branch 0 taken 532 times.
✗ Branch 1 not taken.
|
532 | if(Lwpns.idFirst(wHookshot)>-1) |
| 33408 | { | ||
| 33409 | ✗ | Lwpns.spr(Lwpns.idFirst(wHookshot))->x-=step; | |
| 33410 | ✗ | } | |
| 33411 | |||
| 33412 |
1/2✓ Branch 0 taken 532 times.
✗ Branch 1 not taken.
|
532 | if(Lwpns.idFirst(wHSHandle)>-1) |
| 33413 | { | ||
| 33414 | ✗ | Lwpns.spr(Lwpns.idFirst(wHSHandle))->x-=step; | |
| 33415 | ✗ | } | |
| 33416 | 532 | } | |
| 33417 | 532 | } | |
| 33418 |
2/2✓ Branch 0 taken 1576 times.
✓ Branch 1 taken 1413 times.
|
2989 | else if(deltax>0) |
| 33419 | { | ||
| 33420 | 1413 | info = walkflag(x+15+2,y+8-(bigHitbox ? 8 : 0),1,right); | |
| 33421 | 1413 | execute(info); | |
| 33422 | |||
| 33423 |
2/2✓ Branch 0 taken 14 times.
✓ Branch 1 taken 1399 times.
|
1413 | if(!info.isUnwalkable()) |
| 33424 | { | ||
| 33425 | 1399 | movedx = true; | |
| 33426 | 1399 | zfix step(0); | |
| 33427 | |||
| 33428 |
7/12✓ Branch 0 taken 1221 times.
✓ Branch 1 taken 178 times.
✓ Branch 2 taken 215 times.
✓ Branch 3 taken 1184 times.
✓ Branch 4 taken 168 times.
✓ Branch 5 taken 47 times.
✗ Branch 6 not taken.
✓ Branch 7 taken 168 times.
✗ Branch 8 not taken.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✗ Branch 11 not taken.
|
1399 | if ((getInput(btnUp, INPUT_DRUNK | INPUT_HERO_ACTION) || getInput(btnDown, INPUT_DRUNK | INPUT_HERO_ACTION)) && dir != up && dir != down && !(diagonalMovement || NO_GRIDLOCK)) |
| 33429 | { | ||
| 33430 | ✗ | while(step<abs(deltax)) | |
| 33431 | { | ||
| 33432 | ✗ | xoff=int32_t(x+step)&7; | |
| 33433 | |||
| 33434 | ✗ | if(!xoff) break; | |
| 33435 | |||
| 33436 | ✗ | step++; | |
| 33437 | } | ||
| 33438 | ✗ | } | |
| 33439 | else | ||
| 33440 | { | ||
| 33441 | 1399 | step=abs(deltax); | |
| 33442 | } | ||
| 33443 | |||
| 33444 | 1399 | x=x+step; | |
| 33445 | 1399 | hs_startx+=step.getInt(); | |
| 33446 | |||
| 33447 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 1399 times.
|
1399 | for(int32_t j=0; j<chainlinks.Count(); j++) |
| 33448 | { | ||
| 33449 | ✗ | chainlinks.spr(j)->x+=step; | |
| 33450 | ✗ | } | |
| 33451 | |||
| 33452 |
1/2✓ Branch 0 taken 1399 times.
✗ Branch 1 not taken.
|
1399 | if(Lwpns.idFirst(wHookshot)>-1) |
| 33453 | { | ||
| 33454 | ✗ | Lwpns.spr(Lwpns.idFirst(wHookshot))->x+=step; | |
| 33455 | ✗ | } | |
| 33456 | |||
| 33457 |
1/2✓ Branch 0 taken 1399 times.
✗ Branch 1 not taken.
|
1399 | if(Lwpns.idFirst(wHSHandle)>-1) |
| 33458 | { | ||
| 33459 | ✗ | Lwpns.spr(Lwpns.idFirst(wHSHandle))->x+=step; | |
| 33460 | ✗ | } | |
| 33461 | 1399 | } | |
| 33462 | 1413 | } | |
| 33463 |
5/6✓ Branch 0 taken 1945 times.
✓ Branch 1 taken 1576 times.
✓ Branch 2 taken 14 times.
✓ Branch 3 taken 1931 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 14 times.
|
3521 | if(deltax && !movedx && !deltay) |
| 33464 | { | ||
| 33465 | 14 | zfix oy = y; | |
| 33466 | 14 | y = COMBOY_REGION(rpos); | |
| 33467 | 14 | bool validpush = scr_canmove(deltax, 0, false, false); | |
| 33468 |
1/2✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
|
28 | zfix ny = handle_movestate_zfix([&]() |
| 33469 | { | ||
| 33470 | 14 | movexy(deltax,0,false,false,true,true); | |
| 33471 | 14 | return y; | |
| 33472 | }); | ||
| 33473 | 14 | y = oy; | |
| 33474 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 14 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
14 | if (validpush || ny != COMBOY_REGION(rpos)) |
| 33475 | { | ||
| 33476 |
1/2✓ Branch 0 taken 14 times.
✗ Branch 1 not taken.
|
14 | if (y <= ny-1) |
| 33477 | { | ||
| 33478 | 14 | setYfix(y+1); | |
| 33479 | 14 | } | |
| 33480 | ✗ | else if (y >= ny+1) | |
| 33481 | { | ||
| 33482 | ✗ | setYfix(y-1); | |
| 33483 | ✗ | } | |
| 33484 | else | ||
| 33485 | { | ||
| 33486 | ✗ | setYfix(ny); | |
| 33487 | } | ||
| 33488 | 14 | } | |
| 33489 | 14 | } | |
| 33490 |
5/6✓ Branch 0 taken 1576 times.
✓ Branch 1 taken 1945 times.
✓ Branch 2 taken 56 times.
✓ Branch 3 taken 1520 times.
✗ Branch 4 not taken.
✓ Branch 5 taken 56 times.
|
3521 | if(deltay && !movedy && !deltax) |
| 33491 | { | ||
| 33492 | 56 | zfix ox = x; | |
| 33493 | 56 | x = COMBOX_REGION(rpos); | |
| 33494 | 56 | bool validpush = scr_canmove(0, deltay, false, false); | |
| 33495 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 56 times.
|
112 | zfix nx = handle_movestate_zfix([&]() |
| 33496 | { | ||
| 33497 | 56 | movexy(0,deltay,false,false,true,true); | |
| 33498 | 56 | return x; | |
| 33499 | }); | ||
| 33500 | 56 | x = ox; | |
| 33501 |
1/4✗ Branch 0 not taken.
✓ Branch 1 taken 56 times.
✗ Branch 2 not taken.
✗ Branch 3 not taken.
|
56 | if (validpush || nx != COMBOX_REGION(rpos)) |
| 33502 | { | ||
| 33503 |
2/2✓ Branch 0 taken 53 times.
✓ Branch 1 taken 3 times.
|
56 | if (x <= nx-1) |
| 33504 | { | ||
| 33505 | 53 | setXfix(x+1); | |
| 33506 | 53 | } | |
| 33507 |
1/2✓ Branch 0 taken 3 times.
✗ Branch 1 not taken.
|
3 | else if (x >= nx+1) |
| 33508 | { | ||
| 33509 | ✗ | setXfix(x-1); | |
| 33510 | ✗ | } | |
| 33511 | else | ||
| 33512 | { | ||
| 33513 | 3 | setXfix(nx); | |
| 33514 | } | ||
| 33515 | 56 | } | |
| 33516 | 56 | } | |
| 33517 | 3521 | } | |
| 33518 |
2/2✓ Branch 0 taken 1520 times.
✓ Branch 1 taken 17911 times.
|
19431 | if(!movedy) |
| 33519 | { | ||
| 33520 |
2/2✓ Branch 0 taken 2806 times.
✓ Branch 1 taken 15105 times.
|
17911 | if(deltay<0) |
| 33521 | { | ||
| 33522 | 2806 | info = walkflag(x,y+8-(bigHitbox*8)-2,2,up); | |
| 33523 | 2806 | execute(info); | |
| 33524 | |||
| 33525 |
2/2✓ Branch 0 taken 247 times.
✓ Branch 1 taken 2559 times.
|
2806 | if(!info.isUnwalkable()) |
| 33526 | { | ||
| 33527 | 2559 | movedy = true; | |
| 33528 | 2559 | zfix step(0); | |
| 33529 | |||
| 33530 |
10/12✓ Branch 0 taken 1981 times.
✓ Branch 1 taken 578 times.
✓ Branch 2 taken 706 times.
✓ Branch 3 taken 1853 times.
✓ Branch 4 taken 218 times.
✓ Branch 5 taken 488 times.
✓ Branch 6 taken 195 times.
✓ Branch 7 taken 23 times.
✓ Branch 8 taken 195 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 195 times.
|
2559 | if ((getInput(btnRight, INPUT_DRUNK | INPUT_HERO_ACTION) || getInput(btnLeft, INPUT_DRUNK | INPUT_HERO_ACTION)) && dir != left && dir != right && !(diagonalMovement || NO_GRIDLOCK)) |
| 33531 | { | ||
| 33532 |
2/2✓ Branch 0 taken 157 times.
✓ Branch 1 taken 373 times.
|
530 | while(step<(abs(deltay)*(isSideViewHero()?2:1))) |
| 33533 | { | ||
| 33534 | 373 | yoff=int32_t(y-step)&7; | |
| 33535 | |||
| 33536 |
2/2✓ Branch 0 taken 335 times.
✓ Branch 1 taken 38 times.
|
373 | if(!yoff) break; |
| 33537 | |||
| 33538 | 335 | step++; | |
| 33539 | } | ||
| 33540 | 195 | } | |
| 33541 | else | ||
| 33542 | { | ||
| 33543 | 2364 | step=abs(deltay); | |
| 33544 | } | ||
| 33545 | |||
| 33546 | 2559 | y=y-step; | |
| 33547 | 2559 | hs_starty-=step.getInt(); | |
| 33548 | |||
| 33549 |
2/2✓ Branch 0 taken 19 times.
✓ Branch 1 taken 2559 times.
|
2578 | for(int32_t j=0; j<chainlinks.Count(); j++) |
| 33550 | { | ||
| 33551 | 19 | chainlinks.spr(j)->y-=step; | |
| 33552 | 19 | } | |
| 33553 | |||
| 33554 |
2/2✓ Branch 0 taken 2540 times.
✓ Branch 1 taken 19 times.
|
2559 | if(Lwpns.idFirst(wHookshot)>-1) |
| 33555 | { | ||
| 33556 | 19 | Lwpns.spr(Lwpns.idFirst(wHookshot))->y-=step; | |
| 33557 | 19 | } | |
| 33558 | |||
| 33559 |
2/2✓ Branch 0 taken 2540 times.
✓ Branch 1 taken 19 times.
|
2559 | if(Lwpns.idFirst(wHSHandle)>-1) |
| 33560 | { | ||
| 33561 | 19 | Lwpns.spr(Lwpns.idFirst(wHSHandle))->y-=step; | |
| 33562 | 19 | } | |
| 33563 | 2559 | } | |
| 33564 | 247 | else checkdamagecombos(x,y+8-(bigHitbox ? 8 : 0)-2); | |
| 33565 | 2806 | } | |
| 33566 |
2/2✓ Branch 0 taken 10584 times.
✓ Branch 1 taken 4521 times.
|
15105 | else if(deltay>0) |
| 33567 | { | ||
| 33568 | 4521 | info = walkflag(x,y+15+2,2,down); | |
| 33569 | 4521 | execute(info); | |
| 33570 | |||
| 33571 |
2/2✓ Branch 0 taken 897 times.
✓ Branch 1 taken 3624 times.
|
4521 | if(!info.isUnwalkable()) |
| 33572 | { | ||
| 33573 | 3624 | movedy = true; | |
| 33574 | 3624 | zfix step(0); | |
| 33575 | |||
| 33576 |
10/12✓ Branch 0 taken 2897 times.
✓ Branch 1 taken 727 times.
✓ Branch 2 taken 961 times.
✓ Branch 3 taken 2663 times.
✓ Branch 4 taken 446 times.
✓ Branch 5 taken 515 times.
✓ Branch 6 taken 388 times.
✓ Branch 7 taken 58 times.
✓ Branch 8 taken 388 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 388 times.
|
3624 | if ((getInput(btnRight, INPUT_DRUNK | INPUT_HERO_ACTION) || getInput(btnLeft, INPUT_DRUNK | INPUT_HERO_ACTION)) && dir != left && dir != right && !(diagonalMovement || NO_GRIDLOCK)) |
| 33577 | { | ||
| 33578 |
2/2✓ Branch 0 taken 235 times.
✓ Branch 1 taken 646 times.
|
881 | while(step<abs(deltay)) |
| 33579 | { | ||
| 33580 | 646 | yoff=int32_t(y+step)&7; | |
| 33581 | |||
| 33582 |
2/2✓ Branch 0 taken 493 times.
✓ Branch 1 taken 153 times.
|
646 | if(!yoff) break; |
| 33583 | |||
| 33584 | 493 | step++; | |
| 33585 | } | ||
| 33586 | 388 | } | |
| 33587 | else | ||
| 33588 | { | ||
| 33589 | 3236 | step=abs(deltay); | |
| 33590 | } | ||
| 33591 | |||
| 33592 | 3624 | y=y+step; | |
| 33593 | 3624 | hs_starty+=step.getInt(); | |
| 33594 | |||
| 33595 |
2/2✓ Branch 0 taken 13 times.
✓ Branch 1 taken 3624 times.
|
3637 | for(int32_t j=0; j<chainlinks.Count(); j++) |
| 33596 | { | ||
| 33597 | 13 | chainlinks.spr(j)->y+=step; | |
| 33598 | 13 | } | |
| 33599 | |||
| 33600 |
2/2✓ Branch 0 taken 3585 times.
✓ Branch 1 taken 39 times.
|
3624 | if(Lwpns.idFirst(wHookshot)>-1) |
| 33601 | { | ||
| 33602 | 39 | Lwpns.spr(Lwpns.idFirst(wHookshot))->y+=step; | |
| 33603 | 39 | } | |
| 33604 | |||
| 33605 |
2/2✓ Branch 0 taken 3585 times.
✓ Branch 1 taken 39 times.
|
3624 | if(Lwpns.idFirst(wHSHandle)>-1) |
| 33606 | { | ||
| 33607 | 39 | Lwpns.spr(Lwpns.idFirst(wHSHandle))->y+=step; | |
| 33608 | 39 | } | |
| 33609 | 3624 | } | |
| 33610 | 897 | else checkdamagecombos(x,y+15); | |
| 33611 | 4521 | } | |
| 33612 | 17911 | } | |
| 33613 |
2/2✓ Branch 0 taken 1931 times.
✓ Branch 1 taken 17500 times.
|
19431 | if(!movedx) |
| 33614 | { | ||
| 33615 |
2/2✓ Branch 0 taken 5409 times.
✓ Branch 1 taken 12091 times.
|
17500 | if(deltax<0) |
| 33616 | { | ||
| 33617 | 5409 | info = walkflag(x-int32_t(lsteps[x.getInt()&7]),y+8-(bigHitbox ? 8 : 0),1,left); | |
| 33618 | 5409 | execute(info); | |
| 33619 | |||
| 33620 |
2/2✓ Branch 0 taken 277 times.
✓ Branch 1 taken 5132 times.
|
5409 | if(!info.isUnwalkable()) |
| 33621 | { | ||
| 33622 | 5132 | movedx = true; | |
| 33623 | 5132 | zfix step(0); | |
| 33624 | |||
| 33625 |
10/12✓ Branch 0 taken 4604 times.
✓ Branch 1 taken 528 times.
✓ Branch 2 taken 691 times.
✓ Branch 3 taken 4441 times.
✓ Branch 4 taken 319 times.
✓ Branch 5 taken 372 times.
✓ Branch 6 taken 244 times.
✓ Branch 7 taken 75 times.
✓ Branch 8 taken 244 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 244 times.
|
5132 | if ((getInput(btnUp, INPUT_DRUNK | INPUT_HERO_ACTION) || getInput(btnDown, INPUT_DRUNK | INPUT_HERO_ACTION)) && dir != up && dir != down && !(diagonalMovement || NO_GRIDLOCK)) |
| 33626 | { | ||
| 33627 |
2/2✓ Branch 0 taken 179 times.
✓ Branch 1 taken 456 times.
|
635 | while(step<abs(deltax)) |
| 33628 | { | ||
| 33629 | 456 | xoff=int32_t(x-step)&7; | |
| 33630 | |||
| 33631 |
2/2✓ Branch 0 taken 391 times.
✓ Branch 1 taken 65 times.
|
456 | if(!xoff) break; |
| 33632 | |||
| 33633 | 391 | step++; | |
| 33634 | } | ||
| 33635 | 244 | } | |
| 33636 | else | ||
| 33637 | { | ||
| 33638 | 4888 | step=abs(deltax); | |
| 33639 | } | ||
| 33640 | |||
| 33641 | 5132 | x=x-step; | |
| 33642 | 5132 | hs_startx-=step.getInt(); | |
| 33643 | |||
| 33644 |
2/2✓ Branch 0 taken 42 times.
✓ Branch 1 taken 5132 times.
|
5174 | for(int32_t j=0; j<chainlinks.Count(); j++) |
| 33645 | { | ||
| 33646 | 42 | chainlinks.spr(j)->x-=step; | |
| 33647 | 42 | } | |
| 33648 | |||
| 33649 |
2/2✓ Branch 0 taken 5081 times.
✓ Branch 1 taken 51 times.
|
5132 | if(Lwpns.idFirst(wHookshot)>-1) |
| 33650 | { | ||
| 33651 | 51 | Lwpns.spr(Lwpns.idFirst(wHookshot))->x-=step; | |
| 33652 | 51 | } | |
| 33653 | |||
| 33654 |
2/2✓ Branch 0 taken 5081 times.
✓ Branch 1 taken 51 times.
|
5132 | if(Lwpns.idFirst(wHSHandle)>-1) |
| 33655 | { | ||
| 33656 | 51 | Lwpns.spr(Lwpns.idFirst(wHSHandle))->x-=step; | |
| 33657 | 51 | } | |
| 33658 | 5132 | } | |
| 33659 | 277 | else checkdamagecombos(x-int32_t(lsteps[x.getInt()&7]),y+8-(bigHitbox ? 8 : 0)); | |
| 33660 | 5409 | } | |
| 33661 |
2/2✓ Branch 0 taken 8847 times.
✓ Branch 1 taken 3244 times.
|
12091 | else if(deltax>0) |
| 33662 | { | ||
| 33663 | 3244 | info = walkflag(x+15+2,y+8-(bigHitbox ? 8 : 0),1,right); | |
| 33664 | 3244 | execute(info); | |
| 33665 | |||
| 33666 |
2/2✓ Branch 0 taken 82 times.
✓ Branch 1 taken 3162 times.
|
3244 | if(!info.isUnwalkable()) |
| 33667 | { | ||
| 33668 | 3162 | movedx = true; | |
| 33669 | 3162 | zfix step(0); | |
| 33670 | |||
| 33671 |
10/12✓ Branch 0 taken 2659 times.
✓ Branch 1 taken 503 times.
✓ Branch 2 taken 514 times.
✓ Branch 3 taken 2648 times.
✓ Branch 4 taken 313 times.
✓ Branch 5 taken 201 times.
✓ Branch 6 taken 203 times.
✓ Branch 7 taken 110 times.
✓ Branch 8 taken 203 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 203 times.
|
3162 | if ((getInput(btnUp, INPUT_DRUNK | INPUT_HERO_ACTION) || getInput(btnDown, INPUT_DRUNK | INPUT_HERO_ACTION)) && dir != up && dir != down && !(diagonalMovement || NO_GRIDLOCK)) |
| 33672 | { | ||
| 33673 |
2/2✓ Branch 0 taken 119 times.
✓ Branch 1 taken 341 times.
|
460 | while(step<abs(deltax)) |
| 33674 | { | ||
| 33675 | 341 | xoff=int32_t(x+step)&7; | |
| 33676 | |||
| 33677 |
2/2✓ Branch 0 taken 257 times.
✓ Branch 1 taken 84 times.
|
341 | if(!xoff) break; |
| 33678 | |||
| 33679 | 257 | step++; | |
| 33680 | } | ||
| 33681 | 203 | } | |
| 33682 | else | ||
| 33683 | { | ||
| 33684 | 2959 | step=abs(deltax); | |
| 33685 | } | ||
| 33686 | |||
| 33687 | 3162 | x=x+step; | |
| 33688 | 3162 | hs_startx+=step.getInt(); | |
| 33689 | |||
| 33690 |
2/2✓ Branch 0 taken 21 times.
✓ Branch 1 taken 3162 times.
|
3183 | for(int32_t j=0; j<chainlinks.Count(); j++) |
| 33691 | { | ||
| 33692 | 21 | chainlinks.spr(j)->x+=step; | |
| 33693 | 21 | } | |
| 33694 | |||
| 33695 |
2/2✓ Branch 0 taken 3139 times.
✓ Branch 1 taken 23 times.
|
3162 | if(Lwpns.idFirst(wHookshot)>-1) |
| 33696 | { | ||
| 33697 | 23 | Lwpns.spr(Lwpns.idFirst(wHookshot))->x+=step; | |
| 33698 | 23 | } | |
| 33699 | |||
| 33700 |
2/2✓ Branch 0 taken 3139 times.
✓ Branch 1 taken 23 times.
|
3162 | if(Lwpns.idFirst(wHSHandle)>-1) |
| 33701 | { | ||
| 33702 | 23 | Lwpns.spr(Lwpns.idFirst(wHSHandle))->x+=step; | |
| 33703 | 23 | } | |
| 33704 | 3162 | } | |
| 33705 | 82 | else checkdamagecombos(x+15+2,y+8-(bigHitbox ? 8 : 0)); | |
| 33706 | 3244 | } | |
| 33707 | 17500 | } | |
| 33708 |
4/4✓ Branch 0 taken 9206 times.
✓ Branch 1 taken 10225 times.
✓ Branch 2 taken 7703 times.
✓ Branch 3 taken 1503 times.
|
19431 | if(movedx || movedy) |
| 33709 | { | ||
| 33710 |
2/2✓ Branch 0 taken 14711 times.
✓ Branch 1 taken 3217 times.
|
17928 | if(cmb->usrflags&cflag1) |
| 33711 | 3217 | is_conveyor_stunned = rate; | |
| 33712 |
2/2✓ Branch 0 taken 17678 times.
✓ Branch 1 taken 250 times.
|
17928 | if(cmb->usrflags&cflag3) |
| 33713 | { | ||
| 33714 |
2/2✓ Branch 0 taken 176 times.
✓ Branch 1 taken 74 times.
|
250 | if(abs(deltax) > abs(deltay)) |
| 33715 | 176 | conv_forcedir = dir = (deltax > 0) ? right : left; | |
| 33716 | 74 | else conv_forcedir = dir = (deltay > 0) ? down : up; | |
| 33717 | 250 | } | |
| 33718 | 17928 | } | |
| 33719 | } | ||
| 33720 | 19590 | } | |
| 33721 | 14835443 | } | |
| 33722 | |||
| 33723 | ✗ | void HeroClass::setDivineProtectionShieldClk(int32_t newclk) | |
| 33724 | { | ||
| 33725 | ✗ | DivineProtectionShieldClk=newclk; | |
| 33726 | |||
| 33727 | ✗ | if(decorations.idCount(dDIVINEPROTECTIONSHIELD)==0) | |
| 33728 | { | ||
| 33729 | // TODO(crash): check that .add succeeds. | ||
| 33730 | ✗ | decorations.add(new dDivineProtectionShield(HeroX(), HeroY(), dDIVINEPROTECTIONSHIELD, 0)); | |
| 33731 | ✗ | decorations.spr(decorations.Count()-1)->misc=0; | |
| 33732 | ✗ | decorations.add(new dDivineProtectionShield(HeroX(), HeroY(), dDIVINEPROTECTIONSHIELD, 0)); | |
| 33733 | ✗ | decorations.spr(decorations.Count()-1)->misc=1; | |
| 33734 | ✗ | } | |
| 33735 | ✗ | } | |
| 33736 | |||
| 33737 | 37723 | int32_t HeroClass::getDivineProtectionShieldClk() | |
| 33738 | { | ||
| 33739 | 37723 | return DivineProtectionShieldClk; | |
| 33740 | } | ||
| 33741 | |||
| 33742 | 21 | int32_t HeroClass::getHoverClk() | |
| 33743 | { | ||
| 33744 | 21 | return hoverclk; | |
| 33745 | } | ||
| 33746 | |||
| 33747 | 27659626 | int32_t HeroClass::getHoldClk() | |
| 33748 | { | ||
| 33749 | 27659626 | return holdclk; | |
| 33750 | } | ||
| 33751 | |||
| 33752 | 8919297 | int32_t HeroClass::getLastLensID(){ | |
| 33753 | 8919297 | return last_lens_id; | |
| 33754 | } | ||
| 33755 | |||
| 33756 | 210 | void HeroClass::setLastLensID(int32_t p_item){ | |
| 33757 | 210 | last_lens_id = p_item; | |
| 33758 | 210 | } | |
| 33759 | |||
| 33760 | 110290277 | bool HeroClass::getOnSideviewLadder() | |
| 33761 | { | ||
| 33762 | 110290277 | return on_sideview_ladder; | |
| 33763 | } | ||
| 33764 | |||
| 33765 | 386 | void HeroClass::setOnSideviewLadder(bool val) | |
| 33766 | { | ||
| 33767 |
2/2✓ Branch 0 taken 377 times.
✓ Branch 1 taken 9 times.
|
386 | if(val) |
| 33768 | { | ||
| 33769 | 9 | fall = fakefall = hoverclk = jumping = 0; | |
| 33770 | 9 | hoverflags = 0; | |
| 33771 | 9 | inair = false; | |
| 33772 | 9 | } | |
| 33773 | 386 | on_sideview_ladder = val; | |
| 33774 | 386 | } | |
| 33775 | |||
| 33776 | 4898766 | bool HeroClass::canSideviewLadder(bool down) | |
| 33777 | { | ||
| 33778 |
2/2✓ Branch 0 taken 4854525 times.
✓ Branch 1 taken 44241 times.
|
4898766 | if(!isSideViewHero()) return false; |
| 33779 |
2/2✓ Branch 0 taken 26461 times.
✓ Branch 1 taken 17780 times.
|
44241 | if(jumping < 0) return false; |
| 33780 |
2/2✓ Branch 0 taken 15182 times.
✓ Branch 1 taken 11279 times.
|
26461 | if (down) |
| 33781 | { | ||
| 33782 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 11279 times.
|
11279 | if (check_new_slope(x, y + 0.0001_zf, 16, 16, old_x, old_y, true)) |
| 33783 | { | ||
| 33784 | ✗ | return false; | |
| 33785 | } | ||
| 33786 | 11279 | } | |
| 33787 |
3/4✓ Branch 0 taken 11279 times.
✓ Branch 1 taken 15182 times.
✓ Branch 2 taken 11279 times.
✗ Branch 3 not taken.
|
26461 | if(down && get_qr(qr_DOWN_DOESNT_GRAB_LADDERS)) |
| 33788 | { | ||
| 33789 | ✗ | bool onSolid = on_sideview_solid_oldpos(this,true); | |
| 33790 | ✗ | return ((isSVLadder(x+4,y+16) && (!isSVLadder(x+4,y)||onSolid)) || (isSVLadder(x+12,y+16) && (!isSVLadder(x+12,y)||onSolid))); | |
| 33791 | } | ||
| 33792 | //Are you presently able to climb a sideview ladder? | ||
| 33793 | //x+4 / +12 are the offsets used for detecting a platform below you in sideview | ||
| 33794 | //y+0 checks your top-half for large hitbox; y+8 for small | ||
| 33795 | //y+15 checks if you are on one at all. This is necessary so you don't just fall off before reaching the top. | ||
| 33796 | //y+16 check is for going down onto a ladder you are standing on. | ||
| 33797 |
2/2✓ Branch 0 taken 25839 times.
✓ Branch 1 taken 622 times.
|
52300 | return (isSVLadder(x+4,y+(bigHitbox?0:8)) || isSVLadder(x+12,y+(bigHitbox?0:8))) |
| 33798 |
3/4✓ Branch 0 taken 25839 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 25831 times.
✓ Branch 3 taken 8 times.
|
25839 | || isSVLadder(x+4,y+15) || isSVLadder(x+12,y+15) |
| 33799 |
5/6✗ Branch 0 not taken.
✓ Branch 1 taken 25831 times.
✓ Branch 2 taken 14552 times.
✓ Branch 3 taken 11279 times.
✓ Branch 4 taken 1 times.
✓ Branch 5 taken 11278 times.
|
37110 | || (down && (isSVLadder(x+4,y+16) || isSVLadder(x+12,y+16))); |
| 33800 | 4898766 | } | |
| 33801 | |||
| 33802 | ✗ | bool HeroClass::canSideviewLadderRemote(int32_t wx, int32_t wy, bool down) | |
| 33803 | { | ||
| 33804 | ✗ | if(!isSideViewHero()) return false; | |
| 33805 | ✗ | if(jumping < 0) return false; | |
| 33806 | ✗ | if(down && get_qr(qr_DOWN_DOESNT_GRAB_LADDERS)) | |
| 33807 | { | ||
| 33808 | ✗ | bool onSolid = on_sideview_solid_oldpos(this,true); | |
| 33809 | ✗ | return ((isSVLadder(wx+4,wy+16) && (!isSVLadder(wx+4,wy)||onSolid)) || (isSVLadder(wx+12,wy+16) && (!isSVLadder(wx+12,wy)||onSolid))); | |
| 33810 | } | ||
| 33811 | //Are you presently able to climb a sideview ladder? | ||
| 33812 | //x+4 / +12 are the offsets used for detecting a platform below you in sideview | ||
| 33813 | //y+0 checks your top-half for large hitbox; y+8 for small | ||
| 33814 | //y+15 checks if you are on one at all. This is necessary so you don't just fall off before reaching the top. | ||
| 33815 | //y+16 check is for going down onto a ladder you are standing on. | ||
| 33816 | ✗ | return (isSVLadder(wx+4,wy+(bigHitbox?0:8)) || isSVLadder(wx+12,wy+(bigHitbox?0:8))) | |
| 33817 | ✗ | || isSVLadder(wx+4,wy+15) || isSVLadder(wx+12,wy+15) | |
| 33818 | ✗ | || (down && (isSVLadder(wx+4,wy+16) || isSVLadder(wx+12,wy+16))); | |
| 33819 | ✗ | } | |
| 33820 | |||
| 33821 | 10010503 | void HeroClass::execute(HeroClass::WalkflagInfo info) | |
| 33822 | { | ||
| 33823 | 10010503 | int32_t flags = info.getFlags(); | |
| 33824 | |||
| 33825 |
2/2✓ Branch 0 taken 1770 times.
✓ Branch 1 taken 10008733 times.
|
10010503 | if(flags & WalkflagInfo::CLEARILSWIM) |
| 33826 | 1770 | ilswim =false; | |
| 33827 |
2/2✓ Branch 0 taken 10005393 times.
✓ Branch 1 taken 3340 times.
|
10008733 | else if(flags & WalkflagInfo::SETILSWIM) |
| 33828 | 3340 | ilswim = true; | |
| 33829 | |||
| 33830 |
1/2✓ Branch 0 taken 10010503 times.
✗ Branch 1 not taken.
|
10010503 | if(flags & WalkflagInfo::CLEARCHARGEATTACK) |
| 33831 | { | ||
| 33832 | ✗ | charging = 0; | |
| 33833 | ✗ | attackclk = 0; | |
| 33834 | ✗ | } | |
| 33835 | |||
| 33836 |
1/2✓ Branch 0 taken 10010503 times.
✗ Branch 1 not taken.
|
10010503 | if(flags & WalkflagInfo::SETDIR) |
| 33837 | { | ||
| 33838 | ✗ | dir = info.getDir(); | |
| 33839 | ✗ | } | |
| 33840 | |||
| 33841 |
2/2✓ Branch 0 taken 10009215 times.
✓ Branch 1 taken 1288 times.
|
10010503 | if(flags & WalkflagInfo::SETHOPCLK) |
| 33842 | { | ||
| 33843 | 1288 | hopclk = info.getHopClk(); | |
| 33844 | 1288 | } | |
| 33845 | |||
| 33846 |
2/2✓ Branch 0 taken 10009059 times.
✓ Branch 1 taken 1444 times.
|
10010503 | if(flags & WalkflagInfo::SETHOPDIR) |
| 33847 | { | ||
| 33848 | 1444 | hopdir = info.getHopDir(); | |
| 33849 | 1444 | } | |
| 33850 | |||
| 33851 | 10010503 | } | |
| 33852 | |||
| 33853 | 17803273 | HeroClass::WalkflagInfo HeroClass::WalkflagInfo::operator ||(HeroClass::WalkflagInfo other) | |
| 33854 | { | ||
| 33855 | 17803273 | HeroClass::WalkflagInfo ret; | |
| 33856 | 17803273 | ret.newhopclk = newhopclk; | |
| 33857 | 17803273 | ret.newdir = newdir; | |
| 33858 |
2/2✓ Branch 0 taken 14799327 times.
✓ Branch 1 taken 3003946 times.
|
17803273 | ret.newhopdir = (other.newhopdir >-1 ? other.newhopdir : newhopdir); |
| 33859 | |||
| 33860 | 17803273 | int32_t flags1 = (flags & ~UNWALKABLE) & (other.flags & ~UNWALKABLE); | |
| 33861 | 17803273 | int32_t flags2 = (flags & UNWALKABLE) | (other.flags & UNWALKABLE); | |
| 33862 | 17803273 | ret.flags = flags1 | flags2; | |
| 33863 | 17803273 | return ret; | |
| 33864 | } | ||
| 33865 | |||
| 33866 | 219038 | HeroClass::WalkflagInfo HeroClass::WalkflagInfo::operator &&(HeroClass::WalkflagInfo other) | |
| 33867 | { | ||
| 33868 | 219038 | HeroClass::WalkflagInfo ret; | |
| 33869 | 219038 | ret.newhopclk = newhopclk; | |
| 33870 | 219038 | ret.newdir = newdir; | |
| 33871 |
1/2✓ Branch 0 taken 219038 times.
✗ Branch 1 not taken.
|
219038 | ret.newhopdir = (other.newhopdir >-1 ? other.newhopdir : newhopdir); |
| 33872 | |||
| 33873 | 219038 | ret.flags = flags & other.flags; | |
| 33874 | 219038 | return ret; | |
| 33875 | } | ||
| 33876 | |||
| 33877 | 219038 | HeroClass::WalkflagInfo HeroClass::WalkflagInfo::operator !() | |
| 33878 | { | ||
| 33879 | 219038 | HeroClass::WalkflagInfo ret; | |
| 33880 | 219038 | ret.newhopclk = newhopclk; | |
| 33881 | 219038 | ret.newdir = newdir; | |
| 33882 | 219038 | ret.newhopdir = newhopdir; | |
| 33883 | |||
| 33884 | 219038 | ret.flags = flags ^ UNWALKABLE; | |
| 33885 | 219038 | return ret; | |
| 33886 | } | ||
| 33887 | |||
| 33888 | ✗ | void HeroClass::explode(int32_t type) | |
| 33889 | { | ||
| 33890 | static int32_t tempx, tempy; | ||
| 33891 | static byte herotilebuf[256]; | ||
| 33892 | ✗ | int32_t ltile=0; | |
| 33893 | ✗ | int32_t lflip=0; | |
| 33894 | ✗ | unpack_tile(newtilebuf, tile, flip, true); | |
| 33895 | ✗ | memcpy(herotilebuf, unpackbuf, 256); | |
| 33896 | ✗ | tempx=Hero.getX(); | |
| 33897 | ✗ | tempy=Hero.getY(); | |
| 33898 | ✗ | for(int32_t i=0; i<16; ++i) | |
| 33899 | { | ||
| 33900 | ✗ | for(int32_t j=0; j<16; ++j) | |
| 33901 | { | ||
| 33902 | ✗ | if(herotilebuf[i*16+j]) | |
| 33903 | { | ||
| 33904 | ✗ | if(type==0) // Twilight | |
| 33905 | { | ||
| 33906 | ✗ | particles.add(new pTwilight(Hero.getX()+j, Hero.getY()-Hero.getZ()+i, 6, 0, 0, (zc_oldrand()%8)+i*4)); | |
| 33907 | ✗ | int32_t k=particles.Count()-1; | |
| 33908 | ✗ | particle *p = (particles.at(k)); | |
| 33909 | ✗ | p->step=3; | |
| 33910 | ✗ | } | |
| 33911 | ✗ | else if(type ==1) // Sands of Hours | |
| 33912 | { | ||
| 33913 | ✗ | particles.add(new pTwilight(Hero.getX()+j, Hero.getY()-Hero.getZ()+i, 6, 1, 2, (zc_oldrand()%16)+i*2)); | |
| 33914 | ✗ | int32_t k=particles.Count()-1; | |
| 33915 | ✗ | particle *p = (particles.at(k)); | |
| 33916 | ✗ | p->step=4; | |
| 33917 | |||
| 33918 | ✗ | if(zc_oldrand()%10 < 2) | |
| 33919 | { | ||
| 33920 | ✗ | p->color=1; | |
| 33921 | ✗ | p->cset=0; | |
| 33922 | ✗ | } | |
| 33923 | ✗ | } | |
| 33924 | else | ||
| 33925 | { | ||
| 33926 | ✗ | particles.add(new pDivineEscapeDust(Hero.getX()+j, Hero.getY()-Hero.getZ()+i, 6, 6, herotilebuf[i*16+j], zc_oldrand()%96)); | |
| 33927 | |||
| 33928 | ✗ | int32_t k=particles.Count()-1; | |
| 33929 | ✗ | particle *p = (particles.at(k)); | |
| 33930 | ✗ | p->angular=true; | |
| 33931 | ✗ | p->angle=zc_oldrand(); | |
| 33932 | ✗ | p->step=(((double)j)/8); | |
| 33933 | ✗ | p->yofs=Hero.getYOfs(); | |
| 33934 | } | ||
| 33935 | ✗ | } | |
| 33936 | ✗ | } | |
| 33937 | ✗ | } | |
| 33938 | ✗ | } | |
| 33939 | |||
| 33940 | 2224 | void HeroClass::SetSwim() | |
| 33941 | { | ||
| 33942 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 2224 times.
|
2224 | if (CanSideSwim()) |
| 33943 | { | ||
| 33944 | ✗ | if (action != sideswimattacking && action != attacking) {action=sideswimming; FFCore.setHeroAction(sideswimming);} | |
| 33945 | ✗ | else {action=sideswimattacking; FFCore.setHeroAction(sideswimattacking);} | |
| 33946 | ✗ | if (get_qr(qr_SIDESWIMDIR) && spins <= 0 && dir != left && dir != right) dir = sideswimdir; | |
| 33947 | ✗ | } | |
| 33948 | 2224 | else {action=swimming; FFCore.setHeroAction(swimming);} | |
| 33949 | 2224 | } | |
| 33950 | |||
| 33951 | 128712 | void HeroClass::SetAttack() | |
| 33952 | { | ||
| 33953 |
1/2✗ Branch 0 not taken.
✓ Branch 1 taken 128712 times.
|
128712 | if (IsSideSwim()) {action=sideswimattacking; FFCore.setHeroAction(sideswimattacking);} |
| 33954 | 128712 | else {action=attacking; FFCore.setHeroAction(attacking);} | |
| 33955 | 128712 | } | |
| 33956 | |||
| 33957 | 125988742 | bool HeroClass::IsSideSwim() | |
| 33958 | { | ||
| 33959 |
6/12✓ Branch 0 taken 125988742 times.
✗ Branch 1 not taken.
✓ Branch 2 taken 125988742 times.
✗ Branch 3 not taken.
✓ Branch 4 taken 125988742 times.
✗ Branch 5 not taken.
✓ Branch 6 taken 125988742 times.
✗ Branch 7 not taken.
✓ Branch 8 taken 125988742 times.
✗ Branch 9 not taken.
✗ Branch 10 not taken.
✓ Branch 11 taken 125988742 times.
|
125988742 | return (action==sideswimming || action==sideswimhit || action == sideswimattacking || action == sidewaterhold1 || action == sidewaterhold2 || action == sideswimcasting || action == sideswimfreeze); |
| 33960 | } | ||
| 33961 | |||
| 33962 | 2782653 | bool HeroClass::CanSideSwim() | |
| 33963 | { | ||
| 33964 |
1/2✓ Branch 0 taken 2782653 times.
✗ Branch 1 not taken.
|
2782653 | return (isSideViewHero() && get_qr(qr_SIDESWIM)); |
| 33965 | } | ||
| 33966 | |||
| 33967 | 13619773 | int32_t HeroClass::getTileModifier() | |
| 33968 | { | ||
| 33969 | 13619773 | return item_tile_mod() + bunny_tile_mod(); | |
| 33970 | } | ||
| 33971 | ✗ | void HeroClass::setImmortal(int32_t nimmortal) | |
| 33972 | { | ||
| 33973 | ✗ | immortal = nimmortal; | |
| 33974 | ✗ | } | |
| 33975 | ✗ | void HeroClass::kill(bool bypassFairy) | |
| 33976 | { | ||
| 33977 | ✗ | dying_flags = DYING_FORCED | (bypassFairy ? DYING_NOREV : 0); | |
| 33978 | ✗ | } | |
| 33979 | 227565589 | bool HeroClass::sideview_mode() const | |
| 33980 | { | ||
| 33981 |
3/4✓ Branch 0 taken 4882016 times.
✓ Branch 1 taken 222683573 times.
✓ Branch 2 taken 4882016 times.
✗ Branch 3 not taken.
|
227565589 | return isSideViewHero() && (moveflags & move_obeys_grav) && !walk_through_walls; |
| 33982 | } | ||
| 33983 | 32877 | bool HeroClass::is_unpushable() const | |
| 33984 | { | ||
| 33985 | 32877 | return walk_through_walls; | |
| 33986 | } | ||
| 33987 | |||
| 33988 | 427 | HeroClass Hero; | |
| 33989 |